Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fix changing zoom and center at once #2360

Closed
wants to merge 1 commit into from
Closed

Conversation

tomhicks
Copy link

@tomhicks tomhicks commented Mar 21, 2024

What this does

Previously, if you wanted to zoom in and pan the map in the same viewport operation when you were very zoomed out, it would get "stuck" at latitudes near the equator.

If you're zoomed right out such that the equator is at the center of your viewport, and want to zoom in to a point at a much higher zoom level away from the equator, because the center change is handled first, the center change is constrained, so the latitude doesn't change. Then the zoom happens, and you end up at the wrong place.

By changing the order to zoom first, we ensure that the constraining that happens during the center change happens with the correct available center range.

Testing

The unit tests still pass, but it's hard to exercise the exact scenario here because it's dependent on the viewport constraining behaviour which is mocked out in this repo.

Previously, if you wanted to zoom in and pan the map in the same viewport operation, it would get "stuck" at certain latitudes.

If you're zoomed right out such that the equator is at the center of your viewport, and want to zoom in to a point at a much higher zoom level away from the equator, because the center change is handled first, the center change is constrained, so the latitude doesn't change. Then the zoom happens, and you end up at the wrong place.

By changing the order to zoom first, we ensure that the constraining that happens during the center change happens with the correct available center range.
@Pessimistress
Copy link
Collaborator

Fixed by #2391

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants