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

Fire an event when map.loaded() changes from false to true #2185

Closed
timjcook opened this issue Feb 25, 2016 · 2 comments
Closed

Fire an event when map.loaded() changes from false to true #2185

timjcook opened this issue Feb 25, 2016 · 2 comments

Comments

@timjcook
Copy link

Context

  • mapbox-gl-js version: v0.14.2

Report

Expected behavior: I would like a map loaded or perhaps a map reloaded event that gets fired when all sources and styles changes have been resolved and rendered. The load event only gets fired when the map is first rendered, never again.

Actual behavior: Currently there is no way of being informed that a map has rendered all the changes that you make. If I run an action that toggles the visibility of 20 layers to show each of them, I'd like to know when the map is finished rendering all of them.

The use case is that I want to call featuresIn on a set of layers but cannot do so until they have been rendered. I am currently monitoring the render event that fires in js/ui/map.js and then checking map.loaded(), but I'd rather be told by a specific event.

Will look into creating a PR for this soon, posting this issue for feedback while I work on it.

@timjcook timjcook changed the title Fire an event when map.loaded() changes from false to true Fire an event when map.loaded() changes from false to true Feb 25, 2016
@bhousel
Copy link
Contributor

bhousel commented Feb 25, 2016

We've put some thought into this issue but haven't settled on a solution yet. We will either need a different event from load, maybe something enumerated like readystate.
Can you add your comments to the discussion on #1715?

@bhousel bhousel closed this as completed Feb 25, 2016
@timjcook
Copy link
Author

Ok, will do. Thanks for the response

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

No branches or pull requests

2 participants