Ver Fonte

Make button aware of it being dragged and reset state, closes #4178

Juan Linietsky há 9 anos atrás
pai
commit
9e0b6057e7
2 ficheiros alterados com 10 adições e 1 exclusões
  1. 10 0
      scene/gui/base_button.cpp
  2. 0 1
      scene/main/viewport.cpp

+ 10 - 0
scene/gui/base_button.cpp

@@ -225,11 +225,21 @@ void BaseButton::_notification(int p_what) {
 		status.hovering=false;
 		update();
 	}
+	if (p_what==NOTIFICATION_DRAG_BEGIN) {
+
+		if (status.press_attempt) {
+			status.press_attempt=false;
+			status.pressing_button=0;
+			update();
+		}
+	}
+
 	if (p_what==NOTIFICATION_FOCUS_EXIT) {
 
 		if (status.pressing_button && status.press_attempt) {
 			status.press_attempt=false;
 			status.pressing_button=0;
+			update();
 		}
 	}
 

+ 0 - 1
scene/main/viewport.cpp

@@ -1933,7 +1933,6 @@ void Viewport::_gui_input_event(InputEvent p_event) {
 			}
 
 
-
 			if (over!=gui.mouse_over) {
 
 				if (gui.mouse_over)