Skip to content
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

fix: map is not always centered on markers on load #34

Merged
merged 2 commits into from
Dec 5, 2021
Merged

Conversation

sagzy
Copy link
Collaborator

@sagzy sagzy commented Dec 2, 2021

I think the problem is: the .fitBounds method is sometimes executed before the map has loaded (coucou JS event loop). Mapbox offers to set bounds directly during the map instanciation, which should solve the issue if my assumption is right.

Can you give it a run?

Closes #33

@sagzy sagzy requested a review from shafy December 2, 2021 08:54
@shafy
Copy link
Collaborator

shafy commented Dec 4, 2021

It looks good, and I guess it makes sense to set the bounds directly when initiliazing a new map. Let's merge this and see if the problem occurs again!

@sagzy sagzy merged commit 0ef384a into main Dec 5, 2021
@sagzy sagzy deleted the issues/33 branch December 5, 2021 10:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Map is not always centered on the markers on load
2 participants