-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
Control.Layers dont preserve layers order #5201
Comments
The problem here is that the Read (if you haven't done so yet) the map panes tutorial for a workaround. This (paired with the functionality that map panes provide) can make a case for making |
OK, |
I'm having difficulties with the Layers control myself. I have a set of standard FeatureLayers assigned to the 'overlayPane' and a highlight layer assigned to a custom 'HighlightPane' pane. From reading the documentation, I understand the z-level of the 'overlayPane' is set to 400, so I set the 'HighlightPane' z-index to 450. This works fine, but when users click on and off layers in the layer control, the last layer 'turned on' always ends on top and the z-level of my highlight layer is not respected (i.e. if my highlight layer is 'on' and I turn off and on one of my feature layers, when that feature layer is turned back on it renders on top of my highlight layer, despite the z-levels). |
Hi @UsgsMonkey, What you describe sounds different from the exact original issue described here. For questions on using Leaflet, please use gis.stackexchange.com or stackoverflow. If you are really sure that this is a bug in leaflet, please open a new issue and provide code to reproduce your problem (comply with the issue template). |
Hi, for others just looking for ways to have one layer coming below another, I found a workaround by removing then re-rendering all my layers in the order in which I wanted them to show. Way to retrieve the data present in a layer: Way to remove a layer: Way to add a layer: |
Default behavior apart as described by @mgiraldo, documentation for sortLayers is also confusing as says:
But this does not seems to follow the added order control while activation order. |
What behaviour I'm expecting and which behaviour I'm seeing
Documentation say about Control.Layers's autoZIndex option : If true, the control will assign zIndexes in increasing order to all of its layers so that the order is preserved when switching them on/off.
It's not working as expected : the order is NOT preserved when switching them on/off.
Minimal example reproducing the issue
https://jsfiddle.net/mrit64/z1v8v6nv/
The text was updated successfully, but these errors were encountered: