diff options
author | Juan Linietsky <reduzio@gmail.com> | 2018-11-01 17:01:51 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-01 17:01:51 -0300 |
commit | 65e3ef705b0f45866e3bb4a75bafa374a559d1f0 (patch) | |
tree | bedb5cf57007a9c30b5c492b61854935ed6e6e0c /scene/main | |
parent | 755249f7d9e67ff83d46747cf9804ee8b0b0b742 (diff) | |
parent | 592eda7ad9458ef1677565e2b86afd9aad45fed1 (diff) |
Merge pull request #21962 from YeldhamDev/switch_hover_submenu
Fix MenuButton hover switching not happening with submenus open
Diffstat (limited to 'scene/main')
-rw-r--r-- | scene/main/viewport.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index 6bf1d12086..a28b6fd6de 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -1839,8 +1839,16 @@ void Viewport::_gui_input_event(Ref<InputEvent> p_event) { MenuButton *popup_menu_parent = NULL; MenuButton *menu_button = Object::cast_to<MenuButton>(over); - if (popup_menu) + if (popup_menu) { popup_menu_parent = Object::cast_to<MenuButton>(popup_menu->get_parent()); + if (!popup_menu_parent) { + // Go through the parents to see if there's a MenuButton at the end. + while (Object::cast_to<PopupMenu>(popup_menu->get_parent())) { + popup_menu = Object::cast_to<PopupMenu>(popup_menu->get_parent()); + } + popup_menu_parent = Object::cast_to<MenuButton>(popup_menu->get_parent()); + } + } // If the mouse is over a menu button, this menu will open automatically // if there is already a pop-up menu open at the same hierarchical level. |