From 5984febde2a32b326f85c5a1023924df9e3d683a Mon Sep 17 00:00:00 2001 From: Tomasz Chabora Date: Sun, 19 Jul 2020 23:13:08 +0200 Subject: [PATCH] Prevent multiple Controls moving inside container (cherry picked from commit e44c9101da074779a403a5d66dd13e4d25cc824f) --- editor/plugins/canvas_item_editor_plugin.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index 20bf32abe35..4dd8239831a 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -1996,17 +1996,16 @@ bool CanvasItemEditor::_gui_input_move(const Ref &p_event) { if ((b->get_alt() && !b->get_control()) || tool == TOOL_MOVE) { List selection = _get_edited_canvas_items(); - // Remove not movable nodes + drag_selection.clear(); for (int i = 0; i < selection.size(); i++) { - if (!_is_node_movable(selection[i], true)) { - selection.erase(selection[i]); + if (_is_node_movable(selection[i], true)) { + drag_selection.push_back(selection[i]); } } if (selection.size() > 0) { drag_type = DRAG_MOVE; drag_from = transform.affine_inverse().xform(b->get_position()); - drag_selection = selection; _save_canvas_item_state(drag_selection); } return true; @@ -2296,16 +2295,15 @@ bool CanvasItemEditor::_gui_input_select(const Ref &p_event) { // Drag the node(s) if requested List selection2 = _get_edited_canvas_items(); - // Remove not movable nodes + drag_selection.clear(); for (int i = 0; i < selection2.size(); i++) { - if (!_is_node_movable(selection2[i], true)) { - selection2.erase(selection2[i]); + if (_is_node_movable(selection2[i], true)) { + drag_selection.push_back(selection2[i]); } } if (selection2.size() > 0) { drag_type = DRAG_MOVE; - drag_selection = selection2; drag_from = click; _save_canvas_item_state(drag_selection); }