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

Fix: egui::Window size recognition issue #4388

Closed
wants to merge 66 commits into from

Conversation

rustbasic
Copy link
Contributor

@rustbasic rustbasic commented Apr 21, 2024

Fix : egui::Window size recognition issue

This is completed. Removed another commit.

It will be easier to check the problem using the example below.

struct TestApp;

impl eframe::App for TestApp {
    fn update(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) {
        egui::Window::new("test1 : scroll O, resizable O")
            .scroll(true)
            .resizable(true)
            .show(ctx, |ui| {
                ui.label("looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong");
                ui.collapsing(
                    "looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong",
                    |ui| {
                        ui.label("looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong");
                    },
                );
            });

        egui::Window::new("test2 : scroll X, resizable O")
            .scroll(false)
            .resizable(true)
            .show(ctx, |ui| {
                ui.label("looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong");
                ui.collapsing(
                    "looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong",
                    |ui| {
                        ui.label("looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong");
                    },
                );
            });

        egui::CentralPanel::default().show(ctx, |ui| {
            ctx.options_mut(|options| {
                options.tessellation_options.debug_paint_clip_rects = true;
            });
            ctx.settings_ui(ui);
        });
    }
}

fn main() {
    let _result = eframe::run_native(
        "Test",
        Default::default(),
        Box::new(|_cc| Ok(Box::new(TestApp))),
    );
}

@rustbasic rustbasic changed the title Fix: egui::Window size recognition issue Fix: egui::Window size recognition issue & To prevent egui::Window from growing or shrinking May 21, 2024
@s-nie
Copy link
Contributor

s-nie commented May 22, 2024

Thanks for taking a shot at this. I tried it and it does fix the issue.

However, the fix seems to have had some unintended side effects. For example, when increasing the size of a window, its contents will always be scaled to the maximum size that the window had at any point. On the master branch, they would take up less space again as the window is made smaller.

@rustbasic rustbasic changed the title Fix: egui::Window size recognition issue & To prevent egui::Window from growing or shrinking Fix: egui::Window size recognition issue May 23, 2024
@rustbasic
Copy link
Contributor Author

This is completed. Removed another commit.

@rustbasic rustbasic closed this Jun 6, 2024
@rustbasic rustbasic deleted the patch46 branch August 7, 2024 15:05
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

Successfully merging this pull request may close these issues.

Window contents can sometimes be affected by mouse interaction outside the window
2 participants