Giter VIP home page Giter VIP logo

Comments (4)

ismyrnow avatar ismyrnow commented on August 19, 2024

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.

ChrisCSmith avatar ChrisCSmith commented on August 19, 2024

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.

ismyrnow avatar ismyrnow commented on August 19, 2024

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.

demus avatar demus commented on August 19, 2024

Thanks for the function @ChrisCSmith

from leaflet-groupedlayercontrol.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.