ismyrnow / leaflet-groupedlayercontrol

Leaflet layer control with support for grouping overlays together.
MIT License
274 stars 141 forks source link

Deslectable exclusive layers #60

Open lkamb opened 6 years ago

lkamb commented 6 years ago

It would be useful (for me, anyway) to have groups of mutually exclusive layers that could also be deselected such that none of the layers is showing. In the current implementation of exclusive layers using radio buttons, there is no way to turn off all of the layers once one has been selected. I would like to have mutually exclusive layers controlled by checkboxes that behaved as radio buttons such that when one is already selected and another is selected the first becomes unselected and turns off (as with radio buttons) but also allowing the user to deselect and turn off the currently selected layer and have none of the layers visible.

lkamb commented 6 years ago

I have tried to implement a work-around by adding onAdd handlers which remove all the other layers of the group when a new one is selected, but the leaflet layer control goes and re-adds all the layers that had been previously selected, and I haven't figured out a hook to get in before the leaflet control gathers its list of previously selected layers.

pwangsom commented 6 years ago

Hi Ikamb, I also interested in this feature. Can you implement it? If you were done, cloud you share the implementation.

Thank you.

hhsm95 commented 4 years ago

Same issue here, I'm also working in a solution

pfruidur commented 5 months ago

I'm also interested in this issue. Anyone managed to implement it?