From 4dab4aff16993da4a4f5f4f830e6a9cf4196a8e2 Mon Sep 17 00:00:00 2001 From: norlock Date: Wed, 17 Jul 2024 10:12:36 +0200 Subject: [PATCH] Hide expand/collapse functionality when hidden --- crates/egui/src/containers/window.rs | 4 +--- crates/egui_demo_lib/src/demo/demo_app_windows.rs | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/crates/egui/src/containers/window.rs b/crates/egui/src/containers/window.rs index 3f9d0f1b603..090553ec7b5 100644 --- a/crates/egui/src/containers/window.rs +++ b/crates/egui/src/containers/window.rs @@ -503,8 +503,6 @@ impl<'open> Window<'open> { let area_layer_id = area.layer(); let resize_id = area_id.with("resize"); - //println!("{collapsing:?}"); - let is_expanded = with_title_bar && collapsing.is_expanded(); let possible = PossibleInteractions::new(&area, &resize, is_expanded); @@ -669,7 +667,7 @@ impl<'open> Window<'open> { let full_response = area.end(ctx, area_content_ui); - // Resync if open & window_action are just together. + // Resync if open & window_action are used together. if let Some(open) = open { *open = collapsing.is_shown(); } diff --git a/crates/egui_demo_lib/src/demo/demo_app_windows.rs b/crates/egui_demo_lib/src/demo/demo_app_windows.rs index 2c3f37c5aaa..84b6a2064a1 100644 --- a/crates/egui_demo_lib/src/demo/demo_app_windows.rs +++ b/crates/egui_demo_lib/src/demo/demo_app_windows.rs @@ -326,7 +326,7 @@ impl DemoWindows { self.about_window_action = Some(WindowAction::ToggleShow); } - if ui.button("Toggle expand/collapse about").clicked() { + if self.about_is_open && ui.button("Toggle expand/collapse about").clicked() { self.about_window_action = Some(WindowAction::ToggleExpand); } }