summaryrefslogtreecommitdiff
path: root/scene/gui
diff options
context:
space:
mode:
authorMichael Alexsander Silva Dias <michaelalexsander@protonmail.com>2018-09-11 01:44:19 -0300
committerMichael Alexsander Silva Dias <michaelalexsander@protonmail.com>2018-09-11 01:44:19 -0300
commit592eda7ad9458ef1677565e2b86afd9aad45fed1 (patch)
treea4a30a774d2f23a274ae2d8845ce89e11e5012f7 /scene/gui
parentc320d9394d82b755e2ccffb0d8fac3e9df61396b (diff)
Fix MenuButton hover switching not happening with submenus open
Diffstat (limited to 'scene/gui')
-rw-r--r--scene/gui/popup_menu.cpp18
1 files changed, 16 insertions, 2 deletions
diff --git a/scene/gui/popup_menu.cpp b/scene/gui/popup_menu.cpp
index 436dda41a4..4c84f2cee3 100644
--- a/scene/gui/popup_menu.cpp
+++ b/scene/gui/popup_menu.cpp
@@ -557,6 +557,21 @@ void PopupMenu::_notification(int p_what) {
mouse_over = -1;
update();
}
+
+ for (int i = 0; i < items.size(); i++) {
+ if (items[i].submenu == "")
+ continue;
+
+ Node *n = get_node(items[i].submenu);
+ if (!n)
+ continue;
+
+ PopupMenu *pm = Object::cast_to<PopupMenu>(n);
+ if (!pm || !pm->is_visible())
+ continue;
+
+ pm->hide();
+ }
} break;
}
}
@@ -1012,8 +1027,7 @@ bool PopupMenu::activate_item_by_event(const Ref<InputEvent> &p_event, bool p_fo
code |= KEY_MASK_SHIFT;
}
- int il = items.size();
- for (int i = 0; i < il; i++) {
+ for (int i = 0; i < items.size(); i++) {
if (is_item_disabled(i) || items[i].shortcut_is_disabled)
continue;