Skip to content
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

Fix issue #935 #954

Merged
merged 5 commits into from
Apr 10, 2024
Merged

Conversation

prushforth
Copy link
Member

@prushforth prushforth commented Apr 4, 2024

Update LayerControl._layers object which was being neglected and not being updated. Added a line to properly sort the layerControl based on the MapML Layer zIndex.
@AliyanH
Copy link
Member

AliyanH commented Apr 7, 2024

It appears we were neglecting an internal Leaflet object (LayerControl._layers) which manages the layerControl ordering. In 86e68b6 I ported over the function (_update) responsible and made a modification to sort the _layers object to match the ordering provided by MapMLLayer.

The _update function which was ported over can probably be trimmed as required, or there may also be a better way to accomplish this. For discussion.

@AliyanH
Copy link
Member

AliyanH commented Apr 8, 2024

@prushforth:

In theory the sorting should be handled by a function passed as an option, but perhaps that's not working for some reason. Looks like it all depends on layer.options.zIndex so not sure what's going on.

That sorting function we pass is being used but only in _addLayer method of Leaflet

Whenever we drag and drop layers in the Layer control (MapML updates the z-index) and the LayerControl._update method gets called which is in charge of updating the layer control, hence the need to add that sorting functionality to that _update method also.

_update function to use the options.sortFunction if present.  tbd:
if this should be offered via PR to upstream project.

Prettier formatting changes to pre-existing test file
@prushforth prushforth merged commit d2f7bec into Maps4HTML:main Apr 10, 2024
1 check passed
@prushforth prushforth deleted the map-extent-render-order branch October 3, 2024 18:39
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