Skip to content

Commit

Permalink
Fix formula of keep content fixed under the cursor (#290)
Browse files Browse the repository at this point in the history
  • Loading branch information
1e0nhardt authored Aug 27, 2024
1 parent 238af68 commit b2bf687
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lorien/InfiniteCanvas/PanZoomCamera.gd
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b2bf687

Please sign in to comment.