1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-05 12:10:55 +00:00

Merge pull request #78451 from alula/integer-zoom

Add option to swap default Alt+scroll zooming behavior in 2D editor
This commit is contained in:
Yuri Sizov
2023-07-14 21:27:54 +02:00
3 changed files with 11 additions and 1 deletions

View File

@@ -1290,7 +1290,13 @@ void CanvasItemEditor::_zoom_callback(float p_zoom_factor, Vector2 p_origin, Ref
if (mb.is_valid()) {
// Special behvior for scroll events, as the zoom_by_increment method can smartly end up on powers of two.
int increment = p_zoom_factor > 1.0 ? 1 : -1;
zoom_widget->set_zoom_by_increments(increment, mb->is_alt_pressed());
bool by_integer = mb->is_alt_pressed();
if (EDITOR_GET("editors/2d/use_integer_zoom_by_default")) {
by_integer = !by_integer;
}
zoom_widget->set_zoom_by_increments(increment, by_integer);
} else {
zoom_widget->set_zoom(zoom_widget->get_zoom() * p_zoom_factor);
}