diff options
author | fossegutten <kjetil.fosse@outlook.com> | 2020-01-03 12:21:52 +0100 |
---|---|---|
committer | fossegutten <kjetil.fosse@outlook.com> | 2020-01-03 14:55:27 +0100 |
commit | b728d3bd18420020175cb53fd44d8dccbea6bd15 (patch) | |
tree | d09f0f74c6c1723ea2a78183be86f8119734b0ed /scene/gui | |
parent | 2ee6f42759f8617781458f46cf64b5d97f63d8a8 (diff) |
Fixes button flashing when releasing mousebutton outside
Diffstat (limited to 'scene/gui')
-rw-r--r-- | scene/gui/base_button.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/scene/gui/base_button.cpp b/scene/gui/base_button.cpp index 56467517d1..65912c1c07 100644 --- a/scene/gui/base_button.cpp +++ b/scene/gui/base_button.cpp @@ -171,9 +171,17 @@ void BaseButton::on_action_event(Ref<InputEvent> p_event) { } } - if (!p_event->is_pressed()) { // pressed state should be correct with button_up signal + if (!p_event->is_pressed()) { + Ref<InputEventMouseButton> mouse_button = p_event; + if (mouse_button.is_valid()) { + if (!has_point(mouse_button->get_position())) { + status.hovering = false; + } + } + // pressed state should be correct with button_up signal emit_signal("button_up"); status.press_attempt = false; + status.pressing_inside = false; } update(); |