summaryrefslogtreecommitdiff
path: root/editor/plugins
diff options
context:
space:
mode:
authorHugo Locurcio <hugo.locurcio@hugo.pro>2020-01-18 22:07:27 +0100
committerHugo Locurcio <hugo.locurcio@hugo.pro>2020-01-18 22:26:21 +0100
commitc9aca9ef813d47beae8a429da4480d685be5caf1 (patch)
treefa47a74c58fecaf685b7b336411e2edbc6225114 /editor/plugins
parentd4a222cd9d849a63f0535f70cbf78700bc5c815b (diff)
Clamp the editor scale to 1 when resetting zoom in the 2D editor
This closes #35294.
Diffstat (limited to 'editor/plugins')
-rw-r--r--editor/plugins/canvas_item_editor_plugin.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp
index 437a6722d0..e1fafde6b9 100644
--- a/editor/plugins/canvas_item_editor_plugin.cpp
+++ b/editor/plugins/canvas_item_editor_plugin.cpp
@@ -4236,7 +4236,7 @@ void CanvasItemEditor::_button_zoom_minus() {
}
void CanvasItemEditor::_button_zoom_reset() {
- _zoom_on_position(1.0 * EDSCALE, viewport_scrollable->get_size() / 2.0);
+ _zoom_on_position(1.0 * MAX(1, EDSCALE), viewport_scrollable->get_size() / 2.0);
}
void CanvasItemEditor::_button_zoom_plus() {
@@ -5038,7 +5038,7 @@ void CanvasItemEditor::set_state(const Dictionary &p_state) {
if (state.has("zoom")) {
// Compensate the editor scale, so that the editor scale can be changed
// and the zoom level will still be the same (relative to the editor scale).
- zoom = float(p_state["zoom"]) * EDSCALE;
+ zoom = float(p_state["zoom"]) * MAX(1, EDSCALE);
_update_zoom_label();
}