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 b0fa84a34..ffd782809 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 f685d8d82..1ae6542fe 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 },