浏览代码

Merge pull request #27796 from Leytak/patch-2

Reset button state on exit tree
Rémi Verschelde 6 年之前
父节点
当前提交
4f10a08d1b
共有 1 个文件被更改,包括 1 次插入4 次删除
  1. 1 4
      scene/gui/base_button.cpp

+ 1 - 4
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;