diff --git a/example/marker-clustering-singlemarkermode.html b/example/marker-clustering-singlemarkermode.html new file mode 100644 index 000000000..60eef82e7 --- /dev/null +++ b/example/marker-clustering-singlemarkermode.html @@ -0,0 +1,61 @@ + + + + Leaflet debug page + + + + + + + + + + + + + + +
+ Click a cluster to zoom to its bounds + + + + diff --git a/src/MarkerCluster.js b/src/MarkerCluster.js index 2f089396b..c30d4bab3 100644 --- a/src/MarkerCluster.js +++ b/src/MarkerCluster.js @@ -52,6 +52,10 @@ L.MarkerCluster = L.Marker.extend({ this._childClusters.push(new1); this._childCount += new1._childCount; } else { + if (this._group.options.singleMarkerMode === true) { + new1.options.icon = this._group.options.iconCreateFunction(1); + } + this._markers.push(new1); this._childCount++; } diff --git a/src/MarkerClusterGroup.js b/src/MarkerClusterGroup.js index b2d292bb2..3ed33d3f6 100644 --- a/src/MarkerClusterGroup.js +++ b/src/MarkerClusterGroup.js @@ -12,6 +12,7 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({ spiderfyOnMaxZoom: true, showCoverageOnHover: true, zoomToBoundsOnClick: true, + singleMarkerMode: false, disableClusteringAtZoom: null },