Преглед на файлове

Fix mouse cursor and notification for force dragging

(cherry picked from commit 86a47c65407fe94366c8b1a2074b60d3ce37af24)
Haoyu Qiu преди 3 години
родител
ревизия
a0fb66d802
променени са 1 файла, в които са добавени 6 реда и са изтрити 8 реда
  1. 6 8
      scene/main/viewport.cpp

+ 6 - 8
scene/main/viewport.cpp

@@ -2275,15 +2275,12 @@ void Viewport::_gui_input_event(Ref<InputEvent> p_event) {
 
 
 		set_input_as_handled();
 		set_input_as_handled();
 
 
-		if (gui.drag_data.get_type() != Variant::NIL && mm->get_button_mask() & BUTTON_MASK_LEFT) {
-			bool can_drop = _gui_drop(over, pos, true);
+		bool can_drop = _gui_drop(over, pos, true);
 
 
-			if (!can_drop) {
-				OS::get_singleton()->set_cursor_shape(OS::CURSOR_FORBIDDEN);
-			} else {
-				OS::get_singleton()->set_cursor_shape(OS::CURSOR_CAN_DROP);
-			}
-			//change mouse accordingly i guess
+		if (!can_drop) {
+			OS::get_singleton()->set_cursor_shape(OS::CURSOR_FORBIDDEN);
+		} else {
+			OS::get_singleton()->set_cursor_shape(OS::CURSOR_CAN_DROP);
 		}
 		}
 	}
 	}
 
 
@@ -2526,6 +2523,7 @@ void Viewport::_gui_force_drag(Control *p_base, const Variant &p_data, Control *
 	if (p_control) {
 	if (p_control) {
 		_gui_set_drag_preview(p_base, p_control);
 		_gui_set_drag_preview(p_base, p_control);
 	}
 	}
+	_propagate_viewport_notification(this, NOTIFICATION_DRAG_BEGIN);
 }
 }
 
 
 void Viewport::_gui_set_drag_preview(Control *p_base, Control *p_control) {
 void Viewport::_gui_set_drag_preview(Control *p_base, Control *p_control) {