summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Alexsander <michaelalexsander@protonmail.com>2024-04-13 15:10:19 -0300
committerMichael Alexsander <michaelalexsander@protonmail.com>2024-04-13 15:10:19 -0300
commit978ffb39bfd9bfb501367f9cb041e45e9d3a22e3 (patch)
tree3d7290009f4d1088d47e85110ac95e841afd94b7
parenta7b860250f305f6cbaf61c30f232ff3bbdfdda0b (diff)
downloadredot-engine-978ffb39bfd9bfb501367f9cb041e45e9d3a22e3.tar.gz
Fix submenus erroneously closing on some occasions
-rw-r--r--scene/gui/popup_menu.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/scene/gui/popup_menu.cpp b/scene/gui/popup_menu.cpp
index 56346f5edc..b6dd3ac0b4 100644
--- a/scene/gui/popup_menu.cpp
+++ b/scene/gui/popup_menu.cpp
@@ -640,11 +640,17 @@ void PopupMenu::_input_from_window_internal(const Ref<InputEvent> &p_event) {
for (const Rect2 &E : autohide_areas) {
if (!Rect2(Point2(), get_size()).has_point(m->get_position()) && E.has_point(m->get_position())) {
+ // The mouse left the safe area, prepare to close.
_close_pressed();
return;
}
}
+ if (!minimum_lifetime_timer->is_stopped()) {
+ // The mouse left the safe area, but came back again, so cancel the auto-closing.
+ minimum_lifetime_timer->stop();
+ }
+
if (!item_clickable_area.has_point(m->get_position())) {
return;
}