egui icon indicating copy to clipboard operation
egui copied to clipboard

Fix : egui::Window size recognition issue & is_manually

Open rustbasic opened this issue 1 year ago • 0 comments

Fix : egui::Window size recognition issue

Fix : is_manually - Made functions like .default_size() and .resizeable() work properly that were not working.

  • Related #4300
  • Closes #4349
  • Closes #4388

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(true)
            .resizable(true)
            .show(ctx, |ui| {
                ui.label("looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong");
                ui.collapsing(
                    "looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong",
                    |ui| {
                        ui.label("looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong");
                    },
                );
            });

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

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

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

        egui::Window::new("test1-2")
            .scroll(true)
            .resizable(true)
            .default_size([300.0, 20.0])
            .show(ctx, |ui| {
                ui.label("looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong");
                ui.collapsing(
                    "looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong",
                    |ui| {
                        ui.label("looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong");
                    },
                );
            });

        egui::Window::new("test2-2")
            .scroll(false)
            .resizable(true)
            .default_size([300.0, 20.0])
            .show(ctx, |ui| {
                ui.label("looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong");
                ui.collapsing(
                    "looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong",
                    |ui| {
                        ui.label("looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong");
                    },
                );
            });

        egui::Window::new("test3-2")
            .scroll(true)
            .resizable(false)
            .default_size([300.0, 20.0])
            .show(ctx, |ui| {
                ui.label("looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong");
                ui.collapsing(
                    "looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong",
                    |ui| {
                        ui.label("looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong");
                    },
                );
            });

        egui::Window::new("test4-2")
            .scroll(false)
            .resizable(false)
            .default_size([300.0, 20.0])
            .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| Box::new(TestApp)),
    );
}

rustbasic avatar May 26 '24 15:05 rustbasic