diff options
author | Michael Alexsander Silva Dias <michaelalexsander@protonmail.com> | 2018-09-11 01:44:19 -0300 |
---|---|---|
committer | Michael Alexsander Silva Dias <michaelalexsander@protonmail.com> | 2018-09-11 01:44:19 -0300 |
commit | 592eda7ad9458ef1677565e2b86afd9aad45fed1 (patch) | |
tree | a4a30a774d2f23a274ae2d8845ce89e11e5012f7 /scene/main | |
parent | c320d9394d82b755e2ccffb0d8fac3e9df61396b (diff) |
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 d1b3eb9d9a..ded32aa270 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -1859,8 +1859,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. |