diff options
author | Gilles Roudiere <gilles.roudiere@laas.fr> | 2018-04-25 10:48:21 +0200 |
---|---|---|
committer | Gilles Roudiere <gilles.roudiere@laas.fr> | 2018-04-26 10:28:56 +0200 |
commit | 8dcd39c3c47967a0ba81374299b80be583cf46e2 (patch) | |
tree | e6245e2b765c0cfdc67f334d7ee25ef8dcf0880d | |
parent | 6faa96fb89ab33fe3a6b37eecca1c7cf2934ff75 (diff) |
Adds shortcuts for zooming in the 2D editor
-rw-r--r-- | editor/plugins/canvas_item_editor_plugin.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index bb94aee462..cd8723930c 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -3183,7 +3183,7 @@ void CanvasItemEditor::_zoom_on_position(float p_zoom, Point2 p_position) { } void CanvasItemEditor::_button_zoom_minus() { - _zoom_on_position(zoom / 2.0, viewport_scrollable->get_size() / 2.0); + _zoom_on_position(zoom / 1.5, viewport_scrollable->get_size() / 2.0); } void CanvasItemEditor::_button_zoom_reset() { @@ -3191,7 +3191,7 @@ void CanvasItemEditor::_button_zoom_reset() { } void CanvasItemEditor::_button_zoom_plus() { - _zoom_on_position(zoom * 2.0, viewport_scrollable->get_size() / 2.0); + _zoom_on_position(zoom * 1.5, viewport_scrollable->get_size() / 2.0); } void CanvasItemEditor::_button_toggle_snap(bool p_status) { @@ -4064,16 +4064,19 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) { zoom_minus = memnew(ToolButton); zoom_hb->add_child(zoom_minus); zoom_minus->connect("pressed", this, "_button_zoom_minus"); + zoom_minus->set_shortcut(ED_SHORTCUT("canvas_item_editor/zoom_minus", TTR("Zoom out"), KEY_MASK_CMD | KEY_MINUS)); zoom_minus->set_focus_mode(FOCUS_NONE); zoom_reset = memnew(ToolButton); zoom_hb->add_child(zoom_reset); zoom_reset->connect("pressed", this, "_button_zoom_reset"); + zoom_reset->set_shortcut(ED_SHORTCUT("canvas_item_editor/zoom_reset", TTR("Zoom reset"), KEY_MASK_CMD | KEY_0)); zoom_reset->set_focus_mode(FOCUS_NONE); zoom_plus = memnew(ToolButton); zoom_hb->add_child(zoom_plus); zoom_plus->connect("pressed", this, "_button_zoom_plus"); + zoom_plus->set_shortcut(ED_SHORTCUT("canvas_item_editor/zoom_plus", TTR("Zoom in"), KEY_MASK_CMD | KEY_PLUS)); zoom_plus->set_focus_mode(FOCUS_NONE); updating_scroll = false; |