Repository navigation
Conversation
`_getZoomForScale` used `zoom + log2(scale)`, which only holds when each level doubles the scale. It now uses `crs.zoom(crs.scale(zoom) * scale)`, the formula of `MapCamera.getScaleZoom`, identical in EPSG:3857, so pinching x2 doubles the map scale in any CRS. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #2269 (step 2 of the split).
_getZoomForScaleconverts the pinch scale withzoom + log2(scale), which only holds when each level doubles the scale. On aProj4Crswith other resolutions (Swiss LV95: 2.5 → 2 → 1.5 → 1 m/px) spreading the fingers ×2 scales the map by ×1.25 at some levels and ×2.5 at others.Now
crs.zoom(crs.scale(startZoom) * scale)— the formula ofMapCamera.getScaleZoom, applied to the gesture's start zoom. Identical in EPSG:3857 (crs.scaleis256 · 2^z), so no behaviour change there. Covers pinch, the gesture-race threshold and double-tap zoom, which all go through this function. Scroll wheel and double-tap-drag are zoom deltas by API, unchanged.Test:
test/gestures/pinch_zoom_crs_test.dart— fingers ×2 on the LV95 resolutions: master scales the map by 1.25, fixed by 2; EPSG:3857 adds one level before and after. Full suite passes (142).🤖 Generated with Claude Code