From ce2faae2c512b03a575db1cca0696cbec0469bfa Mon Sep 17 00:00:00 2001 From: eska Date: Sat, 26 Sep 2015 03:06:42 +0200 Subject: [PATCH 1/2] Fix BaseButtons remaining pressed when hiding them while pressing them down --- scene/gui/base_button.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/scene/gui/base_button.cpp b/scene/gui/base_button.cpp index 965e7f399dd..0c63a3bc74b 100644 --- a/scene/gui/base_button.cpp +++ b/scene/gui/base_button.cpp @@ -255,6 +255,16 @@ void BaseButton::_notification(int p_what) { group->_remove_button(this); } + if (p_what==NOTIFICATION_VISIBILITY_CHANGED && !is_visible()) { + + if (!toggle_mode) { + status.pressed = false; + } + status.hovering = false; + status.press_attempt = false; + status.pressing_inside = false; + status.pressing_button = 0; + } } void BaseButton::pressed() { From 6ee2a84e8aaea03ff5007526ae8c597d14a5274b Mon Sep 17 00:00:00 2001 From: eska Date: Sat, 26 Sep 2015 05:48:51 +0200 Subject: [PATCH 2/2] Clarify `BaseButton::is_pressed()` documentation --- doc/base/classes.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/base/classes.xml b/doc/base/classes.xml index 289c9869174..946e5421048 100644 --- a/doc/base/classes.xml +++ b/doc/base/classes.xml @@ -5018,7 +5018,7 @@ - Return when the button is pressed (only if toggle_mode is active). + If toggle_mode is active, return whether the button is toggled. If toggle_mode is not active, return whether the button is pressed down.