Close menu for any mouse button on click_outside condition
This commit is contained in:
parent
3f2ba11d56
commit
69d074e123
1 changed files with 8 additions and 2 deletions
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue