diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2020-01-03 16:23:57 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-03 16:23:57 +0100 |
commit | 6f279ed6ebe7f9be1bd1ca852d9a6135c5e059c5 (patch) | |
tree | 90e0d70fbeb5b321a66a2521da947ab14e8614ae | |
parent | a18909f9452180c36b62f34dda07fbebb6c863ed (diff) | |
parent | b728d3bd18420020175cb53fd44d8dccbea6bd15 (diff) |
Merge pull request #34781 from fossegutten/button-flash
Fixes button flashing when releasing mousebutton outside
-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(); |