From d462ce6a120340e1dc905d14336bc5d279ccd912 Mon Sep 17 00:00:00 2001 From: Danny Stoll Date: Mon, 5 Jun 2023 21:29:39 -0400 Subject: [PATCH 1/2] Removed trigger for submenu closure if cursor is no longer hovering over submenu --- crates/egui/src/menu.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/crates/egui/src/menu.rs b/crates/egui/src/menu.rs index 5e27e953631..0260068173e 100644 --- a/crates/egui/src/menu.rs +++ b/crates/egui/src/menu.rs @@ -616,8 +616,6 @@ impl MenuState { } else if !open && button.hovered() { let pos = button.rect.right_top(); self.open_submenu(sub_id, pos); - } else if open && !button.hovered() && !self.hovering_current_submenu(&pointer) { - self.close_submenu(); } } From 11c123bd9cc0157d3677bf36fc4da43297df6902 Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Sun, 7 Jan 2024 16:16:59 +0100 Subject: [PATCH 2/2] Remove dead code --- crates/egui/src/menu.rs | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/crates/egui/src/menu.rs b/crates/egui/src/menu.rs index 0260068173e..255f102b6c4 100644 --- a/crates/egui/src/menu.rs +++ b/crates/egui/src/menu.rs @@ -640,16 +640,6 @@ impl MenuState { false } - /// Check if pointer is hovering current submenu. - fn hovering_current_submenu(&self, pointer: &PointerState) -> bool { - if let Some(sub_menu) = self.current_submenu() { - if let Some(pos) = pointer.hover_pos() { - return sub_menu.read().area_contains(pos); - } - } - false - } - /// Cascade close response to menu root. fn cascade_close_response(&mut self, response: MenuResponse) { if response.is_close() { @@ -681,8 +671,4 @@ impl MenuState { self.sub_menu = Some((id, Arc::new(RwLock::new(MenuState::new(pos))))); } } - - fn close_submenu(&mut self) { - self.sub_menu = None; - } }