Skip to content

Commit

Permalink
Merge pull request #90639 from YeldhamDev/stay_open_please
Browse files Browse the repository at this point in the history
Fix submenus erroneously closing on some occasions
  • Loading branch information
akien-mga committed Apr 17, 2024
2 parents 544ecc1 + 978ffb3 commit fad6897
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions scene/gui/popup_menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit fad6897

Please sign in to comment.