From a0cc90a90829a02a276fdda00c6151acf5521af6 Mon Sep 17 00:00:00 2001 From: LlamaLad7 Date: Wed, 24 Nov 2021 20:31:21 +0000 Subject: [PATCH] Editor: Resolve being able to move control nodes in containers using arrow keys Fixes #55260 (cherry picked from commit b5407f802fbcd3cf78a62075cb5a4af5f173fa08) --- editor/plugins/canvas_item_editor_plugin.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index 461b7fcd4e9..64c8c00eafb 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -2287,8 +2287,16 @@ bool CanvasItemEditor::_gui_input_move(const Ref &p_event) { if (k.is_valid() && k->is_pressed() && (tool == TOOL_SELECT || tool == TOOL_MOVE) && (k->get_scancode() == KEY_UP || k->get_scancode() == KEY_DOWN || k->get_scancode() == KEY_LEFT || k->get_scancode() == KEY_RIGHT)) { if (!k->is_echo()) { - // Start moving the canvas items with the keyboard - drag_selection = _get_edited_canvas_items(); + // Start moving the canvas items with the keyboard, if they are movable + List selection = _get_edited_canvas_items(); + + drag_selection.clear(); + for (List::Element *E = selection.front(); E; E = E->next()) { + if (_is_node_movable(E->get(), true)) { + drag_selection.push_back(E->get()); + } + } + drag_type = DRAG_KEY_MOVE; drag_from = Vector2(); drag_to = Vector2();