-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Mapbox react updates #4418
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
Mapbox react updates #4418
Conversation
That's ok. But next time, please base your PR off your base branch. Here at plotly.js, we're not fans of rebasing and |
Thanks for taking a look @etpinard, I'll start looking at adding tests next. |
I added a few tests that cover the new functionality Also, it looks like there are some unrelated failures in the image test suite for some webgl chart types. |
Awesome work @jonmmease !! 💃 💃 💃 |
Thanks for taking the time @etpinard! merging |
Overview
This PR makes two changes to make updates to mapbox-based plots using
react
smoother. The use-case I'm working on is a Dash app that uses Datashader to update an image layer in response to eachplotly_relayout
event.Note: These this branch was initially based on #4413
Change 1: Don't update map position while panning/zooming.
36a2650 prevents plotly.js from updating the mapbox view while a pan/zoom is in process. This fixes the stuttering that occurs when quickly repeating zoom or pan actions.
Before:

After:

Change 2: Use
updateImage
to update image, rather than delete and recreate layer.When possible, 7e355d7 uses the mapbox
updateImage
function to update an existing image in place rather than removing and recreating the source and layer. It also adds theraster-fade-duration: 0
paint option (which is suggested by theupdateImage
docstring). Together, these changes remove the image flashing that previously occurred between image updates.Before:

After:
