diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index 30e0dc95c73..1f9f23b5d07 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -1409,7 +1409,7 @@ bool CanvasItemEditor::_gui_input_pivot(const Ref &p_event) { } // Cancel a drag - if (b.is_valid() && b->get_button_index() == MouseButton::RIGHT && b->is_pressed()) { + if (ED_IS_SHORTCUT("canvas_item_editor/cancel_transform", p_event) || (b.is_valid() && b->get_button_index() == MouseButton::RIGHT && b->is_pressed())) { _restore_canvas_item_state(drag_selection); _reset_drag(); viewport->queue_redraw(); @@ -1492,7 +1492,7 @@ bool CanvasItemEditor::_gui_input_rotate(const Ref &p_event) { } // Cancel a drag - if (b.is_valid() && b->get_button_index() == MouseButton::RIGHT && b->is_pressed()) { + if (ED_IS_SHORTCUT("canvas_item_editor/cancel_transform", p_event) || (b.is_valid() && b->get_button_index() == MouseButton::RIGHT && b->is_pressed())) { _restore_canvas_item_state(drag_selection); _reset_drag(); viewport->queue_redraw(); @@ -1654,7 +1654,7 @@ bool CanvasItemEditor::_gui_input_anchors(const Ref &p_event) { } // Cancel a drag - if (b.is_valid() && b->get_button_index() == MouseButton::RIGHT && b->is_pressed()) { + if (ED_IS_SHORTCUT("canvas_item_editor/cancel_transform", p_event) || (b.is_valid() && b->get_button_index() == MouseButton::RIGHT && b->is_pressed())) { _restore_canvas_item_state(drag_selection); _reset_drag(); viewport->queue_redraw(); @@ -1855,7 +1855,7 @@ bool CanvasItemEditor::_gui_input_resize(const Ref &p_event) { } // Cancel a drag - if (b.is_valid() && b->get_button_index() == MouseButton::RIGHT && b->is_pressed()) { + if (ED_IS_SHORTCUT("canvas_item_editor/cancel_transform", p_event) || (b.is_valid() && b->get_button_index() == MouseButton::RIGHT && b->is_pressed())) { _restore_canvas_item_state(drag_selection); snap_target[0] = SNAP_TARGET_NONE; snap_target[1] = SNAP_TARGET_NONE; @@ -1994,7 +1994,7 @@ bool CanvasItemEditor::_gui_input_scale(const Ref &p_event) { } // Cancel a drag - if (b.is_valid() && b->get_button_index() == MouseButton::RIGHT && b->is_pressed()) { + if (ED_IS_SHORTCUT("canvas_item_editor/cancel_transform", p_event) || (b.is_valid() && b->get_button_index() == MouseButton::RIGHT && b->is_pressed())) { _restore_canvas_item_state(drag_selection); _reset_drag(); viewport->queue_redraw(); @@ -2132,7 +2132,7 @@ bool CanvasItemEditor::_gui_input_move(const Ref &p_event) { } // Cancel a drag - if (b.is_valid() && b->get_button_index() == MouseButton::RIGHT && b->is_pressed()) { + if (ED_IS_SHORTCUT("canvas_item_editor/cancel_transform", p_event) || (b.is_valid() && b->get_button_index() == MouseButton::RIGHT && b->is_pressed())) { _restore_canvas_item_state(drag_selection, true); snap_target[0] = SNAP_TARGET_NONE; snap_target[1] = SNAP_TARGET_NONE; @@ -5132,6 +5132,8 @@ CanvasItemEditor::CanvasItemEditor() { controls_vb = memnew(VBoxContainer); controls_vb->set_begin(Point2(5, 5)); + ED_SHORTCUT("canvas_item_editor/cancel_transform", TTR("Cancel Transformation"), Key::ESCAPE); + // To ensure that scripts can parse the list of shortcuts correctly, we have to define // those shortcuts one by one. Define shortcut before using it (by EditorZoomWidget). ED_SHORTCUT_ARRAY("canvas_item_editor/zoom_3.125_percent", TTR("Zoom to 3.125%"),