Update build

This commit is contained in:
danzel
2013-04-24 10:48:09 +12:00
parent dcbaabe234
commit 530d9f5189
2 changed files with 55 additions and 57 deletions
+54 -56
View File
@@ -57,9 +57,7 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
if (layer instanceof L.LayerGroup) {
var array = [];
for (var i in layer._layers) {
if (layer._layers.hasOwnProperty(i)) {
array.push(layer._layers[i]);
}
array.push(layer._layers[i]);
}
return this.addLayers(array);
}
@@ -156,11 +154,9 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
//Update the icons of all those visible clusters that were affected
for (i in this._layers) {
if (this._layers.hasOwnProperty(i)) {
m = this._layers[i];
if (m instanceof L.MarkerCluster && m._iconNeedsUpdate) {
m._updateIcon();
}
m = this._layers[i];
if (m instanceof L.MarkerCluster && m._iconNeedsUpdate) {
m._updateIcon();
}
}
@@ -199,11 +195,9 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
this._topClusterLevel._recursivelyAddChildrenToMap(null, this._zoom, this._currentShownBounds);
for (i in this._layers) {
if (this._layers.hasOwnProperty(i)) {
m = this._layers[i];
if (m instanceof L.MarkerCluster) {
m._updateIcon();
}
m = this._layers[i];
if (m instanceof L.MarkerCluster) {
m._updateIcon();
}
}
@@ -221,15 +215,13 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
delete this._gridUnclustered;
}
if (this._unspiderfy) {
this._unspiderfy();
if (this._noanimationUnspiderfy) {
this._noanimationUnspiderfy();
}
//Remove all the visible layers
for (var i in this._layers) {
if (this._layers.hasOwnProperty(i)) {
L.FeatureGroup.prototype.removeLayer.call(this, this._layers[i]);
}
L.FeatureGroup.prototype.removeLayer.call(this, this._layers[i]);
}
this.eachLayer(function (marker) {
@@ -380,9 +372,7 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
//Clean up all the layers we added to the map
for (var i in this._layers) {
if (this._layers.hasOwnProperty(i)) {
L.FeatureGroup.prototype.removeLayer.call(this, this._layers[i]);
}
L.FeatureGroup.prototype.removeLayer.call(this, this._layers[i]);
}
this._map = null;
@@ -796,12 +786,10 @@ L.MarkerClusterGroup.include(!L.DomUtil.TRANSITION ? {
me._topClusterLevel._recursivelyBecomeVisible(bounds, newZoomLevel);
//TODO Maybe? Update markers in _recursivelyBecomeVisible
for (j in me._layers) {
if (me._layers.hasOwnProperty(j)) {
n = me._layers[j];
n = me._layers[j];
if (!(n instanceof L.MarkerCluster) && n._icon) {
n.setOpacity(1);
}
if (!(n instanceof L.MarkerCluster) && n._icon) {
n.setOpacity(1);
}
}
@@ -1309,20 +1297,16 @@ L.DistanceGrid.prototype = {
grid = this._grid;
for (i in grid) {
if (grid.hasOwnProperty(i)) {
row = grid[i];
row = grid[i];
for (j in row) {
if (row.hasOwnProperty(j)) {
cell = row[j];
for (j in row) {
cell = row[j];
for (k = 0, len = cell.length; k < len; k++) {
removed = fn.call(context, cell[k]);
if (removed) {
k--;
len--;
}
}
for (k = 0, len = cell.length; k < len; k++) {
removed = fn.call(context, cell[k]);
if (removed) {
k--;
len--;
}
}
}
@@ -1582,6 +1566,31 @@ L.MarkerCluster.include({
legLength += this._2PI * lengthFactor / angle;
}
return res;
},
_noanimationUnspiderfy: function () {
var group = this._group,
map = group._map,
childMarkers = this.getAllChildMarkers(),
m, i;
this.setOpacity(1);
for (i = childMarkers.length - 1; i >= 0; i--) {
m = childMarkers[i];
L.FeatureGroup.prototype.removeLayer.call(group, m);
if (m._preSpiderfyLatlng) {
m.setLatLng(m._preSpiderfyLatlng);
delete m._preSpiderfyLatlng;
}
m.setZIndexOffset(0);
if (m._spiderLeg) {
map.removeLayer(m._spiderLeg);
delete m._spiderLeg;
}
}
}
});
@@ -1612,24 +1621,7 @@ L.MarkerCluster.include(!L.DomUtil.TRANSITION ? {
},
_animationUnspiderfy: function () {
var group = this._group,
map = group._map,
childMarkers = this.getAllChildMarkers(),
m, i;
this.setOpacity(1);
for (i = childMarkers.length - 1; i >= 0; i--) {
m = childMarkers[i];
L.FeatureGroup.prototype.removeLayer.call(group, m);
m.setLatLng(m._preSpiderfyLatlng);
delete m._preSpiderfyLatlng;
m.setZIndexOffset(0);
map.removeLayer(m._spiderLeg);
delete m._spiderLeg;
}
this._noanimationUnspiderfy();
}
} : {
//Animated versions here
@@ -1877,6 +1869,12 @@ L.MarkerClusterGroup.include({
}
},
_noanimationUnspiderfy: function () {
if (this._spiderfied) {
this._spiderfied._noanimationUnspiderfy();
}
},
//If the given layer is currently being spiderfied then we unspiderfy it so it isn't on the map anymore etc
_unspiderfyLayer: function (layer) {
if (layer._spiderLeg) {
+1 -1
View File
File diff suppressed because one or more lines are too long