Adds shortcuts for zooming in the 2D editor
This commit is contained in:
parent
6faa96fb89
commit
8dcd39c3c4
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue