diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2022-08-24 19:07:25 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-24 19:07:25 +0200 |
commit | b7d2ba12c81ccd1ec509b7a7503f0136ae204f63 (patch) | |
tree | c47a34dd7b7b36eed7458f82d8dd92919c563dda /scene/gui/base_button.cpp | |
parent | 29616514448297d8222928fe89e8b62193d1fa44 (diff) | |
parent | 1da50698fcb4bc8350c89c6777b5960bc2cc758a (diff) |
Merge pull request #64635 from YeldhamDev/menu_buttons_popup_fix
Make `Menu/OptionButton` item auto-highlight behave better
Diffstat (limited to 'scene/gui/base_button.cpp')
-rw-r--r-- | scene/gui/base_button.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/scene/gui/base_button.cpp b/scene/gui/base_button.cpp index 4bc2fe6ed9..87a7355bb2 100644 --- a/scene/gui/base_button.cpp +++ b/scene/gui/base_button.cpp @@ -64,6 +64,8 @@ void BaseButton::gui_input(const Ref<InputEvent> &p_event) { bool button_masked = mouse_button.is_valid() && (mouse_button_to_mask(mouse_button->get_button_index()) & button_mask) != MouseButton::NONE; if (button_masked || ui_accept) { + was_mouse_pressed = button_masked; + on_action_event(p_event); return; } @@ -417,6 +419,10 @@ bool BaseButton::_is_focus_owner_in_shortcut_context() const { return ctx_node && vp_focus && (ctx_node == vp_focus || ctx_node->is_ancestor_of(vp_focus)); } +bool BaseButton::_was_pressed_by_mouse() const { + return was_mouse_pressed; +} + void BaseButton::_bind_methods() { ClassDB::bind_method(D_METHOD("set_pressed", "pressed"), &BaseButton::set_pressed); ClassDB::bind_method(D_METHOD("is_pressed"), &BaseButton::is_pressed); |