Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Opt-in to not store some selected state when using persistence #535

Open
mankinskin opened this issue Jul 1, 2021 · 3 comments
Open

Opt-in to not store some selected state when using persistence #535

mankinskin opened this issue Jul 1, 2021 · 3 comments

Comments

@mankinskin
Copy link
Contributor

mankinskin commented Jul 1, 2021

egui::Window::new("code")
    .open(&mut self.open)
    .scroll(true)
    .resizable(true)
    .default_height(10.0)
    .show(ctx, |ui| {
        ui.label(
            "This window is resizable and has a scroll area. You can shrink it to any size",
        );
        ui.separator();
        ui.code(contents);
    });

this is basically the same setup as in the demo app, but the window seems to follow only the size of its contents, expanding off screen for long texts. Am I missing something or did Window::default_height break in a recent patch?

@mankinskin
Copy link
Contributor Author

I am compiling like this (for web):

cargo build --release --features=persistence -p ${CRATE_NAME} --lib --target=wasm32-unknown-unknown

i.e. using the persistence feature, which apparently causes this. Without persistence the default_height is respected.

@mankinskin mankinskin changed the title Window::default_height doesn't seem to work Window::default_height ignored when using persistence Jul 1, 2021
@parasyte
Copy link
Contributor

parasyte commented Jul 5, 2021

This might be the same issue as #498, or at least related. I have some technical info and a description for a patch within that ticket. @mankinskin Can you try it out on your end and see if that fixes this issue?

@mankinskin
Copy link
Contributor Author

It does change something, but this issue is something different. I think the issue here is that the size is stored in persistent storage, and preferred over the default_size. Maybe this is expected. Using fixed_size overrides the persisted size, but also makes the window un-resizable. There ought to be an option for not persisting specific properties, so they are reinitialized on each run.

For the other issue, I noticed the same thing, and your patch seems to fix it. It is just a question what that second branch was for, and if removing it would break anything.

@mankinskin mankinskin changed the title Window::default_height ignored when using persistence Window::default_size ignored when using persistence Jul 5, 2021
@mankinskin mankinskin changed the title Window::default_size ignored when using persistence Opt-in to ignore some persisted state Jul 7, 2021
@mankinskin mankinskin changed the title Opt-in to ignore some persisted state Opt-in to not store some selected state when using persistence Jul 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants