Merge pull request #2534 from eska014/unpress-hidden-buttons

Fix BaseButtons remaining pressed when hiding while pressed down
This commit is contained in:
Juan Linietsky 2015-09-26 00:53:38 -03:00
commit 6f0df4e80c
2 changed files with 11 additions and 1 deletions

View File

@ -5018,7 +5018,7 @@
<return type="bool"> <return type="bool">
</return> </return>
<description> <description>
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.
</description> </description>
</method> </method>
<method name="is_hovered" qualifiers="const"> <method name="is_hovered" qualifiers="const">

View File

@ -255,6 +255,16 @@ void BaseButton::_notification(int p_what) {
group->_remove_button(this); 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() { void BaseButton::pressed() {