From b2bf6879879688436ad941c7d290043df77cacfe Mon Sep 17 00:00:00 2001 From: 1e0nhardt <132132397+1e0nhardt@users.noreply.github.com> Date: Tue, 27 Aug 2024 21:52:00 +0800 Subject: [PATCH] Fix formula of keep content fixed under the cursor (#290) --- lorien/InfiniteCanvas/PanZoomCamera.gd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lorien/InfiniteCanvas/PanZoomCamera.gd b/lorien/InfiniteCanvas/PanZoomCamera.gd index 48810968..63c69216 100644 --- a/lorien/InfiniteCanvas/PanZoomCamera.gd +++ b/lorien/InfiniteCanvas/PanZoomCamera.gd @@ -87,7 +87,7 @@ func _zoom_canvas(target_zoom: float, anchor: Vector2) -> void: # Pan canvas to keep content fixed under the cursor var zoom_center = anchor - offset - var ratio = 1.0 - target_zoom / _current_zoom_level + var ratio = _current_zoom_level / target_zoom - 1.0 offset -= zoom_center * ratio _current_zoom_level = target_zoom