jupyter-widgets / ipyleaflet

A Jupyter - Leaflet.js bridge
https://ipyleaflet.readthedocs.io
MIT License
1.48k stars 363 forks source link

make it possible to hide a marker_cluster at once #1108

Open 12rambau opened 1 year ago

12rambau commented 1 year ago

When using the marker_cluster example, I cannot hide all the underlying markers at once as with other layers by setting a visible trait to False:

from ipyleaflet import Map, Marker, MarkerCluster

m = Map(center=(50, 0), zoom=5)

marker1 = Marker(location=(48, -2))
marker2 = Marker(location=(50, 0))
marker3 = Marker(location=(52, 2))

marker_cluster = MarkerCluster(
    markers=(marker1, marker2, marker3)
)

m.add_layer(marker_cluster);
marker_cluster..visible = False

m

In order to do it I can only hide each underlying marker individually.

Would it it be a desirable feature ?

martinRenou commented 1 year ago

Thanks, having support for visible on all layers would be nice indeed