瀏覽代碼

Fix BaseButtons remaining pressed when hiding them while pressing them down

eska 10 年之前
父節點
當前提交
ce2faae2c5
共有 1 個文件被更改,包括 10 次插入0 次删除
  1. 10 0
      scene/gui/base_button.cpp

+ 10 - 0
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() {