fix(segmented_button): close context menu when clicked outside
This commit is contained in:
parent
3f2ba11d56
commit
51ede4bce6
2 changed files with 20 additions and 5 deletions
|
|
@ -579,7 +579,7 @@ where
|
|||
.merge(menu_status)
|
||||
}
|
||||
|
||||
Mouse(ButtonReleased(Left)) | Touch(FingerLifted { .. }) => {
|
||||
Mouse(ButtonReleased(_)) | Touch(FingerLifted { .. }) => {
|
||||
let state = self.tree.state.downcast_mut::<MenuBarState>();
|
||||
state.pressed = false;
|
||||
|
||||
|
|
@ -596,7 +596,13 @@ where
|
|||
.iter()
|
||||
.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();
|
||||
return Captured;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue