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

Set view center and zoom later so we can capture load event #57

Merged
merged 1 commit into from
Dec 29, 2015

Conversation

SiggyF
Copy link
Contributor

@SiggyF SiggyF commented Dec 29, 2015

If you pass the center and zoom level to the constructor of the map it will fire the 'load' event before it is propagated. By not passing these options and manually setting the view after the event bubbling is in place we can capture the load and viewreset events from outside.

setView is called in constructor:
https://github.com/Leaflet/Leaflet/blob/master/src/map/Map.js#L43

_resetView fires load event:
https://github.com/Leaflet/Leaflet/blob/master/src/map/Map.js#L534

@SiggyF
Copy link
Contributor Author

SiggyF commented Dec 29, 2015

This covers the same use case as #43, but using the events from leaflet that were already propagated.

nhnb added a commit that referenced this pull request Dec 29, 2015
Set view center and zoom later so we can capture load event
@nhnb nhnb merged commit 9bc8306 into leaflet-extras:master Dec 29, 2015
@SiggyF SiggyF deleted the fedor-events branch December 29, 2015 23:01
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.

2 participants