mirror of
https://github.com/FyroxEngine/Fyrox.git
synced 2026-10-12 02:02:20 +00:00
correctly close menus when there's no parent menu item
This commit is contained in:
@@ -478,6 +478,12 @@ impl MenuItem {
|
||||
if let Ok(panel) = ui.try_get_of_type::<ContextMenu>(popup_handle) {
|
||||
// Continue search from parent menu item of popup.
|
||||
menu_item_ref_container = ui.try_get(panel.parent_menu_item).ok();
|
||||
|
||||
// A menu item could be a direct child of some popup that does not belong to some
|
||||
// other menu item. In this case we also want to close the popup.
|
||||
if menu_item_ref_container.is_none() {
|
||||
ui.send(popup_handle, PopupMessage::Close);
|
||||
}
|
||||
} else {
|
||||
// Prevent infinite loops.
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user