Closed
Description
Description
When adding a currently hidden overlay layer group, the group is not added to the layer control.
Live Demo
none
Steps to Reproduce
Add a layer group with current visibility set to false. i.e.:
<l-layer-group name="Targets" layer-type="overlay" :visible="false"></l-layer-group>
Expected Results
I expect the layer to be loaded in the Layer Control to be toggled on when desired.
Actual Results
Instead, the layer is never added to the map nor Layer Control, and thus, can never be "turned on"
Browsers Affected
- Chrome
- Firefox
- Edge
- IE 11
- Safari 9
- Safari 8
Versions
- Leaflet: v1.5.21
- Vue: v2.X.X
- Vue2Leaflet: v2.5.2
Fix
I believe this is caused by a different implementation for adding the layer in the LLayerGroup
component vs other components. In LLayerGroup
it is added like this:
if (this.visible) {
this.parentContainer.addLayer(this);
}
But other controls add the layer like this:
this.parentContainer.addLayer(this, !this.visible);
I don't really have a good way to test this right now... if one of the maintainers can implement the change, test, and make the PR, that would be great!
Metadata
Metadata
Assignees
Labels
No labels