-
Notifications
You must be signed in to change notification settings - Fork 42
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
Bringing the flows to Front #9
Comments
Hey @Zahma sorry I didn't get to this before you closed it. Did you figure it out? You can certainly change the z-index for the 2 .leaflet-map-pane canvas {
z-index: 100;
} The layer will, however, respect your wishes if you tell it during construction to use a different Leaflet JS map pane. If you haven't used these before, look at these references: |
Thank you, I found the solution, I used the setPane method |
Hi, Do you have any ideas? |
@tapiamcclung I think I follow, but can you please create a live, public sample (codepen, jsbin, etc.) to help me debug and get some ideas for what to recommend next? |
Hi, I created a small example with some flows. I can't click the dots on the map. The lines are on top of the dots. By inspecting the elements, one can find something like: <div class="leaflet-pane leaflet-overlay-pane">
<canvas class="leaflet-zoom-animated" width="2152" height="662" style="transform: translate3d(-179px, 97px, 0px); width: 2152px; height: 662px;">
</div>
...
<div class="leaflet-pane leaflet-my-pane" style="z-index: 650;">
<canvas class="leaflet-zoom-animated" width="1793" height="552" style="transform-origin: 50% 50%; transform: translate3d(0px, 152px, 0px);">
<canvas class="leaflet-zoom-animated" width="1793" height="552" style="transform-origin: 50% 50%; transform: translate3d(0px, 152px, 0px);">
</div> The top canvas is for the dots and uses the default Thanks! |
Thank you for the codepen and for providing your additional notes. It goes a long way in helping me debug this. I believe the origin of this behaviour is the layer's default The immediate solution is to create your own instance of map.createPane('myPane');
map.getPane('myPane').style.zIndex = 650;
// this will help set the points in the desired pane
var canvasPointRenderer = L.canvas({ pane: 'myPane' });
var flowMapLayer = L.canvasFlowmapLayer(data, {
// ... layer options object ...
// this will set the Bezier lines and animations in the desired pane
pane: 'myPane',
// this will help set the points in the desired pane
style: function (geoJsonFeature) {
if (geoJsonFeature.properties.isOrigin) {
return {
renderer: canvasPointRenderer,
radius: 5,
weight: 1,
color: 'rgb(195, 255, 62)',
fillColor: 'rgba(195, 255, 62, 0.6)',
fillOpacity: 0.6
};
} else {
return {
renderer: canvasPointRenderer,
radius: 2.5,
weight: 0.25,
color: 'rgb(17, 142, 170)',
fillColor: 'rgb(17, 142, 170)',
fillOpacity: 0.7
};
}
}
// ... layer options object ...
});
// add your layer to the map Looking back at this, I should remove the internal |
Hi, thanks for the suggestion. In my development I had included jQuery so I was able to detach the container and append it to the pane where I want the flows to be. It works well, but you suggestion is more 'self-contained' and would certainly work better for several flow layers. |
Is there any way to bring the canvas flows to the front ? I have 2 sets of objects, geojsonLayers and the canvas lines. I tried to use bringToFront() but it seems its not implemented for Canvas elements.
I read in a forum that there is this solution:
here is the link of the example:
http://playground-leaflet.rhcloud.com/xopi/1/edit?js,output
The text was updated successfully, but these errors were encountered: