diff options
author | Robert Yevdokimov <robert.yevdokimov@autStand.com> | 2024-01-26 08:24:58 -0500 |
---|---|---|
committer | Robert Yevdokimov <robert.yevdokimov@autStand.com> | 2024-01-26 08:30:13 -0500 |
commit | d9057c8b5641a350cb13a43ec296ec3a9f4b253e (patch) | |
tree | f34c2237eceec1bb70e77e99ff43c0cf7241da7b /editor/plugins/canvas_item_editor_plugin.cpp | |
parent | 17e7f85c06366b427e5068c5b3e2940e27ff5f1d (diff) | |
download | redot-engine-d9057c8b5641a350cb13a43ec296ec3a9f4b253e.tar.gz |
Add cancel transformation shortcut to 2D
Diffstat (limited to 'editor/plugins/canvas_item_editor_plugin.cpp')
-rw-r--r-- | editor/plugins/canvas_item_editor_plugin.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index 30e0dc95c7..1f9f23b5d0 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<InputEvent> &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<InputEvent> &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<InputEvent> &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<InputEvent> &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<InputEvent> &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<InputEvent> &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%"), |