-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
mapox layers reordered after updating figure with Plotly.react #5266
Labels
bug
something broken
Comments
It is an update bug here: plotly.js/src/plots/mapbox/layers.js Lines 37 to 56 in 98dfdb8
It seems to work if I replace the function with something like: proto.update = function update(opts) {
if(!this.visible) {
// IMPORTANT: must create source before layer to not cause errors
this.updateSource(opts);
this.updateLayer(opts);
} else {
if(this.needsNewSource(opts)) {
// IMPORTANT: must delete layer before source to not cause errors
this.removeLayer();
this.updateSource(opts);
this.updateLayer(opts);
}
if(this.needsNewImage(opts)) {
this.updateImage(opts);
}
if(this.needsNewLayer(opts)) {
this.updateLayer(opts);
} else {
this.updateStyle(opts);
}
}
this.visible = isVisible(opts);
}; |
Thanks, I'm playing with it now. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Overview
I would like to overlay a mapbox
image
layer on top of a mapboxraster
layer and update theimage
layer'scoordinates
and/orsource
properties in response to zoom/pan events usingPlotly.react
On initial render, everything works fine and the z-order of the two layers matches the order in the
layout.mapbox.layers
array. However, after updating the image layer'scoordinates
in aplotly_relayout
callback, the image layer is pushed behind the raster layer.Here's an example, where the opacity of the raster layer is set to 0.5 so that you can see the image behind it.
Codepen: https://codepen.io/jonmmease/pen/vYKvxwx?editors=1010
Unless anyone has an idea of what might be going on here, I'll start poking around in https://github.com/plotly/plotly.js/blob/master/src/plots/mapbox/layers.js.
The text was updated successfully, but these errors were encountered: