From b728d3bd18420020175cb53fd44d8dccbea6bd15 Mon Sep 17 00:00:00 2001 From: fossegutten Date: Fri, 3 Jan 2020 12:21:52 +0100 Subject: [PATCH] Fixes button flashing when releasing mousebutton outside --- scene/gui/base_button.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/scene/gui/base_button.cpp b/scene/gui/base_button.cpp index 56467517d13..65912c1c07e 100644 --- a/scene/gui/base_button.cpp +++ b/scene/gui/base_button.cpp @@ -171,9 +171,17 @@ void BaseButton::on_action_event(Ref p_event) { } } - if (!p_event->is_pressed()) { // pressed state should be correct with button_up signal + if (!p_event->is_pressed()) { + Ref 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();