Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clamp the editor scale to 1 when resetting zoom in the 2D editor #35297

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions editor/plugins/canvas_item_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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();
}

Expand Down