fix(Globe): add transform logic for points during globe-mercator projection transition #13599
+59
−0
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.
Description
Resolves #12592
Important
This PR is written with a lot of help from Claude Opus 4.5
Although parts of the code are generated using a LLM, the solution does actually fix the problem.
Everything is checked by me and this PR message is written by only me.
Problem
During the transition between the globe projection and mercator projection, the location of markers shift from their location on the map.
Root Cause
The
locationPointfunction in theGlobeprojection class:mapbox-gl-js/src/geo/projection/globe.ts
Lines 55 to 72 in 5e6eb16
only calculates the location as if the map was still a globe and does not take into account the morphing of the displayed map.
Solution
Add logic for during the transition. The added logic is based on the
mercator_tile_positionshader function.Look at the pins around the UK and Belarus. The shifting is no longer present.
Before
mapbox-before.mp4
After
mapbox-after.mp4
Launch Checklist
@mapbox/map-design-team@mapbox/static-apisif this PR includes style spec API or visual changes.@mapbox/gl-nativeif this PR includes shader changes or needs a native port.@mapbox/gl-nativeif this PR disables any test because it also needs to be disabled on their side.gl-nativeto groom in the MAPSNAT JIRA queue if this PR includes shader changes or features not present in the native side or if it disables a test that's not disabled there.