Fix addLayers not working with singleMarkerMode.

(cherry picked from commit 02c75f164f1bb85f61329e0f3e89b0dc527301ee)

Conflicts:

	dist/leaflet.markercluster.js
This commit is contained in:
Duncan Parkes
2012-10-16 22:17:49 +01:00
committed by danzel
parent 9e2581f544
commit 1f09009349
2 changed files with 22 additions and 22 deletions

View File

@@ -57,17 +57,6 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
return this.addLayers(array);
}
if (this.options.singleMarkerMode) {
layer.options.icon = this.options.iconCreateFunction({
getChildCount: function () {
return 1;
},
getAllChildMarkers: function () {
return [layer];
}
});
}
if (!this._map) {
this._needsClustering.push(layer);
return this;
@@ -536,6 +525,17 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
gridUnclustered = this._gridUnclustered,
markerPoint, z;
if (this.options.singleMarkerMode) {
layer.options.icon = this.options.iconCreateFunction({
getChildCount: function () {
return 1;
},
getAllChildMarkers: function () {
return [layer];
}
});
}
//Find the lowest zoom level to slot this one in
for (; zoom >= 0; zoom--) {
markerPoint = this._map.project(layer.getLatLng(), zoom); // calculate pixel position

View File

@@ -50,17 +50,6 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
return this.addLayers(array);
}
if (this.options.singleMarkerMode) {
layer.options.icon = this.options.iconCreateFunction({
getChildCount: function () {
return 1;
},
getAllChildMarkers: function () {
return [layer];
}
});
}
if (!this._map) {
this._needsClustering.push(layer);
return this;
@@ -529,6 +518,17 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
gridUnclustered = this._gridUnclustered,
markerPoint, z;
if (this.options.singleMarkerMode) {
layer.options.icon = this.options.iconCreateFunction({
getChildCount: function () {
return 1;
},
getAllChildMarkers: function () {
return [layer];
}
});
}
//Find the lowest zoom level to slot this one in
for (; zoom >= 0; zoom--) {
markerPoint = this._map.project(layer.getLatLng(), zoom); // calculate pixel position