-
Notifications
You must be signed in to change notification settings - Fork 91
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
Just accept src/leaflet-panel-layers.js to implement the improvement of exclusive selectable layer per group #54
Conversation
Using exclusiveGroup property in the layers definitions will make the layer exclusively selectable in that group (like baseMaps). Small example: var overLayers = [ { name: "Stations", exclusiveGroup: "onlyOne", icon: iconByName('weather_station'), layer: stationsLayer }, { name: "Radar", exclusiveGroup: "onlyOne", icon: iconByName('radar'), layer: stationsLayer }]; Will makes the buttons "Radar" and "Stations" as selection roundbox, making only one to be selectable
I don't think I understand the new exclusiveGroup option would you have an online demo where this works? |
The exclusiveGroup makes that only one item of the layers under that exclusiveGroup name can be selected. In other words: With you javascript code, you can only select one baseLayer (selection box is roundboxes), but this behaviour isn't not possible in overlayLayers (overLayers). If exclusiveGroup is defined, overlayers will have the same behaviour that baseLayers, but has overlay map, avoiding be overlayed by other layer in the same exclusiveGroup |
From @manuelespinosa's description it looks like this PR will solve #53 and #39. Can we maybe get this merged in? |
@jpmeijers @manuelespinosa merged and solved issue #53 #39 |
I have edited the file:
src/leaflet-panel-layers.js
Using exclusiveGroup property in the layers definitions will make the layer exclusively selectable in that group (like baseMaps).
Small example:
var overLayers = [
{
name: "Stations",
exclusiveGroup: "onlyOne",
icon: iconByName('weather_station'),
layer: stationsLayer
},
{
name: "Radar",
exclusiveGroup: "onlyOne",
icon: iconByName('radar'),
layer: stationsLayer
}];
Will makes the buttons "Radar" and "Stations" as selection roundbox, making only one to be selectable