diff options
author | Alexey Kashlakov <42632842+Leytak@users.noreply.github.com> | 2018-09-14 14:21:58 +0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-14 14:21:58 +0700 |
commit | 1e65916241037d559f27c5d3c81fbf4f5d57884f (patch) | |
tree | c6138b7423a196cd80c586f0a40e5959e979b5b8 /scene/gui | |
parent | 319a0a319b7b8c7875e6fa1a4679ce23b152ae82 (diff) |
Discard button pressing flags on disable
Is it a bug?
1) Click the button and hold
2) Disable it (for example I bind this action on keyboard)
3) Release the mouse and move it outside the button
4) Enable the button
5) It's still pressed, but shouldn't
Diffstat (limited to 'scene/gui')
-rw-r--r-- | scene/gui/base_button.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/scene/gui/base_button.cpp b/scene/gui/base_button.cpp index 59590ea67b..7bba36f957 100644 --- a/scene/gui/base_button.cpp +++ b/scene/gui/base_button.cpp @@ -315,6 +315,14 @@ void BaseButton::set_disabled(bool p_disabled) { return; status.disabled = p_disabled; + if (p_disabled) { + if (!toggle_mode) { + status.pressed = false; + } + status.press_attempt = false; + status.pressing_inside = false; + status.pressing_button = 0; + } update(); _change_notify("disabled"); } |