summaryrefslogtreecommitdiff
path: root/scene/gui/menu_button.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'scene/gui/menu_button.cpp')
-rw-r--r--scene/gui/menu_button.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/scene/gui/menu_button.cpp b/scene/gui/menu_button.cpp
index a011b793de..5f21d73ab2 100644
--- a/scene/gui/menu_button.cpp
+++ b/scene/gui/menu_button.cpp
@@ -91,6 +91,16 @@ bool MenuButton::is_switch_on_hover() {
return switch_on_hover;
}
+void MenuButton::_notification(int p_what) {
+
+ if (p_what == NOTIFICATION_VISIBILITY_CHANGED) {
+
+ if (!is_visible_in_tree()) {
+ popup->hide();
+ }
+ }
+}
+
void MenuButton::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_popup"), &MenuButton::get_popup);