Close menu for any mouse button on click_outside condition

This commit is contained in:
Jason Rodney Hansen 2024-12-31 16:22:46 -07:00
parent 3f2ba11d56
commit 69d074e123

View file

@ -579,7 +579,7 @@ where
.merge(menu_status) .merge(menu_status)
} }
Mouse(ButtonReleased(Left)) | Touch(FingerLifted { .. }) => { Mouse(ButtonReleased(_)) | Touch(FingerLifted { .. }) => {
let state = self.tree.state.downcast_mut::<MenuBarState>(); let state = self.tree.state.downcast_mut::<MenuBarState>();
state.pressed = false; state.pressed = false;
@ -596,7 +596,13 @@ where
.iter() .iter()
.any(|ms| ms.menu_bounds.check_bounds.contains(overlay_cursor)); .any(|ms| ms.menu_bounds.check_bounds.contains(overlay_cursor));
if self.close_condition.click_inside && is_inside { if self.close_condition.click_inside
&& is_inside
&& matches!(
event,
Mouse(ButtonReleased(Left)) | Touch(FingerLifted { .. })
)
{
state.reset(); state.reset();
return Captured; return Captured;
} }