leaflet-markercluster-rails 0.6.0 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  Engine wrapper for the Leaflet MarkerCluster library by @danzel.
4
4
 
5
+ *Requires Leaflet 0.7.0 or newer.*
6
+
5
7
  https://github.com/Leaflet/Leaflet.markercluster
6
8
 
7
9
  ## Installation
@@ -25,7 +27,6 @@ Provides the following assets:
25
27
  leaflet.markercluster.js
26
28
  leaflet.markercluster.css
27
29
  leaflet.markercluster.default.css
28
- leaflet.markercluster.ie.css
29
30
 
30
31
  ## License
31
32
  MIT License, full text of license see [here][License]
@@ -1,7 +1,7 @@
1
1
  module Leaflet
2
2
  module Markercluster
3
3
  module Rails
4
- VERSION = "0.6.0"
4
+ VERSION = "0.7.0"
5
5
  end
6
6
  end
7
7
  end
@@ -3,8 +3,7 @@
3
3
  https://github.com/Leaflet/Leaflet.markercluster
4
4
  (c) 2012-2013, Dave Leaver, smartrak
5
5
  */
6
- (function (window, document, undefined) {
7
- /*
6
+ (function (window, document, undefined) {/*
8
7
  * L.MarkerClusterGroup extends L.FeatureGroup by clustering the markers contained within
9
8
  */
10
9
 
@@ -32,6 +31,12 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
32
31
  //Increase to increase the distance away that spiderfied markers appear from the center
33
32
  spiderfyDistanceMultiplier: 1,
34
33
 
34
+ // When bulk adding layers, adds markers in chunks. Means addLayers may not add all the layers in the call, others will be loaded during setTimeouts
35
+ chunkedLoading: false,
36
+ chunkInterval: 200, // process markers for a maximum of ~ n milliseconds (then trigger the chunkProgress callback)
37
+ chunkDelay: 50, // at the end of each interval, give n milliseconds back to system/browser
38
+ chunkProgress: null, // progress callback: function(processed, total, elapsed) (e.g. for a progress indicator)
39
+
35
40
  //Options to pass to the L.Polygon constructor
36
41
  polygonOptions: {}
37
42
  },
@@ -53,6 +58,8 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
53
58
  this._needsRemoving = []; //Markers removed while we aren't on the map need to be kept track of
54
59
  //The bounds of the currently shown area (from _getExpandedVisibleBounds) Updated on zoom/move
55
60
  this._currentShownBounds = null;
61
+
62
+ this._queue = [];
56
63
  },
57
64
 
58
65
  addLayer: function (layer) {
@@ -110,6 +117,15 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
110
117
 
111
118
  removeLayer: function (layer) {
112
119
 
120
+ if (layer instanceof L.LayerGroup)
121
+ {
122
+ var array = [];
123
+ for (var i in layer._layers) {
124
+ array.push(layer._layers[i]);
125
+ }
126
+ return this.removeLayers(array);
127
+ }
128
+
113
129
  //Non point layers
114
130
  if (!layer.getLatLng) {
115
131
  this._nonPointGroup.removeLayer(layer);
@@ -147,52 +163,90 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
147
163
 
148
164
  //Takes an array of markers and adds them in bulk
149
165
  addLayers: function (layersArray) {
150
- var i, l, m,
151
- onMap = this._map,
152
- fg = this._featureGroup,
153
- npg = this._nonPointGroup;
166
+ var fg = this._featureGroup,
167
+ npg = this._nonPointGroup,
168
+ chunked = this.options.chunkedLoading,
169
+ chunkInterval = this.options.chunkInterval,
170
+ chunkProgress = this.options.chunkProgress,
171
+ newMarkers, i, l, m;
154
172
 
155
- for (i = 0, l = layersArray.length; i < l; i++) {
156
- m = layersArray[i];
173
+ if (this._map) {
174
+ var offset = 0,
175
+ started = (new Date()).getTime();
176
+ var process = L.bind(function () {
177
+ var start = (new Date()).getTime();
178
+ for (; offset < layersArray.length; offset++) {
179
+ if (chunked && offset % 200 === 0) {
180
+ // every couple hundred markers, instrument the time elapsed since processing started:
181
+ var elapsed = (new Date()).getTime() - start;
182
+ if (elapsed > chunkInterval) {
183
+ break; // been working too hard, time to take a break :-)
184
+ }
185
+ }
157
186
 
158
- //Not point data, can't be clustered
159
- if (!m.getLatLng) {
160
- npg.addLayer(m);
161
- continue;
162
- }
187
+ m = layersArray[offset];
163
188
 
164
- if (this.hasLayer(m)) {
165
- continue;
166
- }
189
+ //Not point data, can't be clustered
190
+ if (!m.getLatLng) {
191
+ npg.addLayer(m);
192
+ continue;
193
+ }
167
194
 
168
- if (!onMap) {
169
- this._needsClustering.push(m);
170
- continue;
171
- }
195
+ if (this.hasLayer(m)) {
196
+ continue;
197
+ }
172
198
 
173
- this._addLayer(m, this._maxZoom);
199
+ this._addLayer(m, this._maxZoom);
174
200
 
175
- //If we just made a cluster of size 2 then we need to remove the other marker from the map (if it is) or we never will
176
- if (m.__parent) {
177
- if (m.__parent.getChildCount() === 2) {
178
- var markers = m.__parent.getAllChildMarkers(),
179
- otherMarker = markers[0] === m ? markers[1] : markers[0];
180
- fg.removeLayer(otherMarker);
201
+ //If we just made a cluster of size 2 then we need to remove the other marker from the map (if it is) or we never will
202
+ if (m.__parent) {
203
+ if (m.__parent.getChildCount() === 2) {
204
+ var markers = m.__parent.getAllChildMarkers(),
205
+ otherMarker = markers[0] === m ? markers[1] : markers[0];
206
+ fg.removeLayer(otherMarker);
207
+ }
208
+ }
181
209
  }
182
- }
183
- }
184
210
 
185
- if (onMap) {
186
- //Update the icons of all those visible clusters that were affected
187
- fg.eachLayer(function (c) {
188
- if (c instanceof L.MarkerCluster && c._iconNeedsUpdate) {
189
- c._updateIcon();
211
+ if (chunkProgress) {
212
+ // report progress and time elapsed:
213
+ chunkProgress(offset, layersArray.length, (new Date()).getTime() - started);
190
214
  }
191
- });
192
215
 
193
- this._topClusterLevel._recursivelyAddChildrenToMap(null, this._zoom, this._currentShownBounds);
194
- }
216
+ if (offset === layersArray.length) {
217
+ //Update the icons of all those visible clusters that were affected
218
+ this._featureGroup.eachLayer(function (c) {
219
+ if (c instanceof L.MarkerCluster && c._iconNeedsUpdate) {
220
+ c._updateIcon();
221
+ }
222
+ });
223
+
224
+ this._topClusterLevel._recursivelyAddChildrenToMap(null, this._zoom, this._currentShownBounds);
225
+ } else {
226
+ setTimeout(process, this.options.chunkDelay);
227
+ }
228
+ }, this);
229
+
230
+ process();
231
+ } else {
232
+ newMarkers = [];
233
+ for (i = 0, l = layersArray.length; i < l; i++) {
234
+ m = layersArray[i];
235
+
236
+ //Not point data, can't be clustered
237
+ if (!m.getLatLng) {
238
+ npg.addLayer(m);
239
+ continue;
240
+ }
241
+
242
+ if (this.hasLayer(m)) {
243
+ continue;
244
+ }
195
245
 
246
+ newMarkers.push(m);
247
+ }
248
+ this._needsClustering = this._needsClustering.concat(newMarkers);
249
+ }
196
250
  return this;
197
251
  },
198
252
 
@@ -283,11 +337,7 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
283
337
  }
284
338
  }
285
339
 
286
- //TODO: Can remove this isValid test when leaflet 0.6 is released
287
- var nonPointBounds = this._nonPointGroup.getBounds();
288
- if (nonPointBounds.isValid()) {
289
- bounds.extend(nonPointBounds);
290
- }
340
+ bounds.extend(this._nonPointGroup.getBounds());
291
341
 
292
342
  return bounds;
293
343
  },
@@ -295,7 +345,7 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
295
345
  //Overrides LayerGroup.eachLayer
296
346
  eachLayer: function (method, context) {
297
347
  var markers = this._needsClustering.slice(),
298
- i;
348
+ i;
299
349
 
300
350
  if (this._topClusterLevel) {
301
351
  this._topClusterLevel.getAllChildMarkers(markers);
@@ -308,6 +358,28 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
308
358
  this._nonPointGroup.eachLayer(method, context);
309
359
  },
310
360
 
361
+ //Overrides LayerGroup.getLayers
362
+ getLayers: function () {
363
+ var layers = [];
364
+ this.eachLayer(function (l) {
365
+ layers.push(l);
366
+ });
367
+ return layers;
368
+ },
369
+
370
+ //Overrides LayerGroup.getLayer, WARNING: Really bad performance
371
+ getLayer: function (id) {
372
+ var result = null;
373
+
374
+ this.eachLayer(function (l) {
375
+ if (L.stamp(l) === id) {
376
+ result = l;
377
+ }
378
+ });
379
+
380
+ return result;
381
+ },
382
+
311
383
  //Returns true if the given layer is in this MarkerClusterGroup
312
384
  hasLayer: function (layer) {
313
385
  if (!layer) {
@@ -354,14 +426,12 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
354
426
  }
355
427
  };
356
428
 
357
- if (layer._icon) {
429
+ if (layer._icon && this._map.getBounds().contains(layer.getLatLng())) {
358
430
  callback();
359
431
  } else if (layer.__parent._zoom < this._map.getZoom()) {
360
432
  //Layer should be visible now but isn't on screen, just pan over to it
361
433
  this._map.on('moveend', showMarker, this);
362
- if (!layer._icon) {
363
- this._map.panTo(layer.getLatLng());
364
- }
434
+ this._map.panTo(layer.getLatLng());
365
435
  } else {
366
436
  this._map.on('moveend', showMarker, this);
367
437
  this.on('animationend', showMarker, this);
@@ -392,23 +462,9 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
392
462
  }
393
463
  this._needsRemoving = [];
394
464
 
395
- for (i = 0, l = this._needsClustering.length; i < l; i++) {
396
- layer = this._needsClustering[i];
397
-
398
- //If the layer doesn't have a getLatLng then we can't cluster it, so add it to our child featureGroup
399
- if (!layer.getLatLng) {
400
- this._featureGroup.addLayer(layer);
401
- continue;
402
- }
403
-
404
-
405
- if (layer.__parent) {
406
- continue;
407
- }
408
- this._addLayer(layer, this._maxZoom);
409
- }
410
- this._needsClustering = [];
411
-
465
+ //Remember the current zoom level and bounds
466
+ this._zoom = this._map.getZoom();
467
+ this._currentShownBounds = this._getExpandedVisibleBounds();
412
468
 
413
469
  this._map.on('zoomend', this._zoomEnd, this);
414
470
  this._map.on('moveend', this._moveEnd, this);
@@ -419,15 +475,10 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
419
475
 
420
476
  this._bindEvents();
421
477
 
422
-
423
478
  //Actually add our markers to the map:
424
-
425
- //Remember the current zoom level and bounds
426
- this._zoom = this._map.getZoom();
427
- this._currentShownBounds = this._getExpandedVisibleBounds();
428
-
429
- //Make things appear on the map
430
- this._topClusterLevel._recursivelyAddChildrenToMap(null, this._zoom, this._currentShownBounds);
479
+ l = this._needsClustering;
480
+ this._needsClustering = [];
481
+ this.addLayers(l);
431
482
  },
432
483
 
433
484
  //Overrides FeatureGroup.onRemove
@@ -444,7 +495,10 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
444
495
  this._spiderfierOnRemove();
445
496
  }
446
497
 
498
+
499
+
447
500
  //Clean up all the layers we added to the map
501
+ this._hideCoverage();
448
502
  this._featureGroup.onRemove(map);
449
503
  this._nonPointGroup.onRemove(map);
450
504
 
@@ -455,10 +509,10 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
455
509
 
456
510
  getVisibleParent: function (marker) {
457
511
  var vMarker = marker;
458
- while (vMarker !== null && !vMarker._icon) {
512
+ while (vMarker && !vMarker._icon) {
459
513
  vMarker = vMarker.__parent;
460
514
  }
461
- return vMarker;
515
+ return vMarker || null;
462
516
  },
463
517
 
464
518
  //Remove the given object from the given array
@@ -535,8 +589,22 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
535
589
  delete marker.__parent;
536
590
  },
537
591
 
592
+ _isOrIsParent: function (el, oel) {
593
+ while (oel) {
594
+ if (el === oel) {
595
+ return true;
596
+ }
597
+ oel = oel.parentNode;
598
+ }
599
+ return false;
600
+ },
601
+
538
602
  _propagateEvent: function (e) {
539
603
  if (e.layer instanceof L.MarkerCluster) {
604
+ //Prevent multiple clustermouseover/off events if the icon is made up of stacked divs (Doesn't work in ie <= 8, no relatedTarget)
605
+ if (e.originalEvent && this._isOrIsParent(e.layer._icon, e.originalEvent.relatedTarget)) {
606
+ return;
607
+ }
540
608
  e.type = 'cluster' + e.type;
541
609
  }
542
610
 
@@ -575,7 +643,6 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
575
643
  this.on('clustermouseover', this._showCoverage, this);
576
644
  this.on('clustermouseout', this._hideCoverage, this);
577
645
  map.on('zoomend', this._hideCoverage, this);
578
- map.on('layerremove', this._hideCoverageOnRemove, this);
579
646
  }
580
647
  },
581
648
 
@@ -588,6 +655,11 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
588
655
  } else if (this.options.zoomToBoundsOnClick) {
589
656
  e.layer.zoomToBounds();
590
657
  }
658
+
659
+ // Focus the map again for keyboard users.
660
+ if (e.originalEvent && e.originalEvent.keyCode === 13) {
661
+ map._container.focus();
662
+ }
591
663
  },
592
664
 
593
665
  _showCoverage: function (e) {
@@ -611,12 +683,6 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
611
683
  }
612
684
  },
613
685
 
614
- _hideCoverageOnRemove: function (e) {
615
- if (e.layer === this) {
616
- this._hideCoverage();
617
- }
618
- },
619
-
620
686
  _unbindEvents: function () {
621
687
  var spiderfyOnMaxZoom = this.options.spiderfyOnMaxZoom,
622
688
  showCoverageOnHover = this.options.showCoverageOnHover,
@@ -630,7 +696,6 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
630
696
  this.off('clustermouseover', this._showCoverage, this);
631
697
  this.off('clustermouseout', this._hideCoverage, this);
632
698
  map.off('zoomend', this._hideCoverage, this);
633
- map.off('layerremove', this._hideCoverageOnRemove, this);
634
699
  }
635
700
  },
636
701
 
@@ -652,7 +717,7 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
652
717
  var newBounds = this._getExpandedVisibleBounds();
653
718
 
654
719
  this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds, this._zoom, newBounds);
655
- this._topClusterLevel._recursivelyAddChildrenToMap(null, this._zoom, newBounds);
720
+ this._topClusterLevel._recursivelyAddChildrenToMap(null, this._map._zoom, newBounds);
656
721
 
657
722
  this._currentShownBounds = newBounds;
658
723
  return;
@@ -660,7 +725,15 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
660
725
 
661
726
  _generateInitialClusters: function () {
662
727
  var maxZoom = this._map.getMaxZoom(),
663
- radius = this.options.maxClusterRadius;
728
+ radius = this.options.maxClusterRadius,
729
+ radiusFn = radius;
730
+
731
+ //If we just set maxClusterRadius to a single number, we need to create
732
+ //a simple function to return that number. Otherwise, we just have to
733
+ //use the function we've passed in.
734
+ if (typeof radius !== "function") {
735
+ radiusFn = function () { return radius; };
736
+ }
664
737
 
665
738
  if (this.options.disableClusteringAtZoom) {
666
739
  maxZoom = this.options.disableClusteringAtZoom - 1;
@@ -668,11 +741,11 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
668
741
  this._maxZoom = maxZoom;
669
742
  this._gridClusters = {};
670
743
  this._gridUnclustered = {};
671
-
744
+
672
745
  //Set up DistanceGrids for each zoom
673
746
  for (var zoom = maxZoom; zoom >= 0; zoom--) {
674
- this._gridClusters[zoom] = new L.DistanceGrid(radius);
675
- this._gridUnclustered[zoom] = new L.DistanceGrid(radius);
747
+ this._gridClusters[zoom] = new L.DistanceGrid(radiusFn(zoom));
748
+ this._gridUnclustered[zoom] = new L.DistanceGrid(radiusFn(zoom));
676
749
  }
677
750
 
678
751
  this._topClusterLevel = new L.MarkerCluster(this, -1);
@@ -750,9 +823,29 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
750
823
  return;
751
824
  },
752
825
 
826
+ //Enqueue code to fire after the marker expand/contract has happened
827
+ _enqueue: function (fn) {
828
+ this._queue.push(fn);
829
+ if (!this._queueTimeout) {
830
+ this._queueTimeout = setTimeout(L.bind(this._processQueue, this), 300);
831
+ }
832
+ },
833
+ _processQueue: function () {
834
+ for (var i = 0; i < this._queue.length; i++) {
835
+ this._queue[i].call(this);
836
+ }
837
+ this._queue.length = 0;
838
+ clearTimeout(this._queueTimeout);
839
+ this._queueTimeout = null;
840
+ },
841
+
753
842
  //Merge and split any existing clusters that are too big or small
754
843
  _mergeSplitClusters: function () {
755
- if (this._zoom < this._map._zoom) { //Zoom in, split
844
+
845
+ //Incase we are starting to split before the animation finished
846
+ this._processQueue();
847
+
848
+ if (this._zoom < this._map._zoom && this._currentShownBounds.contains(this._getExpandedVisibleBounds())) { //Zoom in, split
756
849
  this._animationStart();
757
850
  //Remove clusters now off screen
758
851
  this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds, this._zoom, this._getExpandedVisibleBounds());
@@ -811,10 +904,16 @@ L.MarkerClusterGroup.include(!L.DomUtil.TRANSITION ? {
811
904
  _animationZoomIn: function (previousZoomLevel, newZoomLevel) {
812
905
  this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds, previousZoomLevel);
813
906
  this._topClusterLevel._recursivelyAddChildrenToMap(null, newZoomLevel, this._getExpandedVisibleBounds());
907
+
908
+ //We didn't actually animate, but we use this event to mean "clustering animations have finished"
909
+ this.fire('animationend');
814
910
  },
815
911
  _animationZoomOut: function (previousZoomLevel, newZoomLevel) {
816
912
  this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds, previousZoomLevel);
817
913
  this._topClusterLevel._recursivelyAddChildrenToMap(null, newZoomLevel, this._getExpandedVisibleBounds());
914
+
915
+ //We didn't actually animate, but we use this event to mean "clustering animations have finished"
916
+ this.fire('animationend');
818
917
  },
819
918
  _animationAddLayer: function (layer, newCluster) {
820
919
  this._animationAddLayerNonAnimated(layer, newCluster);
@@ -834,9 +933,8 @@ L.MarkerClusterGroup.include(!L.DomUtil.TRANSITION ? {
834
933
  this.fire('animationend');
835
934
  },
836
935
  _animationZoomIn: function (previousZoomLevel, newZoomLevel) {
837
- var me = this,
838
- bounds = this._getExpandedVisibleBounds(),
839
- fg = this._featureGroup,
936
+ var bounds = this._getExpandedVisibleBounds(),
937
+ fg = this._featureGroup,
840
938
  i;
841
939
 
842
940
  //Add all children of current clusters to map and remove those clusters from map
@@ -872,7 +970,7 @@ L.MarkerClusterGroup.include(!L.DomUtil.TRANSITION ? {
872
970
  this._forceLayout();
873
971
 
874
972
  //Update opacities
875
- me._topClusterLevel._recursivelyBecomeVisible(bounds, newZoomLevel);
973
+ this._topClusterLevel._recursivelyBecomeVisible(bounds, newZoomLevel);
876
974
  //TODO Maybe? Update markers in _recursivelyBecomeVisible
877
975
  fg.eachLayer(function (n) {
878
976
  if (!(n instanceof L.MarkerCluster) && n._icon) {
@@ -881,21 +979,20 @@ L.MarkerClusterGroup.include(!L.DomUtil.TRANSITION ? {
881
979
  });
882
980
 
883
981
  //update the positions of the just added clusters/markers
884
- me._topClusterLevel._recursively(bounds, previousZoomLevel, newZoomLevel, function (c) {
982
+ this._topClusterLevel._recursively(bounds, previousZoomLevel, newZoomLevel, function (c) {
885
983
  c._recursivelyRestoreChildPositions(newZoomLevel);
886
984
  });
887
985
 
888
986
  //Remove the old clusters and close the zoom animation
889
-
890
- setTimeout(function () {
987
+ this._enqueue(function () {
891
988
  //update the positions of the just added clusters/markers
892
- me._topClusterLevel._recursively(bounds, previousZoomLevel, 0, function (c) {
989
+ this._topClusterLevel._recursively(bounds, previousZoomLevel, 0, function (c) {
893
990
  fg.removeLayer(c);
894
991
  c.setOpacity(1);
895
992
  });
896
993
 
897
- me._animationEnd();
898
- }, 200);
994
+ this._animationEnd();
995
+ });
899
996
  },
900
997
 
901
998
  _animationZoomOut: function (previousZoomLevel, newZoomLevel) {
@@ -920,21 +1017,23 @@ L.MarkerClusterGroup.include(!L.DomUtil.TRANSITION ? {
920
1017
 
921
1018
  //TODO: Maybe use the transition timing stuff to make this more reliable
922
1019
  //When the animations are done, tidy up
923
- setTimeout(function () {
1020
+ this._enqueue(function () {
924
1021
 
925
1022
  //This cluster stopped being a cluster before the timeout fired
926
1023
  if (cluster._childCount === 1) {
927
1024
  var m = cluster._markers[0];
928
1025
  //If we were in a cluster animation at the time then the opacity and position of our child could be wrong now, so fix it
929
1026
  m.setLatLng(m.getLatLng());
930
- m.setOpacity(1);
1027
+ if (m.setOpacity) {
1028
+ m.setOpacity(1);
1029
+ }
931
1030
  } else {
932
1031
  cluster._recursively(bounds, newZoomLevel, 0, function (c) {
933
1032
  c._recursivelyRemoveChildrenFromMap(bounds, previousZoomLevel + 1);
934
1033
  });
935
1034
  }
936
1035
  me._animationEnd();
937
- }, 200);
1036
+ });
938
1037
  },
939
1038
  _animationAddLayer: function (layer, newCluster) {
940
1039
  var me = this,
@@ -951,12 +1050,12 @@ L.MarkerClusterGroup.include(!L.DomUtil.TRANSITION ? {
951
1050
  layer._setPos(this._map.latLngToLayerPoint(newCluster.getLatLng()));
952
1051
  layer.setOpacity(0);
953
1052
 
954
- setTimeout(function () {
1053
+ this._enqueue(function () {
955
1054
  fg.removeLayer(layer);
956
1055
  layer.setOpacity(1);
957
1056
 
958
1057
  me._animationEnd();
959
- }, 200);
1058
+ });
960
1059
 
961
1060
  } else { //Just became a cluster
962
1061
  this._forceLayout();
@@ -1026,9 +1125,32 @@ L.MarkerCluster = L.Marker.extend({
1026
1125
  return this._childCount;
1027
1126
  },
1028
1127
 
1029
- //Zoom to the extents of this cluster
1128
+ //Zoom to the minimum of showing all of the child markers, or the extents of this cluster
1030
1129
  zoomToBounds: function () {
1031
- this._group._map.fitBounds(this._bounds);
1130
+ var childClusters = this._childClusters.slice(),
1131
+ map = this._group._map,
1132
+ boundsZoom = map.getBoundsZoom(this._bounds),
1133
+ zoom = this._zoom + 1,
1134
+ mapZoom = map.getZoom(),
1135
+ i;
1136
+
1137
+ //calculate how fare we need to zoom down to see all of the markers
1138
+ while (childClusters.length > 0 && boundsZoom > zoom) {
1139
+ zoom++;
1140
+ var newClusters = [];
1141
+ for (i = 0; i < childClusters.length; i++) {
1142
+ newClusters = newClusters.concat(childClusters[i]._childClusters);
1143
+ }
1144
+ childClusters = newClusters;
1145
+ }
1146
+
1147
+ if (boundsZoom > zoom) {
1148
+ this._group._map.setView(this._latlng, zoom);
1149
+ } else if (boundsZoom <= mapZoom) { //If fitBounds wouldn't zoom us down, zoom us down instead
1150
+ this._group._map.setView(this._latlng, mapZoom + 1);
1151
+ } else {
1152
+ this._group._map.fitBounds(this._bounds);
1153
+ }
1032
1154
  },
1033
1155
 
1034
1156
  getBounds: function () {
@@ -1476,13 +1598,26 @@ Retrieved from: http://en.literateprograms.org/Quickhull_(Javascript)?oldid=1843
1476
1598
 
1477
1599
  (function () {
1478
1600
  L.QuickHull = {
1601
+
1602
+ /*
1603
+ * @param {Object} cpt a point to be measured from the baseline
1604
+ * @param {Array} bl the baseline, as represented by a two-element
1605
+ * array of latlng objects.
1606
+ * @returns {Number} an approximate distance measure
1607
+ */
1479
1608
  getDistant: function (cpt, bl) {
1480
1609
  var vY = bl[1].lat - bl[0].lat,
1481
1610
  vX = bl[0].lng - bl[1].lng;
1482
1611
  return (vX * (cpt.lat - bl[0].lat) + vY * (cpt.lng - bl[0].lng));
1483
1612
  },
1484
1613
 
1485
-
1614
+ /*
1615
+ * @param {Array} baseLine a two-element array of latlng objects
1616
+ * representing the baseline to project from
1617
+ * @param {Array} latLngs an array of latlng objects
1618
+ * @returns {Object} the maximum point and all new points to stay
1619
+ * in consideration for the hull.
1620
+ */
1486
1621
  findMostDistantPointFromBaseLine: function (baseLine, latLngs) {
1487
1622
  var maxD = 0,
1488
1623
  maxPt = null,
@@ -1503,11 +1638,19 @@ Retrieved from: http://en.literateprograms.org/Quickhull_(Javascript)?oldid=1843
1503
1638
  maxD = d;
1504
1639
  maxPt = pt;
1505
1640
  }
1506
-
1507
1641
  }
1508
- return { 'maxPoint': maxPt, 'newPoints': newPoints };
1642
+
1643
+ return { maxPoint: maxPt, newPoints: newPoints };
1509
1644
  },
1510
1645
 
1646
+
1647
+ /*
1648
+ * Given a baseline, compute the convex hull of latLngs as an array
1649
+ * of latLngs.
1650
+ *
1651
+ * @param {Array} latLngs
1652
+ * @returns {Array}
1653
+ */
1511
1654
  buildConvexHull: function (baseLine, latLngs) {
1512
1655
  var convexHullBaseLines = [],
1513
1656
  t = this.findMostDistantPointFromBaseLine(baseLine, latLngs);
@@ -1523,12 +1666,19 @@ Retrieved from: http://en.literateprograms.org/Quickhull_(Javascript)?oldid=1843
1523
1666
  );
1524
1667
  return convexHullBaseLines;
1525
1668
  } else { // if there is no more point "outside" the base line, the current base line is part of the convex hull
1526
- return [baseLine];
1669
+ return [baseLine[0]];
1527
1670
  }
1528
1671
  },
1529
1672
 
1673
+ /*
1674
+ * Given an array of latlngs, compute a convex hull as an array
1675
+ * of latlngs
1676
+ *
1677
+ * @param {Array} latLngs
1678
+ * @returns {Array}
1679
+ */
1530
1680
  getConvexHull: function (latLngs) {
1531
- //find first baseline
1681
+ // find first baseline
1532
1682
  var maxLat = false, minLat = false,
1533
1683
  maxPt = null, minPt = null,
1534
1684
  i;
@@ -1555,24 +1705,18 @@ L.MarkerCluster.include({
1555
1705
  getConvexHull: function () {
1556
1706
  var childMarkers = this.getAllChildMarkers(),
1557
1707
  points = [],
1558
- hullLatLng = [],
1559
- hull, p, i;
1708
+ p, i;
1560
1709
 
1561
1710
  for (i = childMarkers.length - 1; i >= 0; i--) {
1562
1711
  p = childMarkers[i].getLatLng();
1563
1712
  points.push(p);
1564
1713
  }
1565
1714
 
1566
- hull = L.QuickHull.getConvexHull(points);
1567
-
1568
- for (i = hull.length - 1; i >= 0; i--) {
1569
- hullLatLng.push(hull[i][0]);
1570
- }
1571
-
1572
- return hullLatLng;
1715
+ return L.QuickHull.getConvexHull(points);
1573
1716
  }
1574
1717
  });
1575
1718
 
1719
+
1576
1720
  //This code is 100% based on https://github.com/jawj/OverlappingMarkerSpiderfier-Leaflet
1577
1721
  //Huge thanks to jawj for implementing it first to make my job easy :-)
1578
1722
 
@@ -1686,6 +1830,8 @@ L.MarkerCluster.include({
1686
1830
  delete m._spiderLeg;
1687
1831
  }
1688
1832
  }
1833
+
1834
+ group._spiderfied = null;
1689
1835
  }
1690
1836
  });
1691
1837
 
@@ -1928,10 +2074,9 @@ L.MarkerClusterGroup.include({
1928
2074
 
1929
2075
  if (this._map.options.zoomAnimation) {
1930
2076
  this._map.on('zoomstart', this._unspiderfyZoomStart, this);
1931
- } else {
1932
- //Browsers without zoomAnimation don't fire zoomstart
1933
- this._map.on('zoomend', this._unspiderfyWrapper, this);
1934
2077
  }
2078
+ //Browsers without zoomAnimation or a big zoom don't fire zoomstart
2079
+ this._map.on('zoomend', this._noanimationUnspiderfy, this);
1935
2080
 
1936
2081
  if (L.Path.SVG && !L.Browser.touch) {
1937
2082
  this._map._initPathRoot();
@@ -3,4 +3,4 @@
3
3
  https://github.com/Leaflet/Leaflet.markercluster
4
4
  (c) 2012-2013, Dave Leaver, smartrak
5
5
  */
6
- !function(t,e){L.MarkerClusterGroup=L.FeatureGroup.extend({options:{maxClusterRadius:80,iconCreateFunction:null,spiderfyOnMaxZoom:!0,showCoverageOnHover:!0,zoomToBoundsOnClick:!0,singleMarkerMode:!1,disableClusteringAtZoom:null,removeOutsideVisibleBounds:!0,animateAddingMarkers:!1,spiderfyDistanceMultiplier:1,polygonOptions:{}},initialize:function(t){L.Util.setOptions(this,t),this.options.iconCreateFunction||(this.options.iconCreateFunction=this._defaultIconCreateFunction),this._featureGroup=L.featureGroup(),this._featureGroup.on(L.FeatureGroup.EVENTS,this._propagateEvent,this),this._nonPointGroup=L.featureGroup(),this._nonPointGroup.on(L.FeatureGroup.EVENTS,this._propagateEvent,this),this._inZoomAnimation=0,this._needsClustering=[],this._needsRemoving=[],this._currentShownBounds=null},addLayer:function(t){if(t instanceof L.LayerGroup){var e=[];for(var i in t._layers)e.push(t._layers[i]);return this.addLayers(e)}if(!t.getLatLng)return this._nonPointGroup.addLayer(t),this;if(!this._map)return this._needsClustering.push(t),this;if(this.hasLayer(t))return this;this._unspiderfy&&this._unspiderfy(),this._addLayer(t,this._maxZoom);var n=t,s=this._map.getZoom();if(t.__parent)for(;n.__parent._zoom>=s;)n=n.__parent;return this._currentShownBounds.contains(n.getLatLng())&&(this.options.animateAddingMarkers?this._animationAddLayer(t,n):this._animationAddLayerNonAnimated(t,n)),this},removeLayer:function(t){return t.getLatLng?this._map?t.__parent?(this._unspiderfy&&(this._unspiderfy(),this._unspiderfyLayer(t)),this._removeLayer(t,!0),this._featureGroup.hasLayer(t)&&(this._featureGroup.removeLayer(t),t.setOpacity&&t.setOpacity(1)),this):this:(!this._arraySplice(this._needsClustering,t)&&this.hasLayer(t)&&this._needsRemoving.push(t),this):(this._nonPointGroup.removeLayer(t),this)},addLayers:function(t){var e,i,n,s=this._map,r=this._featureGroup,o=this._nonPointGroup;for(e=0,i=t.length;i>e;e++)if(n=t[e],n.getLatLng){if(!this.hasLayer(n))if(s){if(this._addLayer(n,this._maxZoom),n.__parent&&2===n.__parent.getChildCount()){var a=n.__parent.getAllChildMarkers(),h=a[0]===n?a[1]:a[0];r.removeLayer(h)}}else this._needsClustering.push(n)}else o.addLayer(n);return s&&(r.eachLayer(function(t){t instanceof L.MarkerCluster&&t._iconNeedsUpdate&&t._updateIcon()}),this._topClusterLevel._recursivelyAddChildrenToMap(null,this._zoom,this._currentShownBounds)),this},removeLayers:function(t){var e,i,n,s=this._featureGroup,r=this._nonPointGroup;if(!this._map){for(e=0,i=t.length;i>e;e++)n=t[e],this._arraySplice(this._needsClustering,n),r.removeLayer(n);return this}for(e=0,i=t.length;i>e;e++)n=t[e],n.__parent?(this._removeLayer(n,!0,!0),s.hasLayer(n)&&(s.removeLayer(n),n.setOpacity&&n.setOpacity(1))):r.removeLayer(n);return this._topClusterLevel._recursivelyAddChildrenToMap(null,this._zoom,this._currentShownBounds),s.eachLayer(function(t){t instanceof L.MarkerCluster&&t._updateIcon()}),this},clearLayers:function(){return this._map||(this._needsClustering=[],delete this._gridClusters,delete this._gridUnclustered),this._noanimationUnspiderfy&&this._noanimationUnspiderfy(),this._featureGroup.clearLayers(),this._nonPointGroup.clearLayers(),this.eachLayer(function(t){delete t.__parent}),this._map&&this._generateInitialClusters(),this},getBounds:function(){var t=new L.LatLngBounds;if(this._topClusterLevel)t.extend(this._topClusterLevel._bounds);else for(var e=this._needsClustering.length-1;e>=0;e--)t.extend(this._needsClustering[e].getLatLng());var i=this._nonPointGroup.getBounds();return i.isValid()&&t.extend(i),t},eachLayer:function(t,e){var i,n=this._needsClustering.slice();for(this._topClusterLevel&&this._topClusterLevel.getAllChildMarkers(n),i=n.length-1;i>=0;i--)t.call(e,n[i]);this._nonPointGroup.eachLayer(t,e)},hasLayer:function(t){if(!t)return!1;var e,i=this._needsClustering;for(e=i.length-1;e>=0;e--)if(i[e]===t)return!0;for(i=this._needsRemoving,e=i.length-1;e>=0;e--)if(i[e]===t)return!1;return!(!t.__parent||t.__parent._group!==this)||this._nonPointGroup.hasLayer(t)},zoomToShowLayer:function(t,e){var i=function(){if((t._icon||t.__parent._icon)&&!this._inZoomAnimation)if(this._map.off("moveend",i,this),this.off("animationend",i,this),t._icon)e();else if(t.__parent._icon){var n=function(){this.off("spiderfied",n,this),e()};this.on("spiderfied",n,this),t.__parent.spiderfy()}};t._icon?e():t.__parent._zoom<this._map.getZoom()?(this._map.on("moveend",i,this),t._icon||this._map.panTo(t.getLatLng())):(this._map.on("moveend",i,this),this.on("animationend",i,this),this._map.setView(t.getLatLng(),t.__parent._zoom+1),t.__parent.zoomToBounds())},onAdd:function(t){this._map=t;var e,i,n;if(!isFinite(this._map.getMaxZoom()))throw"Map has no maxZoom specified";for(this._featureGroup.onAdd(t),this._nonPointGroup.onAdd(t),this._gridClusters||this._generateInitialClusters(),e=0,i=this._needsRemoving.length;i>e;e++)n=this._needsRemoving[e],this._removeLayer(n,!0);for(this._needsRemoving=[],e=0,i=this._needsClustering.length;i>e;e++)n=this._needsClustering[e],n.getLatLng?n.__parent||this._addLayer(n,this._maxZoom):this._featureGroup.addLayer(n);this._needsClustering=[],this._map.on("zoomend",this._zoomEnd,this),this._map.on("moveend",this._moveEnd,this),this._spiderfierOnAdd&&this._spiderfierOnAdd(),this._bindEvents(),this._zoom=this._map.getZoom(),this._currentShownBounds=this._getExpandedVisibleBounds(),this._topClusterLevel._recursivelyAddChildrenToMap(null,this._zoom,this._currentShownBounds)},onRemove:function(t){t.off("zoomend",this._zoomEnd,this),t.off("moveend",this._moveEnd,this),this._unbindEvents(),this._map._mapPane.className=this._map._mapPane.className.replace(" leaflet-cluster-anim",""),this._spiderfierOnRemove&&this._spiderfierOnRemove(),this._featureGroup.onRemove(t),this._nonPointGroup.onRemove(t),this._featureGroup.clearLayers(),this._map=null},getVisibleParent:function(t){for(var e=t;null!==e&&!e._icon;)e=e.__parent;return e},_arraySplice:function(t,e){for(var i=t.length-1;i>=0;i--)if(t[i]===e)return t.splice(i,1),!0},_removeLayer:function(t,e,i){var n=this._gridClusters,s=this._gridUnclustered,r=this._featureGroup,o=this._map;if(e)for(var a=this._maxZoom;a>=0&&s[a].removeObject(t,o.project(t.getLatLng(),a));a--);var h,_=t.__parent,u=_._markers;for(this._arraySplice(u,t);_&&(_._childCount--,!(_._zoom<0));)e&&_._childCount<=1?(h=_._markers[0]===t?_._markers[1]:_._markers[0],n[_._zoom].removeObject(_,o.project(_._cLatLng,_._zoom)),s[_._zoom].addObject(h,o.project(h.getLatLng(),_._zoom)),this._arraySplice(_.__parent._childClusters,_),_.__parent._markers.push(h),h.__parent=_.__parent,_._icon&&(r.removeLayer(_),i||r.addLayer(h))):(_._recalculateBounds(),i&&_._icon||_._updateIcon()),_=_.__parent;delete t.__parent},_propagateEvent:function(t){t.layer instanceof L.MarkerCluster&&(t.type="cluster"+t.type),this.fire(t.type,t)},_defaultIconCreateFunction:function(t){var e=t.getChildCount(),i=" marker-cluster-";return i+=10>e?"small":100>e?"medium":"large",new L.DivIcon({html:"<div><span>"+e+"</span></div>",className:"marker-cluster"+i,iconSize:new L.Point(40,40)})},_bindEvents:function(){var t=this._map,e=this.options.spiderfyOnMaxZoom,i=this.options.showCoverageOnHover,n=this.options.zoomToBoundsOnClick;(e||n)&&this.on("clusterclick",this._zoomOrSpiderfy,this),i&&(this.on("clustermouseover",this._showCoverage,this),this.on("clustermouseout",this._hideCoverage,this),t.on("zoomend",this._hideCoverage,this),t.on("layerremove",this._hideCoverageOnRemove,this))},_zoomOrSpiderfy:function(t){var e=this._map;e.getMaxZoom()===e.getZoom()?this.options.spiderfyOnMaxZoom&&t.layer.spiderfy():this.options.zoomToBoundsOnClick&&t.layer.zoomToBounds()},_showCoverage:function(t){var e=this._map;this._inZoomAnimation||(this._shownPolygon&&e.removeLayer(this._shownPolygon),t.layer.getChildCount()>2&&t.layer!==this._spiderfied&&(this._shownPolygon=new L.Polygon(t.layer.getConvexHull(),this.options.polygonOptions),e.addLayer(this._shownPolygon)))},_hideCoverage:function(){this._shownPolygon&&(this._map.removeLayer(this._shownPolygon),this._shownPolygon=null)},_hideCoverageOnRemove:function(t){t.layer===this&&this._hideCoverage()},_unbindEvents:function(){var t=this.options.spiderfyOnMaxZoom,e=this.options.showCoverageOnHover,i=this.options.zoomToBoundsOnClick,n=this._map;(t||i)&&this.off("clusterclick",this._zoomOrSpiderfy,this),e&&(this.off("clustermouseover",this._showCoverage,this),this.off("clustermouseout",this._hideCoverage,this),n.off("zoomend",this._hideCoverage,this),n.off("layerremove",this._hideCoverageOnRemove,this))},_zoomEnd:function(){this._map&&(this._mergeSplitClusters(),this._zoom=this._map._zoom,this._currentShownBounds=this._getExpandedVisibleBounds())},_moveEnd:function(){if(!this._inZoomAnimation){var t=this._getExpandedVisibleBounds();this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds,this._zoom,t),this._topClusterLevel._recursivelyAddChildrenToMap(null,this._zoom,t),this._currentShownBounds=t}},_generateInitialClusters:function(){var t=this._map.getMaxZoom(),e=this.options.maxClusterRadius;this.options.disableClusteringAtZoom&&(t=this.options.disableClusteringAtZoom-1),this._maxZoom=t,this._gridClusters={},this._gridUnclustered={};for(var i=t;i>=0;i--)this._gridClusters[i]=new L.DistanceGrid(e),this._gridUnclustered[i]=new L.DistanceGrid(e);this._topClusterLevel=new L.MarkerCluster(this,-1)},_addLayer:function(t,e){var i,n,s=this._gridClusters,r=this._gridUnclustered;for(this.options.singleMarkerMode&&(t.options.icon=this.options.iconCreateFunction({getChildCount:function(){return 1},getAllChildMarkers:function(){return[t]}}));e>=0;e--){i=this._map.project(t.getLatLng(),e);var o=s[e].getNearObject(i);if(o)return o._addChild(t),t.__parent=o,void 0;if(o=r[e].getNearObject(i)){var a=o.__parent;a&&this._removeLayer(o,!1);var h=new L.MarkerCluster(this,e,o,t);s[e].addObject(h,this._map.project(h._cLatLng,e)),o.__parent=h,t.__parent=h;var _=h;for(n=e-1;n>a._zoom;n--)_=new L.MarkerCluster(this,n,_),s[n].addObject(_,this._map.project(o.getLatLng(),n));for(a._addChild(_),n=e;n>=0&&r[n].removeObject(o,this._map.project(o.getLatLng(),n));n--);return}r[e].addObject(t,i)}this._topClusterLevel._addChild(t),t.__parent=this._topClusterLevel},_mergeSplitClusters:function(){this._zoom<this._map._zoom?(this._animationStart(),this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds,this._zoom,this._getExpandedVisibleBounds()),this._animationZoomIn(this._zoom,this._map._zoom)):this._zoom>this._map._zoom?(this._animationStart(),this._animationZoomOut(this._zoom,this._map._zoom)):this._moveEnd()},_getExpandedVisibleBounds:function(){if(!this.options.removeOutsideVisibleBounds)return this.getBounds();var t=this._map,e=t.getBounds(),i=e._southWest,n=e._northEast,s=L.Browser.mobile?0:Math.abs(i.lat-n.lat),r=L.Browser.mobile?0:Math.abs(i.lng-n.lng);return new L.LatLngBounds(new L.LatLng(i.lat-s,i.lng-r,!0),new L.LatLng(n.lat+s,n.lng+r,!0))},_animationAddLayerNonAnimated:function(t,e){if(e===t)this._featureGroup.addLayer(t);else if(2===e._childCount){e._addToMap();var i=e.getAllChildMarkers();this._featureGroup.removeLayer(i[0]),this._featureGroup.removeLayer(i[1])}else e._updateIcon()}}),L.MarkerClusterGroup.include(L.DomUtil.TRANSITION?{_animationStart:function(){this._map._mapPane.className+=" leaflet-cluster-anim",this._inZoomAnimation++},_animationEnd:function(){this._map&&(this._map._mapPane.className=this._map._mapPane.className.replace(" leaflet-cluster-anim","")),this._inZoomAnimation--,this.fire("animationend")},_animationZoomIn:function(t,e){var i,n=this,s=this._getExpandedVisibleBounds(),r=this._featureGroup;this._topClusterLevel._recursively(s,t,0,function(n){var o,a=n._latlng,h=n._markers;for(s.contains(a)||(a=null),n._isSingleParent()&&t+1===e?(r.removeLayer(n),n._recursivelyAddChildrenToMap(null,e,s)):(n.setOpacity(0),n._recursivelyAddChildrenToMap(a,e,s)),i=h.length-1;i>=0;i--)o=h[i],s.contains(o._latlng)||r.removeLayer(o)}),this._forceLayout(),n._topClusterLevel._recursivelyBecomeVisible(s,e),r.eachLayer(function(t){t instanceof L.MarkerCluster||!t._icon||t.setOpacity(1)}),n._topClusterLevel._recursively(s,t,e,function(t){t._recursivelyRestoreChildPositions(e)}),setTimeout(function(){n._topClusterLevel._recursively(s,t,0,function(t){r.removeLayer(t),t.setOpacity(1)}),n._animationEnd()},200)},_animationZoomOut:function(t,e){this._animationZoomOutSingle(this._topClusterLevel,t-1,e),this._topClusterLevel._recursivelyAddChildrenToMap(null,e,this._getExpandedVisibleBounds()),this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds,t,this._getExpandedVisibleBounds())},_animationZoomOutSingle:function(t,e,i){var n=this._getExpandedVisibleBounds();t._recursivelyAnimateChildrenInAndAddSelfToMap(n,e+1,i);var s=this;this._forceLayout(),t._recursivelyBecomeVisible(n,i),setTimeout(function(){if(1===t._childCount){var r=t._markers[0];r.setLatLng(r.getLatLng()),r.setOpacity(1)}else t._recursively(n,i,0,function(t){t._recursivelyRemoveChildrenFromMap(n,e+1)});s._animationEnd()},200)},_animationAddLayer:function(t,e){var i=this,n=this._featureGroup;n.addLayer(t),e!==t&&(e._childCount>2?(e._updateIcon(),this._forceLayout(),this._animationStart(),t._setPos(this._map.latLngToLayerPoint(e.getLatLng())),t.setOpacity(0),setTimeout(function(){n.removeLayer(t),t.setOpacity(1),i._animationEnd()},200)):(this._forceLayout(),i._animationStart(),i._animationZoomOutSingle(e,this._map.getMaxZoom(),this._map.getZoom())))},_forceLayout:function(){L.Util.falseFn(e.body.offsetWidth)}}:{_animationStart:function(){},_animationZoomIn:function(t,e){this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds,t),this._topClusterLevel._recursivelyAddChildrenToMap(null,e,this._getExpandedVisibleBounds())},_animationZoomOut:function(t,e){this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds,t),this._topClusterLevel._recursivelyAddChildrenToMap(null,e,this._getExpandedVisibleBounds())},_animationAddLayer:function(t,e){this._animationAddLayerNonAnimated(t,e)}}),L.markerClusterGroup=function(t){return new L.MarkerClusterGroup(t)},L.MarkerCluster=L.Marker.extend({initialize:function(t,e,i,n){L.Marker.prototype.initialize.call(this,i?i._cLatLng||i.getLatLng():new L.LatLng(0,0),{icon:this}),this._group=t,this._zoom=e,this._markers=[],this._childClusters=[],this._childCount=0,this._iconNeedsUpdate=!0,this._bounds=new L.LatLngBounds,i&&this._addChild(i),n&&this._addChild(n)},getAllChildMarkers:function(t){t=t||[];for(var e=this._childClusters.length-1;e>=0;e--)this._childClusters[e].getAllChildMarkers(t);for(var i=this._markers.length-1;i>=0;i--)t.push(this._markers[i]);return t},getChildCount:function(){return this._childCount},zoomToBounds:function(){this._group._map.fitBounds(this._bounds)},getBounds:function(){var t=new L.LatLngBounds;return t.extend(this._bounds),t},_updateIcon:function(){this._iconNeedsUpdate=!0,this._icon&&this.setIcon(this)},createIcon:function(){return this._iconNeedsUpdate&&(this._iconObj=this._group.options.iconCreateFunction(this),this._iconNeedsUpdate=!1),this._iconObj.createIcon()},createShadow:function(){return this._iconObj.createShadow()},_addChild:function(t,e){this._iconNeedsUpdate=!0,this._expandBounds(t),t instanceof L.MarkerCluster?(e||(this._childClusters.push(t),t.__parent=this),this._childCount+=t._childCount):(e||this._markers.push(t),this._childCount++),this.__parent&&this.__parent._addChild(t,!0)},_expandBounds:function(t){var e,i=t._wLatLng||t._latlng;t instanceof L.MarkerCluster?(this._bounds.extend(t._bounds),e=t._childCount):(this._bounds.extend(i),e=1),this._cLatLng||(this._cLatLng=t._cLatLng||i);var n=this._childCount+e;this._wLatLng?(this._wLatLng.lat=(i.lat*e+this._wLatLng.lat*this._childCount)/n,this._wLatLng.lng=(i.lng*e+this._wLatLng.lng*this._childCount)/n):this._latlng=this._wLatLng=new L.LatLng(i.lat,i.lng)},_addToMap:function(t){t&&(this._backupLatlng=this._latlng,this.setLatLng(t)),this._group._featureGroup.addLayer(this)},_recursivelyAnimateChildrenIn:function(t,e,i){this._recursively(t,0,i-1,function(t){var i,n,s=t._markers;for(i=s.length-1;i>=0;i--)n=s[i],n._icon&&(n._setPos(e),n.setOpacity(0))},function(t){var i,n,s=t._childClusters;for(i=s.length-1;i>=0;i--)n=s[i],n._icon&&(n._setPos(e),n.setOpacity(0))})},_recursivelyAnimateChildrenInAndAddSelfToMap:function(t,e,i){this._recursively(t,i,0,function(n){n._recursivelyAnimateChildrenIn(t,n._group._map.latLngToLayerPoint(n.getLatLng()).round(),e),n._isSingleParent()&&e-1===i?(n.setOpacity(1),n._recursivelyRemoveChildrenFromMap(t,e)):n.setOpacity(0),n._addToMap()})},_recursivelyBecomeVisible:function(t,e){this._recursively(t,0,e,null,function(t){t.setOpacity(1)})},_recursivelyAddChildrenToMap:function(t,e,i){this._recursively(i,-1,e,function(n){if(e!==n._zoom)for(var s=n._markers.length-1;s>=0;s--){var r=n._markers[s];i.contains(r._latlng)&&(t&&(r._backupLatlng=r.getLatLng(),r.setLatLng(t),r.setOpacity&&r.setOpacity(0)),n._group._featureGroup.addLayer(r))}},function(e){e._addToMap(t)})},_recursivelyRestoreChildPositions:function(t){for(var e=this._markers.length-1;e>=0;e--){var i=this._markers[e];i._backupLatlng&&(i.setLatLng(i._backupLatlng),delete i._backupLatlng)}if(t-1===this._zoom)for(var n=this._childClusters.length-1;n>=0;n--)this._childClusters[n]._restorePosition();else for(var s=this._childClusters.length-1;s>=0;s--)this._childClusters[s]._recursivelyRestoreChildPositions(t)},_restorePosition:function(){this._backupLatlng&&(this.setLatLng(this._backupLatlng),delete this._backupLatlng)},_recursivelyRemoveChildrenFromMap:function(t,e,i){var n,s;this._recursively(t,-1,e-1,function(t){for(s=t._markers.length-1;s>=0;s--)n=t._markers[s],i&&i.contains(n._latlng)||(t._group._featureGroup.removeLayer(n),n.setOpacity&&n.setOpacity(1))},function(t){for(s=t._childClusters.length-1;s>=0;s--)n=t._childClusters[s],i&&i.contains(n._latlng)||(t._group._featureGroup.removeLayer(n),n.setOpacity&&n.setOpacity(1))})},_recursively:function(t,e,i,n,s){var r,o,a=this._childClusters,h=this._zoom;if(e>h)for(r=a.length-1;r>=0;r--)o=a[r],t.intersects(o._bounds)&&o._recursively(t,e,i,n,s);else if(n&&n(this),s&&this._zoom===i&&s(this),i>h)for(r=a.length-1;r>=0;r--)o=a[r],t.intersects(o._bounds)&&o._recursively(t,e,i,n,s)},_recalculateBounds:function(){var t,e=this._markers,i=this._childClusters;for(this._bounds=new L.LatLngBounds,delete this._wLatLng,t=e.length-1;t>=0;t--)this._expandBounds(e[t]);for(t=i.length-1;t>=0;t--)this._expandBounds(i[t])},_isSingleParent:function(){return this._childClusters.length>0&&this._childClusters[0]._childCount===this._childCount}}),L.DistanceGrid=function(t){this._cellSize=t,this._sqCellSize=t*t,this._grid={},this._objectPoint={}},L.DistanceGrid.prototype={addObject:function(t,e){var i=this._getCoord(e.x),n=this._getCoord(e.y),s=this._grid,r=s[n]=s[n]||{},o=r[i]=r[i]||[],a=L.Util.stamp(t);this._objectPoint[a]=e,o.push(t)},updateObject:function(t,e){this.removeObject(t),this.addObject(t,e)},removeObject:function(t,e){var i,n,s=this._getCoord(e.x),r=this._getCoord(e.y),o=this._grid,a=o[r]=o[r]||{},h=a[s]=a[s]||[];for(delete this._objectPoint[L.Util.stamp(t)],i=0,n=h.length;n>i;i++)if(h[i]===t)return h.splice(i,1),1===n&&delete a[s],!0},eachObject:function(t,e){var i,n,s,r,o,a,h,_=this._grid;for(i in _){o=_[i];for(n in o)for(a=o[n],s=0,r=a.length;r>s;s++)h=t.call(e,a[s]),h&&(s--,r--)}},getNearObject:function(t){var e,i,n,s,r,o,a,h,_=this._getCoord(t.x),u=this._getCoord(t.y),l=this._objectPoint,d=this._sqCellSize,p=null;for(e=u-1;u+1>=e;e++)if(s=this._grid[e])for(i=_-1;_+1>=i;i++)if(r=s[i])for(n=0,o=r.length;o>n;n++)a=r[n],h=this._sqDist(l[L.Util.stamp(a)],t),d>h&&(d=h,p=a);return p},_getCoord:function(t){return Math.floor(t/this._cellSize)},_sqDist:function(t,e){var i=e.x-t.x,n=e.y-t.y;return i*i+n*n}},function(){L.QuickHull={getDistant:function(t,e){var i=e[1].lat-e[0].lat,n=e[0].lng-e[1].lng;return n*(t.lat-e[0].lat)+i*(t.lng-e[0].lng)},findMostDistantPointFromBaseLine:function(t,e){var i,n,s,r=0,o=null,a=[];for(i=e.length-1;i>=0;i--)n=e[i],s=this.getDistant(n,t),s>0&&(a.push(n),s>r&&(r=s,o=n));return{maxPoint:o,newPoints:a}},buildConvexHull:function(t,e){var i=[],n=this.findMostDistantPointFromBaseLine(t,e);return n.maxPoint?(i=i.concat(this.buildConvexHull([t[0],n.maxPoint],n.newPoints)),i=i.concat(this.buildConvexHull([n.maxPoint,t[1]],n.newPoints))):[t]},getConvexHull:function(t){var e,i=!1,n=!1,s=null,r=null;for(e=t.length-1;e>=0;e--){var o=t[e];(i===!1||o.lat>i)&&(s=o,i=o.lat),(n===!1||o.lat<n)&&(r=o,n=o.lat)}var a=[].concat(this.buildConvexHull([r,s],t),this.buildConvexHull([s,r],t));return a}}}(),L.MarkerCluster.include({getConvexHull:function(){var t,e,i,n=this.getAllChildMarkers(),s=[],r=[];for(i=n.length-1;i>=0;i--)e=n[i].getLatLng(),s.push(e);for(t=L.QuickHull.getConvexHull(s),i=t.length-1;i>=0;i--)r.push(t[i][0]);return r}}),L.MarkerCluster.include({_2PI:2*Math.PI,_circleFootSeparation:25,_circleStartAngle:Math.PI/6,_spiralFootSeparation:28,_spiralLengthStart:11,_spiralLengthFactor:5,_circleSpiralSwitchover:9,spiderfy:function(){if(this._group._spiderfied!==this&&!this._group._inZoomAnimation){var t,e=this.getAllChildMarkers(),i=this._group,n=i._map,s=n.latLngToLayerPoint(this._latlng);this._group._unspiderfy(),this._group._spiderfied=this,e.length>=this._circleSpiralSwitchover?t=this._generatePointsSpiral(e.length,s):(s.y+=10,t=this._generatePointsCircle(e.length,s)),this._animationSpiderfy(e,t)}},unspiderfy:function(t){this._group._inZoomAnimation||(this._animationUnspiderfy(t),this._group._spiderfied=null)},_generatePointsCircle:function(t,e){var i,n,s=this._group.options.spiderfyDistanceMultiplier*this._circleFootSeparation*(2+t),r=s/this._2PI,o=this._2PI/t,a=[];for(a.length=t,i=t-1;i>=0;i--)n=this._circleStartAngle+i*o,a[i]=new L.Point(e.x+r*Math.cos(n),e.y+r*Math.sin(n))._round();return a},_generatePointsSpiral:function(t,e){var i,n=this._group.options.spiderfyDistanceMultiplier*this._spiralLengthStart,s=this._group.options.spiderfyDistanceMultiplier*this._spiralFootSeparation,r=this._group.options.spiderfyDistanceMultiplier*this._spiralLengthFactor,o=0,a=[];for(a.length=t,i=t-1;i>=0;i--)o+=s/n+5e-4*i,a[i]=new L.Point(e.x+n*Math.cos(o),e.y+n*Math.sin(o))._round(),n+=this._2PI*r/o;return a},_noanimationUnspiderfy:function(){var t,e,i=this._group,n=i._map,s=i._featureGroup,r=this.getAllChildMarkers();for(this.setOpacity(1),e=r.length-1;e>=0;e--)t=r[e],s.removeLayer(t),t._preSpiderfyLatlng&&(t.setLatLng(t._preSpiderfyLatlng),delete t._preSpiderfyLatlng),t.setZIndexOffset&&t.setZIndexOffset(0),t._spiderLeg&&(n.removeLayer(t._spiderLeg),delete t._spiderLeg)}}),L.MarkerCluster.include(L.DomUtil.TRANSITION?{SVG_ANIMATION:function(){return e.createElementNS("http://www.w3.org/2000/svg","animate").toString().indexOf("SVGAnimate")>-1}(),_animationSpiderfy:function(t,i){var n,s,r,o,a=this,h=this._group,_=h._map,u=h._featureGroup,l=_.latLngToLayerPoint(this._latlng);for(n=t.length-1;n>=0;n--)s=t[n],s.setOpacity?(s.setZIndexOffset(1e6),s.setOpacity(0),u.addLayer(s),s._setPos(l)):u.addLayer(s);h._forceLayout(),h._animationStart();var d=L.Path.SVG?0:.3,p=L.Path.SVG_NS;for(n=t.length-1;n>=0;n--)if(o=_.layerPointToLatLng(i[n]),s=t[n],s._preSpiderfyLatlng=s._latlng,s.setLatLng(o),s.setOpacity&&s.setOpacity(1),r=new L.Polyline([a._latlng,o],{weight:1.5,color:"#222",opacity:d}),_.addLayer(r),s._spiderLeg=r,L.Path.SVG&&this.SVG_ANIMATION){var c=r._path.getTotalLength();r._path.setAttribute("stroke-dasharray",c+","+c);var m=e.createElementNS(p,"animate");m.setAttribute("attributeName","stroke-dashoffset"),m.setAttribute("begin","indefinite"),m.setAttribute("from",c),m.setAttribute("to",0),m.setAttribute("dur",.25),r._path.appendChild(m),m.beginElement(),m=e.createElementNS(p,"animate"),m.setAttribute("attributeName","stroke-opacity"),m.setAttribute("attributeName","stroke-opacity"),m.setAttribute("begin","indefinite"),m.setAttribute("from",0),m.setAttribute("to",.5),m.setAttribute("dur",.25),r._path.appendChild(m),m.beginElement()}if(a.setOpacity(.3),L.Path.SVG)for(this._group._forceLayout(),n=t.length-1;n>=0;n--)s=t[n]._spiderLeg,s.options.opacity=.5,s._path.setAttribute("stroke-opacity",.5);setTimeout(function(){h._animationEnd(),h.fire("spiderfied")},200)},_animationUnspiderfy:function(t){var e,i,n,s=this._group,r=s._map,o=s._featureGroup,a=t?r._latLngToNewLayerPoint(this._latlng,t.zoom,t.center):r.latLngToLayerPoint(this._latlng),h=this.getAllChildMarkers(),_=L.Path.SVG&&this.SVG_ANIMATION;for(s._animationStart(),this.setOpacity(1),i=h.length-1;i>=0;i--)e=h[i],e._preSpiderfyLatlng&&(e.setLatLng(e._preSpiderfyLatlng),delete e._preSpiderfyLatlng,e.setOpacity?(e._setPos(a),e.setOpacity(0)):o.removeLayer(e),_&&(n=e._spiderLeg._path.childNodes[0],n.setAttribute("to",n.getAttribute("from")),n.setAttribute("from",0),n.beginElement(),n=e._spiderLeg._path.childNodes[1],n.setAttribute("from",.5),n.setAttribute("to",0),n.setAttribute("stroke-opacity",0),n.beginElement(),e._spiderLeg._path.setAttribute("stroke-opacity",0)));setTimeout(function(){var t=0;for(i=h.length-1;i>=0;i--)e=h[i],e._spiderLeg&&t++;for(i=h.length-1;i>=0;i--)e=h[i],e._spiderLeg&&(e.setOpacity&&(e.setOpacity(1),e.setZIndexOffset(0)),t>1&&o.removeLayer(e),r.removeLayer(e._spiderLeg),delete e._spiderLeg);s._animationEnd()},200)}}:{_animationSpiderfy:function(t,e){var i,n,s,r,o=this._group,a=o._map,h=o._featureGroup;for(i=t.length-1;i>=0;i--)r=a.layerPointToLatLng(e[i]),n=t[i],n._preSpiderfyLatlng=n._latlng,n.setLatLng(r),n.setZIndexOffset&&n.setZIndexOffset(1e6),h.addLayer(n),s=new L.Polyline([this._latlng,r],{weight:1.5,color:"#222"}),a.addLayer(s),n._spiderLeg=s;this.setOpacity(.3),o.fire("spiderfied")},_animationUnspiderfy:function(){this._noanimationUnspiderfy()}}),L.MarkerClusterGroup.include({_spiderfied:null,_spiderfierOnAdd:function(){this._map.on("click",this._unspiderfyWrapper,this),this._map.options.zoomAnimation?this._map.on("zoomstart",this._unspiderfyZoomStart,this):this._map.on("zoomend",this._unspiderfyWrapper,this),L.Path.SVG&&!L.Browser.touch&&this._map._initPathRoot()},_spiderfierOnRemove:function(){this._map.off("click",this._unspiderfyWrapper,this),this._map.off("zoomstart",this._unspiderfyZoomStart,this),this._map.off("zoomanim",this._unspiderfyZoomAnim,this),this._unspiderfy()},_unspiderfyZoomStart:function(){this._map&&this._map.on("zoomanim",this._unspiderfyZoomAnim,this)},_unspiderfyZoomAnim:function(t){L.DomUtil.hasClass(this._map._mapPane,"leaflet-touching")||(this._map.off("zoomanim",this._unspiderfyZoomAnim,this),this._unspiderfy(t))},_unspiderfyWrapper:function(){this._unspiderfy()},_unspiderfy:function(t){this._spiderfied&&this._spiderfied.unspiderfy(t)},_noanimationUnspiderfy:function(){this._spiderfied&&this._spiderfied._noanimationUnspiderfy()},_unspiderfyLayer:function(t){t._spiderLeg&&(this._featureGroup.removeLayer(t),t.setOpacity(1),t.setZIndexOffset(0),this._map.removeLayer(t._spiderLeg),delete t._spiderLeg)}})}(window,document);
6
+ !function(t,e){L.MarkerClusterGroup=L.FeatureGroup.extend({options:{maxClusterRadius:80,iconCreateFunction:null,spiderfyOnMaxZoom:!0,showCoverageOnHover:!0,zoomToBoundsOnClick:!0,singleMarkerMode:!1,disableClusteringAtZoom:null,removeOutsideVisibleBounds:!0,animateAddingMarkers:!1,spiderfyDistanceMultiplier:1,chunkedLoading:!1,chunkInterval:200,chunkDelay:50,chunkProgress:null,polygonOptions:{}},initialize:function(t){L.Util.setOptions(this,t),this.options.iconCreateFunction||(this.options.iconCreateFunction=this._defaultIconCreateFunction),this._featureGroup=L.featureGroup(),this._featureGroup.on(L.FeatureGroup.EVENTS,this._propagateEvent,this),this._nonPointGroup=L.featureGroup(),this._nonPointGroup.on(L.FeatureGroup.EVENTS,this._propagateEvent,this),this._inZoomAnimation=0,this._needsClustering=[],this._needsRemoving=[],this._currentShownBounds=null,this._queue=[]},addLayer:function(t){if(t instanceof L.LayerGroup){var e=[];for(var i in t._layers)e.push(t._layers[i]);return this.addLayers(e)}if(!t.getLatLng)return this._nonPointGroup.addLayer(t),this;if(!this._map)return this._needsClustering.push(t),this;if(this.hasLayer(t))return this;this._unspiderfy&&this._unspiderfy(),this._addLayer(t,this._maxZoom);var n=t,s=this._map.getZoom();if(t.__parent)for(;n.__parent._zoom>=s;)n=n.__parent;return this._currentShownBounds.contains(n.getLatLng())&&(this.options.animateAddingMarkers?this._animationAddLayer(t,n):this._animationAddLayerNonAnimated(t,n)),this},removeLayer:function(t){if(t instanceof L.LayerGroup){var e=[];for(var i in t._layers)e.push(t._layers[i]);return this.removeLayers(e)}return t.getLatLng?this._map?t.__parent?(this._unspiderfy&&(this._unspiderfy(),this._unspiderfyLayer(t)),this._removeLayer(t,!0),this._featureGroup.hasLayer(t)&&(this._featureGroup.removeLayer(t),t.setOpacity&&t.setOpacity(1)),this):this:(!this._arraySplice(this._needsClustering,t)&&this.hasLayer(t)&&this._needsRemoving.push(t),this):(this._nonPointGroup.removeLayer(t),this)},addLayers:function(t){var e,i,n,s,r=this._featureGroup,o=this._nonPointGroup,a=this.options.chunkedLoading,h=this.options.chunkInterval,_=this.options.chunkProgress;if(this._map){var u=0,l=(new Date).getTime(),d=L.bind(function(){for(var e=(new Date).getTime();u<t.length;u++){if(a&&0===u%200){var i=(new Date).getTime()-e;if(i>h)break}if(s=t[u],s.getLatLng){if(!this.hasLayer(s)&&(this._addLayer(s,this._maxZoom),s.__parent&&2===s.__parent.getChildCount())){var n=s.__parent.getAllChildMarkers(),p=n[0]===s?n[1]:n[0];r.removeLayer(p)}}else o.addLayer(s)}_&&_(u,t.length,(new Date).getTime()-l),u===t.length?(this._featureGroup.eachLayer(function(t){t instanceof L.MarkerCluster&&t._iconNeedsUpdate&&t._updateIcon()}),this._topClusterLevel._recursivelyAddChildrenToMap(null,this._zoom,this._currentShownBounds)):setTimeout(d,this.options.chunkDelay)},this);d()}else{for(e=[],i=0,n=t.length;n>i;i++)s=t[i],s.getLatLng?this.hasLayer(s)||e.push(s):o.addLayer(s);this._needsClustering=this._needsClustering.concat(e)}return this},removeLayers:function(t){var e,i,n,s=this._featureGroup,r=this._nonPointGroup;if(!this._map){for(e=0,i=t.length;i>e;e++)n=t[e],this._arraySplice(this._needsClustering,n),r.removeLayer(n);return this}for(e=0,i=t.length;i>e;e++)n=t[e],n.__parent?(this._removeLayer(n,!0,!0),s.hasLayer(n)&&(s.removeLayer(n),n.setOpacity&&n.setOpacity(1))):r.removeLayer(n);return this._topClusterLevel._recursivelyAddChildrenToMap(null,this._zoom,this._currentShownBounds),s.eachLayer(function(t){t instanceof L.MarkerCluster&&t._updateIcon()}),this},clearLayers:function(){return this._map||(this._needsClustering=[],delete this._gridClusters,delete this._gridUnclustered),this._noanimationUnspiderfy&&this._noanimationUnspiderfy(),this._featureGroup.clearLayers(),this._nonPointGroup.clearLayers(),this.eachLayer(function(t){delete t.__parent}),this._map&&this._generateInitialClusters(),this},getBounds:function(){var t=new L.LatLngBounds;if(this._topClusterLevel)t.extend(this._topClusterLevel._bounds);else for(var e=this._needsClustering.length-1;e>=0;e--)t.extend(this._needsClustering[e].getLatLng());return t.extend(this._nonPointGroup.getBounds()),t},eachLayer:function(t,e){var i,n=this._needsClustering.slice();for(this._topClusterLevel&&this._topClusterLevel.getAllChildMarkers(n),i=n.length-1;i>=0;i--)t.call(e,n[i]);this._nonPointGroup.eachLayer(t,e)},getLayers:function(){var t=[];return this.eachLayer(function(e){t.push(e)}),t},getLayer:function(t){var e=null;return this.eachLayer(function(i){L.stamp(i)===t&&(e=i)}),e},hasLayer:function(t){if(!t)return!1;var e,i=this._needsClustering;for(e=i.length-1;e>=0;e--)if(i[e]===t)return!0;for(i=this._needsRemoving,e=i.length-1;e>=0;e--)if(i[e]===t)return!1;return!(!t.__parent||t.__parent._group!==this)||this._nonPointGroup.hasLayer(t)},zoomToShowLayer:function(t,e){var i=function(){if((t._icon||t.__parent._icon)&&!this._inZoomAnimation)if(this._map.off("moveend",i,this),this.off("animationend",i,this),t._icon)e();else if(t.__parent._icon){var n=function(){this.off("spiderfied",n,this),e()};this.on("spiderfied",n,this),t.__parent.spiderfy()}};t._icon&&this._map.getBounds().contains(t.getLatLng())?e():t.__parent._zoom<this._map.getZoom()?(this._map.on("moveend",i,this),this._map.panTo(t.getLatLng())):(this._map.on("moveend",i,this),this.on("animationend",i,this),this._map.setView(t.getLatLng(),t.__parent._zoom+1),t.__parent.zoomToBounds())},onAdd:function(t){this._map=t;var e,i,n;if(!isFinite(this._map.getMaxZoom()))throw"Map has no maxZoom specified";for(this._featureGroup.onAdd(t),this._nonPointGroup.onAdd(t),this._gridClusters||this._generateInitialClusters(),e=0,i=this._needsRemoving.length;i>e;e++)n=this._needsRemoving[e],this._removeLayer(n,!0);this._needsRemoving=[],this._zoom=this._map.getZoom(),this._currentShownBounds=this._getExpandedVisibleBounds(),this._map.on("zoomend",this._zoomEnd,this),this._map.on("moveend",this._moveEnd,this),this._spiderfierOnAdd&&this._spiderfierOnAdd(),this._bindEvents(),i=this._needsClustering,this._needsClustering=[],this.addLayers(i)},onRemove:function(t){t.off("zoomend",this._zoomEnd,this),t.off("moveend",this._moveEnd,this),this._unbindEvents(),this._map._mapPane.className=this._map._mapPane.className.replace(" leaflet-cluster-anim",""),this._spiderfierOnRemove&&this._spiderfierOnRemove(),this._hideCoverage(),this._featureGroup.onRemove(t),this._nonPointGroup.onRemove(t),this._featureGroup.clearLayers(),this._map=null},getVisibleParent:function(t){for(var e=t;e&&!e._icon;)e=e.__parent;return e||null},_arraySplice:function(t,e){for(var i=t.length-1;i>=0;i--)if(t[i]===e)return t.splice(i,1),!0},_removeLayer:function(t,e,i){var n=this._gridClusters,s=this._gridUnclustered,r=this._featureGroup,o=this._map;if(e)for(var a=this._maxZoom;a>=0&&s[a].removeObject(t,o.project(t.getLatLng(),a));a--);var h,_=t.__parent,u=_._markers;for(this._arraySplice(u,t);_&&(_._childCount--,!(_._zoom<0));)e&&_._childCount<=1?(h=_._markers[0]===t?_._markers[1]:_._markers[0],n[_._zoom].removeObject(_,o.project(_._cLatLng,_._zoom)),s[_._zoom].addObject(h,o.project(h.getLatLng(),_._zoom)),this._arraySplice(_.__parent._childClusters,_),_.__parent._markers.push(h),h.__parent=_.__parent,_._icon&&(r.removeLayer(_),i||r.addLayer(h))):(_._recalculateBounds(),i&&_._icon||_._updateIcon()),_=_.__parent;delete t.__parent},_isOrIsParent:function(t,e){for(;e;){if(t===e)return!0;e=e.parentNode}return!1},_propagateEvent:function(t){if(t.layer instanceof L.MarkerCluster){if(t.originalEvent&&this._isOrIsParent(t.layer._icon,t.originalEvent.relatedTarget))return;t.type="cluster"+t.type}this.fire(t.type,t)},_defaultIconCreateFunction:function(t){var e=t.getChildCount(),i=" marker-cluster-";return i+=10>e?"small":100>e?"medium":"large",new L.DivIcon({html:"<div><span>"+e+"</span></div>",className:"marker-cluster"+i,iconSize:new L.Point(40,40)})},_bindEvents:function(){var t=this._map,e=this.options.spiderfyOnMaxZoom,i=this.options.showCoverageOnHover,n=this.options.zoomToBoundsOnClick;(e||n)&&this.on("clusterclick",this._zoomOrSpiderfy,this),i&&(this.on("clustermouseover",this._showCoverage,this),this.on("clustermouseout",this._hideCoverage,this),t.on("zoomend",this._hideCoverage,this))},_zoomOrSpiderfy:function(t){var e=this._map;e.getMaxZoom()===e.getZoom()?this.options.spiderfyOnMaxZoom&&t.layer.spiderfy():this.options.zoomToBoundsOnClick&&t.layer.zoomToBounds(),t.originalEvent&&13===t.originalEvent.keyCode&&e._container.focus()},_showCoverage:function(t){var e=this._map;this._inZoomAnimation||(this._shownPolygon&&e.removeLayer(this._shownPolygon),t.layer.getChildCount()>2&&t.layer!==this._spiderfied&&(this._shownPolygon=new L.Polygon(t.layer.getConvexHull(),this.options.polygonOptions),e.addLayer(this._shownPolygon)))},_hideCoverage:function(){this._shownPolygon&&(this._map.removeLayer(this._shownPolygon),this._shownPolygon=null)},_unbindEvents:function(){var t=this.options.spiderfyOnMaxZoom,e=this.options.showCoverageOnHover,i=this.options.zoomToBoundsOnClick,n=this._map;(t||i)&&this.off("clusterclick",this._zoomOrSpiderfy,this),e&&(this.off("clustermouseover",this._showCoverage,this),this.off("clustermouseout",this._hideCoverage,this),n.off("zoomend",this._hideCoverage,this))},_zoomEnd:function(){this._map&&(this._mergeSplitClusters(),this._zoom=this._map._zoom,this._currentShownBounds=this._getExpandedVisibleBounds())},_moveEnd:function(){if(!this._inZoomAnimation){var t=this._getExpandedVisibleBounds();this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds,this._zoom,t),this._topClusterLevel._recursivelyAddChildrenToMap(null,this._map._zoom,t),this._currentShownBounds=t}},_generateInitialClusters:function(){var t=this._map.getMaxZoom(),e=this.options.maxClusterRadius,i=e;"function"!=typeof e&&(i=function(){return e}),this.options.disableClusteringAtZoom&&(t=this.options.disableClusteringAtZoom-1),this._maxZoom=t,this._gridClusters={},this._gridUnclustered={};for(var n=t;n>=0;n--)this._gridClusters[n]=new L.DistanceGrid(i(n)),this._gridUnclustered[n]=new L.DistanceGrid(i(n));this._topClusterLevel=new L.MarkerCluster(this,-1)},_addLayer:function(t,e){var i,n,s=this._gridClusters,r=this._gridUnclustered;for(this.options.singleMarkerMode&&(t.options.icon=this.options.iconCreateFunction({getChildCount:function(){return 1},getAllChildMarkers:function(){return[t]}}));e>=0;e--){i=this._map.project(t.getLatLng(),e);var o=s[e].getNearObject(i);if(o)return o._addChild(t),t.__parent=o,void 0;if(o=r[e].getNearObject(i)){var a=o.__parent;a&&this._removeLayer(o,!1);var h=new L.MarkerCluster(this,e,o,t);s[e].addObject(h,this._map.project(h._cLatLng,e)),o.__parent=h,t.__parent=h;var _=h;for(n=e-1;n>a._zoom;n--)_=new L.MarkerCluster(this,n,_),s[n].addObject(_,this._map.project(o.getLatLng(),n));for(a._addChild(_),n=e;n>=0&&r[n].removeObject(o,this._map.project(o.getLatLng(),n));n--);return}r[e].addObject(t,i)}this._topClusterLevel._addChild(t),t.__parent=this._topClusterLevel},_enqueue:function(t){this._queue.push(t),this._queueTimeout||(this._queueTimeout=setTimeout(L.bind(this._processQueue,this),300))},_processQueue:function(){for(var t=0;t<this._queue.length;t++)this._queue[t].call(this);this._queue.length=0,clearTimeout(this._queueTimeout),this._queueTimeout=null},_mergeSplitClusters:function(){this._processQueue(),this._zoom<this._map._zoom&&this._currentShownBounds.contains(this._getExpandedVisibleBounds())?(this._animationStart(),this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds,this._zoom,this._getExpandedVisibleBounds()),this._animationZoomIn(this._zoom,this._map._zoom)):this._zoom>this._map._zoom?(this._animationStart(),this._animationZoomOut(this._zoom,this._map._zoom)):this._moveEnd()},_getExpandedVisibleBounds:function(){if(!this.options.removeOutsideVisibleBounds)return this.getBounds();var t=this._map,e=t.getBounds(),i=e._southWest,n=e._northEast,s=L.Browser.mobile?0:Math.abs(i.lat-n.lat),r=L.Browser.mobile?0:Math.abs(i.lng-n.lng);return new L.LatLngBounds(new L.LatLng(i.lat-s,i.lng-r,!0),new L.LatLng(n.lat+s,n.lng+r,!0))},_animationAddLayerNonAnimated:function(t,e){if(e===t)this._featureGroup.addLayer(t);else if(2===e._childCount){e._addToMap();var i=e.getAllChildMarkers();this._featureGroup.removeLayer(i[0]),this._featureGroup.removeLayer(i[1])}else e._updateIcon()}}),L.MarkerClusterGroup.include(L.DomUtil.TRANSITION?{_animationStart:function(){this._map._mapPane.className+=" leaflet-cluster-anim",this._inZoomAnimation++},_animationEnd:function(){this._map&&(this._map._mapPane.className=this._map._mapPane.className.replace(" leaflet-cluster-anim","")),this._inZoomAnimation--,this.fire("animationend")},_animationZoomIn:function(t,e){var i,n=this._getExpandedVisibleBounds(),s=this._featureGroup;this._topClusterLevel._recursively(n,t,0,function(r){var o,a=r._latlng,h=r._markers;for(n.contains(a)||(a=null),r._isSingleParent()&&t+1===e?(s.removeLayer(r),r._recursivelyAddChildrenToMap(null,e,n)):(r.setOpacity(0),r._recursivelyAddChildrenToMap(a,e,n)),i=h.length-1;i>=0;i--)o=h[i],n.contains(o._latlng)||s.removeLayer(o)}),this._forceLayout(),this._topClusterLevel._recursivelyBecomeVisible(n,e),s.eachLayer(function(t){t instanceof L.MarkerCluster||!t._icon||t.setOpacity(1)}),this._topClusterLevel._recursively(n,t,e,function(t){t._recursivelyRestoreChildPositions(e)}),this._enqueue(function(){this._topClusterLevel._recursively(n,t,0,function(t){s.removeLayer(t),t.setOpacity(1)}),this._animationEnd()})},_animationZoomOut:function(t,e){this._animationZoomOutSingle(this._topClusterLevel,t-1,e),this._topClusterLevel._recursivelyAddChildrenToMap(null,e,this._getExpandedVisibleBounds()),this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds,t,this._getExpandedVisibleBounds())},_animationZoomOutSingle:function(t,e,i){var n=this._getExpandedVisibleBounds();t._recursivelyAnimateChildrenInAndAddSelfToMap(n,e+1,i);var s=this;this._forceLayout(),t._recursivelyBecomeVisible(n,i),this._enqueue(function(){if(1===t._childCount){var r=t._markers[0];r.setLatLng(r.getLatLng()),r.setOpacity&&r.setOpacity(1)}else t._recursively(n,i,0,function(t){t._recursivelyRemoveChildrenFromMap(n,e+1)});s._animationEnd()})},_animationAddLayer:function(t,e){var i=this,n=this._featureGroup;n.addLayer(t),e!==t&&(e._childCount>2?(e._updateIcon(),this._forceLayout(),this._animationStart(),t._setPos(this._map.latLngToLayerPoint(e.getLatLng())),t.setOpacity(0),this._enqueue(function(){n.removeLayer(t),t.setOpacity(1),i._animationEnd()})):(this._forceLayout(),i._animationStart(),i._animationZoomOutSingle(e,this._map.getMaxZoom(),this._map.getZoom())))},_forceLayout:function(){L.Util.falseFn(e.body.offsetWidth)}}:{_animationStart:function(){},_animationZoomIn:function(t,e){this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds,t),this._topClusterLevel._recursivelyAddChildrenToMap(null,e,this._getExpandedVisibleBounds()),this.fire("animationend")},_animationZoomOut:function(t,e){this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds,t),this._topClusterLevel._recursivelyAddChildrenToMap(null,e,this._getExpandedVisibleBounds()),this.fire("animationend")},_animationAddLayer:function(t,e){this._animationAddLayerNonAnimated(t,e)}}),L.markerClusterGroup=function(t){return new L.MarkerClusterGroup(t)},L.MarkerCluster=L.Marker.extend({initialize:function(t,e,i,n){L.Marker.prototype.initialize.call(this,i?i._cLatLng||i.getLatLng():new L.LatLng(0,0),{icon:this}),this._group=t,this._zoom=e,this._markers=[],this._childClusters=[],this._childCount=0,this._iconNeedsUpdate=!0,this._bounds=new L.LatLngBounds,i&&this._addChild(i),n&&this._addChild(n)},getAllChildMarkers:function(t){t=t||[];for(var e=this._childClusters.length-1;e>=0;e--)this._childClusters[e].getAllChildMarkers(t);for(var i=this._markers.length-1;i>=0;i--)t.push(this._markers[i]);return t},getChildCount:function(){return this._childCount},zoomToBounds:function(){for(var t,e=this._childClusters.slice(),i=this._group._map,n=i.getBoundsZoom(this._bounds),s=this._zoom+1,r=i.getZoom();e.length>0&&n>s;){s++;var o=[];for(t=0;t<e.length;t++)o=o.concat(e[t]._childClusters);e=o}n>s?this._group._map.setView(this._latlng,s):r>=n?this._group._map.setView(this._latlng,r+1):this._group._map.fitBounds(this._bounds)},getBounds:function(){var t=new L.LatLngBounds;return t.extend(this._bounds),t},_updateIcon:function(){this._iconNeedsUpdate=!0,this._icon&&this.setIcon(this)},createIcon:function(){return this._iconNeedsUpdate&&(this._iconObj=this._group.options.iconCreateFunction(this),this._iconNeedsUpdate=!1),this._iconObj.createIcon()},createShadow:function(){return this._iconObj.createShadow()},_addChild:function(t,e){this._iconNeedsUpdate=!0,this._expandBounds(t),t instanceof L.MarkerCluster?(e||(this._childClusters.push(t),t.__parent=this),this._childCount+=t._childCount):(e||this._markers.push(t),this._childCount++),this.__parent&&this.__parent._addChild(t,!0)},_expandBounds:function(t){var e,i=t._wLatLng||t._latlng;t instanceof L.MarkerCluster?(this._bounds.extend(t._bounds),e=t._childCount):(this._bounds.extend(i),e=1),this._cLatLng||(this._cLatLng=t._cLatLng||i);var n=this._childCount+e;this._wLatLng?(this._wLatLng.lat=(i.lat*e+this._wLatLng.lat*this._childCount)/n,this._wLatLng.lng=(i.lng*e+this._wLatLng.lng*this._childCount)/n):this._latlng=this._wLatLng=new L.LatLng(i.lat,i.lng)},_addToMap:function(t){t&&(this._backupLatlng=this._latlng,this.setLatLng(t)),this._group._featureGroup.addLayer(this)},_recursivelyAnimateChildrenIn:function(t,e,i){this._recursively(t,0,i-1,function(t){var i,n,s=t._markers;for(i=s.length-1;i>=0;i--)n=s[i],n._icon&&(n._setPos(e),n.setOpacity(0))},function(t){var i,n,s=t._childClusters;for(i=s.length-1;i>=0;i--)n=s[i],n._icon&&(n._setPos(e),n.setOpacity(0))})},_recursivelyAnimateChildrenInAndAddSelfToMap:function(t,e,i){this._recursively(t,i,0,function(n){n._recursivelyAnimateChildrenIn(t,n._group._map.latLngToLayerPoint(n.getLatLng()).round(),e),n._isSingleParent()&&e-1===i?(n.setOpacity(1),n._recursivelyRemoveChildrenFromMap(t,e)):n.setOpacity(0),n._addToMap()})},_recursivelyBecomeVisible:function(t,e){this._recursively(t,0,e,null,function(t){t.setOpacity(1)})},_recursivelyAddChildrenToMap:function(t,e,i){this._recursively(i,-1,e,function(n){if(e!==n._zoom)for(var s=n._markers.length-1;s>=0;s--){var r=n._markers[s];i.contains(r._latlng)&&(t&&(r._backupLatlng=r.getLatLng(),r.setLatLng(t),r.setOpacity&&r.setOpacity(0)),n._group._featureGroup.addLayer(r))}},function(e){e._addToMap(t)})},_recursivelyRestoreChildPositions:function(t){for(var e=this._markers.length-1;e>=0;e--){var i=this._markers[e];i._backupLatlng&&(i.setLatLng(i._backupLatlng),delete i._backupLatlng)}if(t-1===this._zoom)for(var n=this._childClusters.length-1;n>=0;n--)this._childClusters[n]._restorePosition();else for(var s=this._childClusters.length-1;s>=0;s--)this._childClusters[s]._recursivelyRestoreChildPositions(t)},_restorePosition:function(){this._backupLatlng&&(this.setLatLng(this._backupLatlng),delete this._backupLatlng)},_recursivelyRemoveChildrenFromMap:function(t,e,i){var n,s;this._recursively(t,-1,e-1,function(t){for(s=t._markers.length-1;s>=0;s--)n=t._markers[s],i&&i.contains(n._latlng)||(t._group._featureGroup.removeLayer(n),n.setOpacity&&n.setOpacity(1))},function(t){for(s=t._childClusters.length-1;s>=0;s--)n=t._childClusters[s],i&&i.contains(n._latlng)||(t._group._featureGroup.removeLayer(n),n.setOpacity&&n.setOpacity(1))})},_recursively:function(t,e,i,n,s){var r,o,a=this._childClusters,h=this._zoom;if(e>h)for(r=a.length-1;r>=0;r--)o=a[r],t.intersects(o._bounds)&&o._recursively(t,e,i,n,s);else if(n&&n(this),s&&this._zoom===i&&s(this),i>h)for(r=a.length-1;r>=0;r--)o=a[r],t.intersects(o._bounds)&&o._recursively(t,e,i,n,s)},_recalculateBounds:function(){var t,e=this._markers,i=this._childClusters;for(this._bounds=new L.LatLngBounds,delete this._wLatLng,t=e.length-1;t>=0;t--)this._expandBounds(e[t]);for(t=i.length-1;t>=0;t--)this._expandBounds(i[t])},_isSingleParent:function(){return this._childClusters.length>0&&this._childClusters[0]._childCount===this._childCount}}),L.DistanceGrid=function(t){this._cellSize=t,this._sqCellSize=t*t,this._grid={},this._objectPoint={}},L.DistanceGrid.prototype={addObject:function(t,e){var i=this._getCoord(e.x),n=this._getCoord(e.y),s=this._grid,r=s[n]=s[n]||{},o=r[i]=r[i]||[],a=L.Util.stamp(t);this._objectPoint[a]=e,o.push(t)},updateObject:function(t,e){this.removeObject(t),this.addObject(t,e)},removeObject:function(t,e){var i,n,s=this._getCoord(e.x),r=this._getCoord(e.y),o=this._grid,a=o[r]=o[r]||{},h=a[s]=a[s]||[];for(delete this._objectPoint[L.Util.stamp(t)],i=0,n=h.length;n>i;i++)if(h[i]===t)return h.splice(i,1),1===n&&delete a[s],!0},eachObject:function(t,e){var i,n,s,r,o,a,h,_=this._grid;for(i in _){o=_[i];for(n in o)for(a=o[n],s=0,r=a.length;r>s;s++)h=t.call(e,a[s]),h&&(s--,r--)}},getNearObject:function(t){var e,i,n,s,r,o,a,h,_=this._getCoord(t.x),u=this._getCoord(t.y),l=this._objectPoint,d=this._sqCellSize,p=null;for(e=u-1;u+1>=e;e++)if(s=this._grid[e])for(i=_-1;_+1>=i;i++)if(r=s[i])for(n=0,o=r.length;o>n;n++)a=r[n],h=this._sqDist(l[L.Util.stamp(a)],t),d>h&&(d=h,p=a);return p},_getCoord:function(t){return Math.floor(t/this._cellSize)},_sqDist:function(t,e){var i=e.x-t.x,n=e.y-t.y;return i*i+n*n}},function(){L.QuickHull={getDistant:function(t,e){var i=e[1].lat-e[0].lat,n=e[0].lng-e[1].lng;return n*(t.lat-e[0].lat)+i*(t.lng-e[0].lng)},findMostDistantPointFromBaseLine:function(t,e){var i,n,s,r=0,o=null,a=[];for(i=e.length-1;i>=0;i--)n=e[i],s=this.getDistant(n,t),s>0&&(a.push(n),s>r&&(r=s,o=n));return{maxPoint:o,newPoints:a}},buildConvexHull:function(t,e){var i=[],n=this.findMostDistantPointFromBaseLine(t,e);return n.maxPoint?(i=i.concat(this.buildConvexHull([t[0],n.maxPoint],n.newPoints)),i=i.concat(this.buildConvexHull([n.maxPoint,t[1]],n.newPoints))):[t[0]]},getConvexHull:function(t){var e,i=!1,n=!1,s=null,r=null;for(e=t.length-1;e>=0;e--){var o=t[e];(i===!1||o.lat>i)&&(s=o,i=o.lat),(n===!1||o.lat<n)&&(r=o,n=o.lat)}var a=[].concat(this.buildConvexHull([r,s],t),this.buildConvexHull([s,r],t));return a}}}(),L.MarkerCluster.include({getConvexHull:function(){var t,e,i=this.getAllChildMarkers(),n=[];for(e=i.length-1;e>=0;e--)t=i[e].getLatLng(),n.push(t);return L.QuickHull.getConvexHull(n)}}),L.MarkerCluster.include({_2PI:2*Math.PI,_circleFootSeparation:25,_circleStartAngle:Math.PI/6,_spiralFootSeparation:28,_spiralLengthStart:11,_spiralLengthFactor:5,_circleSpiralSwitchover:9,spiderfy:function(){if(this._group._spiderfied!==this&&!this._group._inZoomAnimation){var t,e=this.getAllChildMarkers(),i=this._group,n=i._map,s=n.latLngToLayerPoint(this._latlng);this._group._unspiderfy(),this._group._spiderfied=this,e.length>=this._circleSpiralSwitchover?t=this._generatePointsSpiral(e.length,s):(s.y+=10,t=this._generatePointsCircle(e.length,s)),this._animationSpiderfy(e,t)}},unspiderfy:function(t){this._group._inZoomAnimation||(this._animationUnspiderfy(t),this._group._spiderfied=null)},_generatePointsCircle:function(t,e){var i,n,s=this._group.options.spiderfyDistanceMultiplier*this._circleFootSeparation*(2+t),r=s/this._2PI,o=this._2PI/t,a=[];for(a.length=t,i=t-1;i>=0;i--)n=this._circleStartAngle+i*o,a[i]=new L.Point(e.x+r*Math.cos(n),e.y+r*Math.sin(n))._round();return a},_generatePointsSpiral:function(t,e){var i,n=this._group.options.spiderfyDistanceMultiplier*this._spiralLengthStart,s=this._group.options.spiderfyDistanceMultiplier*this._spiralFootSeparation,r=this._group.options.spiderfyDistanceMultiplier*this._spiralLengthFactor,o=0,a=[];for(a.length=t,i=t-1;i>=0;i--)o+=s/n+5e-4*i,a[i]=new L.Point(e.x+n*Math.cos(o),e.y+n*Math.sin(o))._round(),n+=this._2PI*r/o;return a},_noanimationUnspiderfy:function(){var t,e,i=this._group,n=i._map,s=i._featureGroup,r=this.getAllChildMarkers();for(this.setOpacity(1),e=r.length-1;e>=0;e--)t=r[e],s.removeLayer(t),t._preSpiderfyLatlng&&(t.setLatLng(t._preSpiderfyLatlng),delete t._preSpiderfyLatlng),t.setZIndexOffset&&t.setZIndexOffset(0),t._spiderLeg&&(n.removeLayer(t._spiderLeg),delete t._spiderLeg);i._spiderfied=null}}),L.MarkerCluster.include(L.DomUtil.TRANSITION?{SVG_ANIMATION:function(){return e.createElementNS("http://www.w3.org/2000/svg","animate").toString().indexOf("SVGAnimate")>-1}(),_animationSpiderfy:function(t,i){var n,s,r,o,a=this,h=this._group,_=h._map,u=h._featureGroup,l=_.latLngToLayerPoint(this._latlng);for(n=t.length-1;n>=0;n--)s=t[n],s.setOpacity?(s.setZIndexOffset(1e6),s.setOpacity(0),u.addLayer(s),s._setPos(l)):u.addLayer(s);h._forceLayout(),h._animationStart();var d=L.Path.SVG?0:.3,p=L.Path.SVG_NS;for(n=t.length-1;n>=0;n--)if(o=_.layerPointToLatLng(i[n]),s=t[n],s._preSpiderfyLatlng=s._latlng,s.setLatLng(o),s.setOpacity&&s.setOpacity(1),r=new L.Polyline([a._latlng,o],{weight:1.5,color:"#222",opacity:d}),_.addLayer(r),s._spiderLeg=r,L.Path.SVG&&this.SVG_ANIMATION){var c=r._path.getTotalLength();r._path.setAttribute("stroke-dasharray",c+","+c);var m=e.createElementNS(p,"animate");m.setAttribute("attributeName","stroke-dashoffset"),m.setAttribute("begin","indefinite"),m.setAttribute("from",c),m.setAttribute("to",0),m.setAttribute("dur",.25),r._path.appendChild(m),m.beginElement(),m=e.createElementNS(p,"animate"),m.setAttribute("attributeName","stroke-opacity"),m.setAttribute("attributeName","stroke-opacity"),m.setAttribute("begin","indefinite"),m.setAttribute("from",0),m.setAttribute("to",.5),m.setAttribute("dur",.25),r._path.appendChild(m),m.beginElement()}if(a.setOpacity(.3),L.Path.SVG)for(this._group._forceLayout(),n=t.length-1;n>=0;n--)s=t[n]._spiderLeg,s.options.opacity=.5,s._path.setAttribute("stroke-opacity",.5);setTimeout(function(){h._animationEnd(),h.fire("spiderfied")},200)},_animationUnspiderfy:function(t){var e,i,n,s=this._group,r=s._map,o=s._featureGroup,a=t?r._latLngToNewLayerPoint(this._latlng,t.zoom,t.center):r.latLngToLayerPoint(this._latlng),h=this.getAllChildMarkers(),_=L.Path.SVG&&this.SVG_ANIMATION;for(s._animationStart(),this.setOpacity(1),i=h.length-1;i>=0;i--)e=h[i],e._preSpiderfyLatlng&&(e.setLatLng(e._preSpiderfyLatlng),delete e._preSpiderfyLatlng,e.setOpacity?(e._setPos(a),e.setOpacity(0)):o.removeLayer(e),_&&(n=e._spiderLeg._path.childNodes[0],n.setAttribute("to",n.getAttribute("from")),n.setAttribute("from",0),n.beginElement(),n=e._spiderLeg._path.childNodes[1],n.setAttribute("from",.5),n.setAttribute("to",0),n.setAttribute("stroke-opacity",0),n.beginElement(),e._spiderLeg._path.setAttribute("stroke-opacity",0)));setTimeout(function(){var t=0;for(i=h.length-1;i>=0;i--)e=h[i],e._spiderLeg&&t++;for(i=h.length-1;i>=0;i--)e=h[i],e._spiderLeg&&(e.setOpacity&&(e.setOpacity(1),e.setZIndexOffset(0)),t>1&&o.removeLayer(e),r.removeLayer(e._spiderLeg),delete e._spiderLeg);s._animationEnd()},200)}}:{_animationSpiderfy:function(t,e){var i,n,s,r,o=this._group,a=o._map,h=o._featureGroup;for(i=t.length-1;i>=0;i--)r=a.layerPointToLatLng(e[i]),n=t[i],n._preSpiderfyLatlng=n._latlng,n.setLatLng(r),n.setZIndexOffset&&n.setZIndexOffset(1e6),h.addLayer(n),s=new L.Polyline([this._latlng,r],{weight:1.5,color:"#222"}),a.addLayer(s),n._spiderLeg=s;this.setOpacity(.3),o.fire("spiderfied")},_animationUnspiderfy:function(){this._noanimationUnspiderfy()}}),L.MarkerClusterGroup.include({_spiderfied:null,_spiderfierOnAdd:function(){this._map.on("click",this._unspiderfyWrapper,this),this._map.options.zoomAnimation&&this._map.on("zoomstart",this._unspiderfyZoomStart,this),this._map.on("zoomend",this._noanimationUnspiderfy,this),L.Path.SVG&&!L.Browser.touch&&this._map._initPathRoot()},_spiderfierOnRemove:function(){this._map.off("click",this._unspiderfyWrapper,this),this._map.off("zoomstart",this._unspiderfyZoomStart,this),this._map.off("zoomanim",this._unspiderfyZoomAnim,this),this._unspiderfy()},_unspiderfyZoomStart:function(){this._map&&this._map.on("zoomanim",this._unspiderfyZoomAnim,this)},_unspiderfyZoomAnim:function(t){L.DomUtil.hasClass(this._map._mapPane,"leaflet-touching")||(this._map.off("zoomanim",this._unspiderfyZoomAnim,this),this._unspiderfy(t))},_unspiderfyWrapper:function(){this._unspiderfy()},_unspiderfy:function(t){this._spiderfied&&this._spiderfied.unspiderfy(t)},_noanimationUnspiderfy:function(){this._spiderfied&&this._spiderfied._noanimationUnspiderfy()},_unspiderfyLayer:function(t){t._spiderLeg&&(this._featureGroup.removeLayer(t),t.setOpacity(1),t.setZIndexOffset(0),this._map.removeLayer(t._spiderLeg),delete t._spiderLeg)}})}(window,document);
@@ -1,6 +1,6 @@
1
1
  .leaflet-cluster-anim .leaflet-marker-icon, .leaflet-cluster-anim .leaflet-marker-shadow {
2
- -webkit-transition: -webkit-transform 0.2s ease-out, opacity 0.2s ease-in;
3
- -moz-transition: -moz-transform 0.2s ease-out, opacity 0.2s ease-in;
4
- -o-transition: -o-transform 0.2s ease-out, opacity 0.2s ease-in;
5
- transition: transform 0.2s ease-out, opacity 0.2s ease-in;
6
- }
2
+ -webkit-transition: -webkit-transform 0.3s ease-out, opacity 0.3s ease-in;
3
+ -moz-transition: -moz-transform 0.3s ease-out, opacity 0.3s ease-in;
4
+ -o-transition: -o-transform 0.3s ease-out, opacity 0.3s ease-in;
5
+ transition: transform 0.3s ease-out, opacity 0.3s ease-in;
6
+ }
@@ -1,28 +1,50 @@
1
1
  .marker-cluster-small {
2
2
  background-color: rgba(181, 226, 140, 0.6);
3
- }
3
+ }
4
4
  .marker-cluster-small div {
5
5
  background-color: rgba(110, 204, 57, 0.6);
6
- }
6
+ }
7
7
 
8
8
  .marker-cluster-medium {
9
9
  background-color: rgba(241, 211, 87, 0.6);
10
- }
10
+ }
11
11
  .marker-cluster-medium div {
12
12
  background-color: rgba(240, 194, 12, 0.6);
13
- }
13
+ }
14
14
 
15
15
  .marker-cluster-large {
16
16
  background-color: rgba(253, 156, 115, 0.6);
17
- }
17
+ }
18
18
  .marker-cluster-large div {
19
19
  background-color: rgba(241, 128, 23, 0.6);
20
+ }
21
+
22
+ /* IE 6-8 fallback colors */
23
+ .leaflet-oldie .marker-cluster-small {
24
+ background-color: rgb(181, 226, 140);
25
+ }
26
+ .leaflet-oldie .marker-cluster-small div {
27
+ background-color: rgb(110, 204, 57);
28
+ }
29
+
30
+ .leaflet-oldie .marker-cluster-medium {
31
+ background-color: rgb(241, 211, 87);
32
+ }
33
+ .leaflet-oldie .marker-cluster-medium div {
34
+ background-color: rgb(240, 194, 12);
35
+ }
36
+
37
+ .leaflet-oldie .marker-cluster-large {
38
+ background-color: rgb(253, 156, 115);
39
+ }
40
+ .leaflet-oldie .marker-cluster-large div {
41
+ background-color: rgb(241, 128, 23);
20
42
  }
21
43
 
22
44
  .marker-cluster {
23
45
  background-clip: padding-box;
24
46
  border-radius: 20px;
25
- }
47
+ }
26
48
  .marker-cluster div {
27
49
  width: 30px;
28
50
  height: 30px;
@@ -32,7 +54,7 @@
32
54
  text-align: center;
33
55
  border-radius: 15px;
34
56
  font: 12px "Helvetica Neue", Arial, Helvetica, sans-serif;
35
- }
57
+ }
36
58
  .marker-cluster span {
37
59
  line-height: 30px;
38
- }
60
+ }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: leaflet-markercluster-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-07-23 00:00:00.000000000 Z
12
+ date: 2014-03-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: railties
@@ -41,7 +41,6 @@ files:
41
41
  - vendor/assets/javascripts/leaflet.markercluster.js
42
42
  - vendor/assets/stylesheets/leaflet.markercluster.css
43
43
  - vendor/assets/stylesheets/leaflet.markercluster.default.css
44
- - vendor/assets/stylesheets/leaflet.markercluster.default.ie.css
45
44
  - LICENSE.txt
46
45
  - README.md
47
46
  homepage: https://github.com/scpike/leaflet-markercluster-rails
@@ -1,21 +0,0 @@
1
- /* IE 6-8 fallback colors */
2
- .marker-cluster-small {
3
- background-color: rgb(181, 226, 140);
4
- }
5
- .marker-cluster-small div {
6
- background-color: rgb(110, 204, 57);
7
- }
8
-
9
- .marker-cluster-medium {
10
- background-color: rgb(241, 211, 87);
11
- }
12
- .marker-cluster-medium div {
13
- background-color: rgb(240, 194, 12);
14
- }
15
-
16
- .marker-cluster-large {
17
- background-color: rgb(253, 156, 115);
18
- }
19
- .marker-cluster-large div {
20
- background-color: rgb(241, 128, 23);
21
- }