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

Add sortLayers and sortFunction options to sort layers #43

Open
wants to merge 1 commit into
base: gh-pages
Choose a base branch
from

Conversation

grischard
Copy link

This is basically a backport of Leaflet/Leaflet#4711 that is included in Leaflet 1.0.2.

It keeps original order by default. If sortLayers is true, it sorts alphabetically if no compare function is specified. If sortFunction is defined, it uses the compare function to sort the layers .

@NHellFire
Copy link

Can you drop .layer from the sort function arguments or add groupA and groupB? So that group names can also be used.

@grischard
Copy link
Author

I see how that would be useful, yes. But then I also like to keep backwards compatibility with Leaflet itself. Maybe something can be done with a variable number of arguments.

Would you have a suggestion on how we should call the sortLayers option?

@ismyrnow is there any chance this could ever get merged?

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