1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-30 16:26:50 +00:00

Add option to swap Alt+scroll zooming behavior in 2D editor

Update doc/classes/EditorSettings.xml

Co-authored-by: Hugo Locurcio <hugo.locurcio@hugo.pro>
This commit is contained in:
Alula
2023-06-20 03:22:54 +02:00
parent eb86dabee0
commit 9676905aee
3 changed files with 11 additions and 1 deletions

View File

@@ -1289,7 +1289,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);
}