fix: change GlobeControl if Map.prototype.setProjection is called#7075
Open
CommanderStorm wants to merge 3 commits intomaplibre:mainfrom
Open
fix: change GlobeControl if Map.prototype.setProjection is called#7075CommanderStorm wants to merge 3 commits intomaplibre:mainfrom
GlobeControl if Map.prototype.setProjection is called#7075CommanderStorm wants to merge 3 commits intomaplibre:mainfrom
Conversation
GlobeControl if Map.prototype.setProjection is called
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7075 +/- ##
==========================================
- Coverage 92.53% 92.52% -0.01%
==========================================
Files 288 288
Lines 23928 23930 +2
Branches 5081 5081
==========================================
+ Hits 22141 22142 +1
- Misses 1787 1788 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
1ec5
approved these changes
Feb 7, 2026
HarelM
reviewed
Feb 8, 2026
| }); | ||
|
|
||
| test('updates control state when Map.setProjection() is called', async () => { | ||
| await new Promise(resolve => map.on('load', resolve)); |
Collaborator
There was a problem hiding this comment.
You can use await map.once('load').
HarelM
reviewed
Feb 8, 2026
|
|
||
| // Call setProjection to globe | ||
| map.setProjection({type: 'globe'}); | ||
| await new Promise(resolve => setTimeout(resolve, 0)); |
Collaborator
There was a problem hiding this comment.
There's a sleep utility as far as I remember.
HarelM
reviewed
Feb 8, 2026
| expect(button.classList.contains('maplibregl-ctrl-globe-enabled')).toBe(true); | ||
| expect(button.classList.contains('maplibregl-ctrl-globe')).toBe(false); | ||
|
|
||
| // Call setProjection back to mercator |
Collaborator
There was a problem hiding this comment.
This should be in a different test, it's best to test one thing.
Collaborator
|
Added a few minor comments on the tests, thanks for taking the time to open this PR! |
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.
Launch Checklist
CHANGELOG.mdunder the## mainsection.Resolves #7005
If I add a
GlobeControlto theMapand subsequently callMap.prototype.setProjection(), the control should automatically update its state to reflect the new projection.This now happens this way.
CC @1ec5