Add cancel transformation shortcut to 2D
This commit is contained in:
parent
17e7f85c06
commit
d9057c8b56
|
@ -1409,7 +1409,7 @@ bool CanvasItemEditor::_gui_input_pivot(const Ref<InputEvent> &p_event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cancel a drag
|
// 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);
|
_restore_canvas_item_state(drag_selection);
|
||||||
_reset_drag();
|
_reset_drag();
|
||||||
viewport->queue_redraw();
|
viewport->queue_redraw();
|
||||||
|
@ -1492,7 +1492,7 @@ bool CanvasItemEditor::_gui_input_rotate(const Ref<InputEvent> &p_event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cancel a drag
|
// 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);
|
_restore_canvas_item_state(drag_selection);
|
||||||
_reset_drag();
|
_reset_drag();
|
||||||
viewport->queue_redraw();
|
viewport->queue_redraw();
|
||||||
|
@ -1654,7 +1654,7 @@ bool CanvasItemEditor::_gui_input_anchors(const Ref<InputEvent> &p_event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cancel a drag
|
// 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);
|
_restore_canvas_item_state(drag_selection);
|
||||||
_reset_drag();
|
_reset_drag();
|
||||||
viewport->queue_redraw();
|
viewport->queue_redraw();
|
||||||
|
@ -1855,7 +1855,7 @@ bool CanvasItemEditor::_gui_input_resize(const Ref<InputEvent> &p_event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cancel a drag
|
// 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);
|
_restore_canvas_item_state(drag_selection);
|
||||||
snap_target[0] = SNAP_TARGET_NONE;
|
snap_target[0] = SNAP_TARGET_NONE;
|
||||||
snap_target[1] = 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
|
// 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);
|
_restore_canvas_item_state(drag_selection);
|
||||||
_reset_drag();
|
_reset_drag();
|
||||||
viewport->queue_redraw();
|
viewport->queue_redraw();
|
||||||
|
@ -2132,7 +2132,7 @@ bool CanvasItemEditor::_gui_input_move(const Ref<InputEvent> &p_event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cancel a drag
|
// 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);
|
_restore_canvas_item_state(drag_selection, true);
|
||||||
snap_target[0] = SNAP_TARGET_NONE;
|
snap_target[0] = SNAP_TARGET_NONE;
|
||||||
snap_target[1] = SNAP_TARGET_NONE;
|
snap_target[1] = SNAP_TARGET_NONE;
|
||||||
|
@ -5132,6 +5132,8 @@ CanvasItemEditor::CanvasItemEditor() {
|
||||||
controls_vb = memnew(VBoxContainer);
|
controls_vb = memnew(VBoxContainer);
|
||||||
controls_vb->set_begin(Point2(5, 5));
|
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
|
// 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).
|
// 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%"),
|
ED_SHORTCUT_ARRAY("canvas_item_editor/zoom_3.125_percent", TTR("Zoom to 3.125%"),
|
||||||
|
|
Loading…
Reference in New Issue