فهرست منبع

Merge pull request #17247 from poke1024/canvas-select-prio

In CanvasItemEditor, prioritize selected items when dragging
Rémi Verschelde 7 سال پیش
والد
کامیت
91ed678708
1فایلهای تغییر یافته به همراه16 افزوده شده و 1 حذف شده
  1. 16 1
      editor/plugins/canvas_item_editor_plugin.cpp

+ 16 - 1
editor/plugins/canvas_item_editor_plugin.cpp

@@ -1681,7 +1681,22 @@ bool CanvasItemEditor::_gui_input_select(const Ref<InputEvent> &p_event) {
 			// Find the item to select
 			// Find the item to select
 			CanvasItem *canvas_item = NULL;
 			CanvasItem *canvas_item = NULL;
 			Vector<_SelectResult> selection;
 			Vector<_SelectResult> selection;
-			_find_canvas_items_at_pos(click, scene, selection, 1);
+			_find_canvas_items_at_pos(click, scene, selection, editor_selection->get_selection().empty() ? 1 : 0);
+
+			for (int i = 0; i < selection.size(); i++) {
+				if (editor_selection->is_selected(selection[i].item)) {
+					// Drag the node(s) if requested
+					List<CanvasItem *> selection = _get_edited_canvas_items();
+
+					drag_type = DRAG_ALL;
+					drag_selection = selection;
+					drag_from = click;
+					_save_canvas_item_state(drag_selection);
+
+					return true;
+				}
+			}
+
 			if (!selection.empty())
 			if (!selection.empty())
 				canvas_item = selection[0].item;
 				canvas_item = selection[0].item;