diff options
author | ThreeRhinosInAnElephantCostume <myrealstemail@protonmail.com> | 2021-08-19 15:54:32 +0200 |
---|---|---|
committer | ThreeRhinosInAnElephantCostume <myrealstemail@protonmail.com> | 2021-08-19 15:56:33 +0200 |
commit | 0aa13ecd30b32c64860a5176dab4c12d4e753a8c (patch) | |
tree | b55e791b856879aef92b32bfa0d996c12fbe7351 | |
parent | 819aa47feeefe76bf1cb2e179765bf35ee5d3dda (diff) |
fixed popup_menu buttons getting triggered by lmb press instead of release.
-rw-r--r-- | scene/gui/popup_menu.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/scene/gui/popup_menu.cpp b/scene/gui/popup_menu.cpp index 4bd88fde5f..aff367e398 100644 --- a/scene/gui/popup_menu.cpp +++ b/scene/gui/popup_menu.cpp @@ -358,9 +358,10 @@ void PopupMenu::_gui_input(const Ref<InputEvent> &p_event) { } int button_idx = b->get_button_index(); - if (b->is_pressed() || (!b->is_pressed() && during_grabbed_click)) { - // Allow activating item by releasing the LMB or any that was down when the popup appeared. - // However, if button was not held when opening menu, do not allow release to activate item. + if (!b->is_pressed()) { + // Activate the item on release of either the left mouse button or + // any mouse button held down when the popup was opened. + // This allows for opening the popup and triggering an action in a single mouse click. if (button_idx == MOUSE_BUTTON_LEFT || (initial_button_mask & (1 << (button_idx - 1)))) { bool was_during_grabbed_click = during_grabbed_click; during_grabbed_click = false; |