Skip to content

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

Merged
merged 5 commits into from
Dec 16, 2019
Merged

Mapbox react updates #4418

merged 5 commits into from
Dec 16, 2019

Conversation

jonmmease
Copy link
Contributor

@jonmmease jonmmease commented Dec 8, 2019

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 each plotly_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:
pan_before

After:
pan_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 the raster-fade-duration: 0 paint option (which is suggested by the updateImage docstring). Together, these changes remove the image flashing that previously occurred between image updates.

Before:
zoom_before

After:
zoom_after

@etpinard
Copy link
Contributor

etpinard commented Dec 9, 2019

Note: These this branch is based on #4413, so I'll need to rebase on master after that one is merged.

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 git push -f on branches associated with open PRs.

@jonmmease
Copy link
Contributor Author

Thanks for taking a look @etpinard, I'll start looking at adding tests next.

@jonmmease jonmmease changed the title WIP: Mapbox react updates Mapbox react updates Dec 10, 2019
@jonmmease
Copy link
Contributor Author

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.

@etpinard
Copy link
Contributor

Awesome work @jonmmease !!

💃 💃 💃

@jonmmease
Copy link
Contributor Author

Thanks for taking the time @etpinard! merging

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