diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2018-03-05 21:07:22 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-05 21:07:22 +0100 |
commit | 91ed6787088f888e196331915d59154ef2a6ce58 (patch) | |
tree | f926faf236593cfa07cecd363757d09671bd8d51 | |
parent | ce6b7efb21188be53eeb141edbbce5607cab52a7 (diff) | |
parent | ced694e9cd77daf0882076d43f11171939345f81 (diff) |
Merge pull request #17247 from poke1024/canvas-select-prio
In CanvasItemEditor, prioritize selected items when dragging
-rw-r--r-- | editor/plugins/canvas_item_editor_plugin.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index f16747f929..ba68259599 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/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 CanvasItem *canvas_item = NULL; 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()) canvas_item = selection[0].item; |