Comments (4)
Thanks for the opening an issue.
This behavior is consistent with how Leaflet's layer control works. I am intentionally doing it the same way to keep things as simple as possible.
from leaflet-groupedlayercontrol.
looking at the layer control help it states addlayer will add a layer to the layer control and removeLayer will remove the layer from the layer control. No mention of adding/removing from the map - so working as expected.
I suppose my issue is that the layer control has code that adds and removes layers from the map in method _onInputClick, So if the user selects layer 'a' in the layerControl this adds the layer to the map control, if layerControl.removeLayer(a) method is called, the option is removed from the layer control but the layer is not removed from the map. So I assume working as designed but appears that it leaves the map in a slightly inconsistent state?
anyway thanks for looking into this.
from leaflet-groupedlayercontrol.
Yes, you could consider that state inconsistent. However, there could be a case where the developer desires that, so the layer control doesn't make any assumptions.
Besides being careful to remove the layer from the map when you also remove it from the control, you could achieve the same using events. The layer control fires an event called "overlayremove", which you could listen to, and remove the layer also from the map when it's fired.
from leaflet-groupedlayercontrol.
Thanks for the function @ChrisCSmith
from leaflet-groupedlayercontrol.
Related Issues (20)
- make the repo name and package name consistent HOT 5
- unecessary checkbox HOT 1
- Error when removing all layers from a group HOT 1
- removeLayer method throws an error HOT 6
- Double click on the legend propagates to the map in Chrome HOT 5
- Nested groups, ungrouped layers HOT 1
- Uncaught Type Error HOT 2
- Unable to control the order in which grouped layers appear in the control HOT 5
- Merge with sidebar v2 HOT 2
- Grouped Layer Control with R HOT 2
- Deslectable exclusive layers HOT 4
- Unable to scroll layer list with scroll wheel HOT 3
- Cannot add a single layer
- @types Definitions for leaflet-groupedlayercontrol Feature Request HOT 3
- change position
- MAINTAINER NEEDED
- How do I extend the control? HOT 1
- How to call Tabletop data in L.control.groupedLayers ? HOT 1
- How to implement with python HOT 4
- How to add this to an existing leaflet map.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from leaflet-groupedlayercontrol.