Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions ipyleaflet/leaflet.py
Original file line number Diff line number Diff line change
Expand Up @@ -1191,16 +1191,26 @@ class MarkerCluster(Layer):
----------
markers: list, default []
List of markers to include in the cluster.
visible: bool, default True
the visibility of the layer on the map
"""

_view_name = Unicode('LeafletMarkerClusterView').tag(sync=True)
_model_name = Unicode('LeafletMarkerClusterModel').tag(sync=True)

markers = Tuple().tag(trait=Instance(Layer), sync=True, **widget_serialization)
visible = Bool(True).tag(sync=True)

# Options
disable_clustering_at_zoom = Int(18).tag(sync=True, o=True)
max_cluster_radius = Int(80).tag(sync=True, o=True)

@observe("visible")
def toggle_markers(self, visible):
"""Switch the markers visibility according to the master cluster."""
for marker in self.markers:
marker.visible = visible["new"]


class LayerGroup(Layer):
"""LayerGroup class.
Expand Down