-
-
Notifications
You must be signed in to change notification settings - Fork 790
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Avoid constraining with Mercator transform when Globe is used #5186
Conversation
Let's wait a bit with merging this as I want to finalize the transform and projection changes and merge them to main. I hope that's OK. |
The relevant PR was merged, I think you can go ahead and update this branch... |
cda4432
to
66e5e97
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #5186 +/- ##
=======================================
Coverage 91.83% 91.83%
=======================================
Files 281 281
Lines 38829 38833 +4
Branches 6772 6787 +15
=======================================
+ Hits 35657 35663 +6
+ Misses 3044 3043 -1
+ Partials 128 127 -1 ☔ View full report in Codecov by Sentry. |
Is there simpler way to achieve this? It seems a bit hacky with the resize and style.load events... |
3909e27
to
77f5090
Compare
This fixes a subtle bug I found while trying to create a test for another issue.
When a Map is created and before the style is loaded, a Mercator transform is created as a default. When a style that uses globe is loaded, a new transform is created. This is not a problem in general but it is when setting center and zoom values that are valid when using globe and not when using Mercator.
What this PR does is avoid constraining the center and zoom values when a style is defined until the style is loaded and we can be sure we are constraining them with the correct transform.
TLDR:
Before: Notice how both the hash and the camera position change after a reload when using invalid Mercator values
Screen.Recording.2024-12-11.at.10.36.43.mov
After: Notice how the hash and the camera are in the same position after a reload
Screen.Recording.2024-12-11.at.10.37.29.mov
Launch Checklist
CHANGELOG.md
under the## main
section.