Skip to content

Commit

Permalink
mouse must be over menu to enable cancellable event
Browse files Browse the repository at this point in the history
  • Loading branch information
ianharrigan committed Apr 6, 2024
1 parent 9117c16 commit af83004
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions haxe/ui/containers/menus/MenuBar.hx
Original file line number Diff line number Diff line change
Expand Up @@ -232,11 +232,9 @@ private class Events extends haxe.ui.events.Events {
return;
}
}
if (!force) {
if (!force && _currentMenu.hitTest(Screen.instance.currentMouseX, Screen.instance.currentMouseY)) {
var beforeCloseEvent = new UIEvent(UIEvent.BEFORE_CLOSE);
if (_currentMenu.hitTest(Screen.instance.currentMouseX, Screen.instance.currentMouseY)) {
beforeCloseEvent.relatedComponent = _currentMenu.findComponentsUnderPoint(Screen.instance.currentMouseX, Screen.instance.currentMouseY, MenuItem)[0];
}
beforeCloseEvent.relatedComponent = _currentMenu.findComponentsUnderPoint(Screen.instance.currentMouseX, Screen.instance.currentMouseY, MenuItem)[0];
_menubar.dispatch(beforeCloseEvent);
if (beforeCloseEvent.canceled) {
return;
Expand Down

0 comments on commit af83004

Please sign in to comment.