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

Just accept src/leaflet-panel-layers.js to implement the improvement of exclusive selectable layer per group #54

Merged
merged 9 commits into from
Nov 16, 2022

Conversation

manuelespinosa
Copy link
Contributor

@manuelespinosa manuelespinosa commented Dec 23, 2019

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

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
@manuelespinosa manuelespinosa changed the title Just accept src/leaflet-panel-layers.js to implement the improvement of exclusive selectable la Just accept src/leaflet-panel-layers.js to implement the improvement of exclusive selectable layer per group Dec 23, 2019
@stefanocudini
Copy link
Owner

I don't think I understand the new exclusiveGroup option would you have an online demo where this works?

@manuelespinosa
Copy link
Contributor Author

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

@jpmeijers
Copy link

From @manuelespinosa's description it looks like this PR will solve #53 and #39. Can we maybe get this merged in?

@stefanocudini stefanocudini merged commit 32fd592 into stefanocudini:master Nov 16, 2022
@stefanocudini
Copy link
Owner

@jpmeijers @manuelespinosa merged and solved issue #53 #39
demo online here: https://opengeo.tech/maps/leaflet-panel-layers/examples/group-layers-exclusive.html

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.

None yet

3 participants