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

data event from style mutations should be fired synchronously #5762

Open
jfirebaugh opened this issue Nov 29, 2017 · 1 comment
Open

data event from style mutations should be fired synchronously #5762

jfirebaugh opened this issue Nov 29, 2017 · 1 comment

Comments

@jfirebaugh
Copy link
Contributor

Currently, if you mutate the style via setPaintProperty or some other runtime styling API, the corresponding data event (with dataType property equal to style) is not fired until the subsequent repaint, which is asynchronous. I think this event should be fired immediately instead:

  • The change is observable with respect to getPaintProperty or comparable accessor immediately, and it seems like the event should fire as soon as the change becomes observable.
  • It's necessary for Refactor to simplify Map #2741: Map will use the data event as the consistent trigger for a new frame, rather than wrapping each Style method and calling _update(true) manually.
  • The current behavior is causing each style mutation to trigger two repaints: one from the manual _update(true), and a second one from the data event that's triggered during the first repaint.
@jfirebaugh
Copy link
Contributor Author

Another reason: if the data event is triggered from within style.update(), as it is now, calling map.remove() in response to that event causes a crash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant