diff options
author | Alexey Kashlakov <42632842+Leytak@users.noreply.github.com> | 2019-04-08 12:31:41 +0700 |
---|---|---|
committer | Alexey Kashlakov <alexey.kashlakov@remotemonsters.com> | 2019-04-08 15:11:07 +0700 |
commit | c7fbc63cc23dc1f62e92dca3abab477f425d22e3 (patch) | |
tree | 7524625790da2cc15f6228e0c5ed15ff8889d682 | |
parent | f52c294a748e4bc4e561fb497480560aacda2d59 (diff) |
Reset button state on exit tree
Steps to reproduce a bug:
1) Hold / hover the button
2) Remove it (or parent node) from the tree
3) When we return the button back to the tree, it's pressed / hover
-rw-r--r-- | scene/gui/base_button.cpp | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/scene/gui/base_button.cpp b/scene/gui/base_button.cpp index 806c8afa5b..a8e021047d 100644 --- a/scene/gui/base_button.cpp +++ b/scene/gui/base_button.cpp @@ -282,10 +282,7 @@ void BaseButton::_notification(int p_what) { if (p_what == NOTIFICATION_ENTER_TREE) { } - if (p_what == NOTIFICATION_EXIT_TREE) { - } - - if (p_what == NOTIFICATION_VISIBILITY_CHANGED && !is_visible_in_tree()) { + if (p_what == NOTIFICATION_EXIT_TREE || (p_what == NOTIFICATION_VISIBILITY_CHANGED && !is_visible_in_tree())) { if (!toggle_mode) { status.pressed = false; |