Skip to content

Commit

Permalink
add a small delay before hiding menu (better for visual cues)
Browse files Browse the repository at this point in the history
  • Loading branch information
ianharrigan committed Jul 7, 2024
1 parent 605d9f8 commit c40e6e6
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions haxe/ui/containers/menus/Menu.hx
Original file line number Diff line number Diff line change
Expand Up @@ -172,20 +172,22 @@ class MenuEvents extends haxe.ui.events.Events {
var event = new MenuEvent(MenuEvent.MENU_SELECTED);
event.menu = _menu;
event.menuItem = item;
findRootMenu().dispatch(event);

if (_menu.menuBar == null) {
var beforeCloseEvent = new UIEvent(UIEvent.BEFORE_CLOSE);
beforeCloseEvent.relatedComponent = item;
findRootMenu().dispatch(beforeCloseEvent);
if (beforeCloseEvent.canceled) {
return;
Timer.delay(function() {
findRootMenu().dispatch(event);

if (_menu.menuBar == null) {
var beforeCloseEvent = new UIEvent(UIEvent.BEFORE_CLOSE);
beforeCloseEvent.relatedComponent = item;
findRootMenu().dispatch(beforeCloseEvent);
if (beforeCloseEvent.canceled) {
return;
}

hideMenu();
removeScreenMouseDown();
}

hideMenu();
removeScreenMouseDown();
}
_menu.dispatch(new UIEvent(UIEvent.CLOSE));
_menu.dispatch(new UIEvent(UIEvent.CLOSE));
}, 100);
}
}

Expand Down

0 comments on commit c40e6e6

Please sign in to comment.