Editor: Resolve being able to move control nodes in containers using arrow keys

Fixes #55260

(cherry picked from commit b5407f802f)
This commit is contained in:
LlamaLad7 2021-11-24 20:31:21 +00:00 committed by Rémi Verschelde
parent 0adc1ebf41
commit a0cc90a908
No known key found for this signature in database
GPG key ID: C3336907360768E1

View file

@ -2287,8 +2287,16 @@ bool CanvasItemEditor::_gui_input_move(const Ref<InputEvent> &p_event) {
if (k.is_valid() && k->is_pressed() && (tool == TOOL_SELECT || tool == TOOL_MOVE) && 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)) { (k->get_scancode() == KEY_UP || k->get_scancode() == KEY_DOWN || k->get_scancode() == KEY_LEFT || k->get_scancode() == KEY_RIGHT)) {
if (!k->is_echo()) { if (!k->is_echo()) {
// Start moving the canvas items with the keyboard // Start moving the canvas items with the keyboard, if they are movable
drag_selection = _get_edited_canvas_items(); List<CanvasItem *> selection = _get_edited_canvas_items();
drag_selection.clear();
for (List<CanvasItem *>::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_type = DRAG_KEY_MOVE;
drag_from = Vector2(); drag_from = Vector2();
drag_to = Vector2(); drag_to = Vector2();