Skip to content

Commit

Permalink
Hide expand/collapse functionality when hidden
Browse files Browse the repository at this point in the history
  • Loading branch information
Norlock committed Jul 17, 2024
1 parent 316adf4 commit 4dab4af
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
4 changes: 1 addition & 3 deletions crates/egui/src/containers/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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();
}
Expand Down
2 changes: 1 addition & 1 deletion crates/egui_demo_lib/src/demo/demo_app_windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down

0 comments on commit 4dab4af

Please sign in to comment.