Update leaflet markercluster to version 1.0.2.

This commit is contained in:
David Molineus
2017-01-27 12:03:48 +01:00
parent 5ca0430872
commit df8851fc8b
8 changed files with 185 additions and 51 deletions

View File

@@ -14,7 +14,7 @@ This package contains following packages:
- [leaflet 1.0.3](http://leafletjs.com)
- [Leaflet-providers 1.1.15](http://leaflet-extras.github.io/leaflet-providers)
- [Leaflet.markercluster 1.0.0](https://github.com/Leaflet/Leaflet.markercluster)
- [Leaflet.markercluster 1.0.2](https://github.com/Leaflet/Leaflet.markercluster)
- [Leaflet-omnivore 0.3.4](https://github.com/mapbox/leaflet-omnivore)
- [Leaflet.loading 0.1.23](https://github.com/ebrelsford/Leaflet.loading)
- [Leaflet.Control.FullScreen 1.4.2](https://github.com/brunob/leaflet.fullscreen)

View File

@@ -3,7 +3,80 @@ Leaflet.markercluster
(all changes without author notice are by [@danzel](https://github.com/danzel))
## Master
## 1.0.2 (2016-01-27)
### Improvements
* Support `layeradd` and `layerremove` events [#647](https://github.com/Leaflet/Leaflet.markercluster/issues/647)
### Bugfixes
* Add support for maps with negative minZoom [#704](https://github.com/Leaflet/Leaflet.markercluster/issues/704)
* Fixed zoomToShowLayer() markers disappearing bug (by [@z3ut](https://github.com/z3ut)) [#739](https://github.com/Leaflet/Leaflet.markercluster/issues/739)
* Fix an issue when opening a popup inside of zoomToShowLayer
* If a marker is moved with an open popup on it, re-open the popup after moving it. [#651](https://github.com/Leaflet/Leaflet.markercluster/issues/651)
## 1.0.1 (2016-01-25)
### Improvements
* Add install and build steps with jake (by [@kazes](https://github.com/kazes)) [#733](https://github.com/Leaflet/Leaflet.markercluster/pull/733)
* Readme improvements (by [@ghybs](https://github.com/ghybs), [@bertyhell](https://github.com/bertyhell)) [#734](https://github.com/Leaflet/Leaflet.markercluster/pull/738), [#734](https://github.com/Leaflet/Leaflet.markercluster/pull/738
* Bump all examples to leaflet 1.0.3
### Bugfixes
* Fixed leaflet 1.0.2 bug where clearLayers would throw an exception (by [@marcianoviereck92](https://github.com/marcianoviereck92)) [#746](https://github.com/Leaflet/Leaflet.markercluster/pull/746)
## 1.0.0 (2016-10-03)
### Improvements
* Compatibility with Leaflet 1.0.0 (by [@danzel](https://githum.com/danzel), [@Eschon](https://github.com/Eschon), [@ghybs](https://github.com/ghybs), [@IvanSanchez](https://github.com/IvanSanchez))
* Support moving markers [#57](https://github.com/Leaflet/Leaflet.markercluster/issues/57)
* chunkedLoading option to keep browser more responsive during larging a load data set [#292](https://github.com/Leaflet/Leaflet.markercluster/issues/292)
* maxClusterRadius can be a function (by [@Schwanksta](https://github.com/Schwanksta)) [#298](https://github.com/Leaflet/Leaflet.markercluster/issues/298)
* Spiderfy without zooming when all markers at same location (by [@rdenniston](https://github.com/rdenniston), [@ghybs](https://github.com/ghybs)) [#415](https://github.com/Leaflet/Leaflet.markercluster/issues/415), [#606](https://github.com/Leaflet/Leaflet.markercluster/issues/606)
* On becoming visible, markers retain their original opacity. (by [@IvanSanchez](https://github.com/IvanSanchez)) [#444](https://github.com/Leaflet/Leaflet.markercluster/issues/444)
* Spiderleg Polyline options (by [@mikeatlas](https://github.com/mikeatlas)) [#466](https://github.com/Leaflet/Leaflet.markercluster/issues/466)
* Extra methods to allow refreshing cluster icons (by [@ghybs](https://github.com/ghybs)) [#564](https://github.com/Leaflet/Leaflet.markercluster/issues/564)
* Ability to disable animations (by [@ghybs](https://github.com/ghybs)) [#578](https://github.com/Leaflet/Leaflet.markercluster/issues/578)
* Optimized performance of bulk addLayers and removeLayers (by [@ghybs](https://github.com/ghybs)) [#584](https://github.com/Leaflet/Leaflet.markercluster/issues/584)
* Replaced spiderfy legs animation from SMIL to CSS transition (by [@ghybs](https://github.com/ghybs)) [#585](https://github.com/Leaflet/Leaflet.markercluster/issues/585)
* Provide more detailed context information on the spiderfied event (by [@evanvosberg](https://github.com/evanvosberg)) [#421](https://github.com/Leaflet/Leaflet.markercluster/issues/421)
* Add unspiderfied event
* Readme updates (by [@ghybs](https://github.com/ghybs), [@tomchadwin](https://github.com/tomchadwin) [@Cyrille37](https://github.com/Cyrille37) [@franckl](https://github.com/franckl) [@mikeatlas](https://github.com/mikeatlas)
[@rdenniston](https://github.com/rdenniston) [@maackle](https://github.com/maackle) [@fureigh](https://github.com/fureigh) [@Wildhoney](https://github.com/Wildhoney) [@Schwanksta](https://github.com/Schwanksta) [@frankrowe](https://github.com/frankrowe))
* Improve adding and removing nested LayerGroups (by [@ghybs](https://github.com/ghybs)) [#624](https://github.com/Leaflet/Leaflet.markercluster/pull/624)
* Add public unspiderfy method (by [@zverev](https://github.com/zverev)) [#617](https://github.com/Leaflet/Leaflet.markercluster/pull/617)
* Optimized performance of bulk add with complex icon create function (by [@mlazowik](https://github.com/mlazowik)) [#697](https://github.com/Leaflet/Leaflet.markercluster/pull/697)
* Remove leaflet from peerDependencies (by [@tyleralves](https://github.com/tyleralves)) [#703](https://github.com/Leaflet/Leaflet.markercluster/pull/703)
* Simplified _recursively (by [@ghybs](https://github.com/ghybs)) [#656](https://github.com/Leaflet/Leaflet.markercluster/pull/656)
### Bugfixes
* Fix getBounds when removeOutsideVisibleBounds: false is set. [#321](https://github.com/Leaflet/Leaflet.markercluster/issues/321)
* Fix zoomToShowLayer fails after initial spiderfy [#286](https://github.com/Leaflet/Leaflet.markercluster/issues/286)
* Fix cluster not disappearing on Android [#344](https://github.com/Leaflet/Leaflet.markercluster/issues/344)
* Fix RemoveLayers() when spiderified (by [@Grsmto](https://github.com/Grsmto)) [#358](https://github.com/Leaflet/Leaflet.markercluster/issues/358)
* Remove lines from map when removing cluster (by [@olive380](https://github.com/olive380)) [#532](https://github.com/Leaflet/Leaflet.markercluster/issues/532)
* Fix getConvexHull when all markers are located at same latitude (by [@olive380](https://github.com/olive380)) [#533](https://github.com/Leaflet/Leaflet.markercluster/issues/533)
* Fix removeLayers when cluster is not on the map (by [@eschon](https://github.com/eschon)) [#556](https://github.com/Leaflet/Leaflet.markercluster/issues/556)
* Improved zoomToShowLayer with callback check (by [@ghybs](https://github.com/ghybs)) [#572](https://github.com/Leaflet/Leaflet.markercluster/issues/572)
* Improved reliability of RefreshSpec test suite for PhantomJS (by [@ghybs](https://github.com/ghybs)) [#577](https://github.com/Leaflet/Leaflet.markercluster/issues/577)
* Corrected effect of removeOutsideVisibleBounds option (by [@ghybs](https://github.com/ghybs)) [#575](https://github.com/Leaflet/Leaflet.markercluster/issues/575)
* Fix getLayer when provided a string [#531](https://github.com/Leaflet/Leaflet.markercluster/issues/531)
* Documentation improvements (by [@ghybs](https://github.com/ghybs)) [#579](https://github.com/Leaflet/Leaflet.markercluster/issues/579)
* Correct _getExpandedVisibleBounds for Max Latitude (by [@ghybs](https://github.com/ghybs)) [#587](https://github.com/Leaflet/Leaflet.markercluster/issues/587)
* Correct unspiderfy vector (by [@ghybs](https://github.com/ghybs)) [#604](https://github.com/Leaflet/Leaflet.markercluster/issues/604)
* Remove "leaflet-cluster-anim" class on map remove while spiderfied (by [@ghybs](https://github.com/ghybs)) [#607](https://github.com/Leaflet/Leaflet.markercluster/issues/607)
* Fix disableClusteringAtZoom maxZoom troubles (by [@OriginalSin](https://github.com/OriginalSin)) [#609](https://github.com/Leaflet/Leaflet.markercluster/issues/609)
* Fix clusters not disappearing when they were near the edge on mobile (by [@ghybs](https://github.com/ghybs)) [#529](https://github.com/Leaflet/Leaflet.markercluster/issues/529)
* Remove leaflet from dependencies (by [@ghybs](https://github.com/ghybs)) [#639](https://github.com/Leaflet/Leaflet.markercluster/issues/639)
* Fix interaction between zoomOrSpiderfy and disableClusteringAtZoom (by [@ghybs](https://github.com/ghybs)) [#633](https://github.com/Leaflet/Leaflet.markercluster/issues/633) [#648](https://github.com/Leaflet/Leaflet.markercluster/issues/648)
##0.4 (2013-12-19)
@@ -16,6 +89,7 @@ Leaflet.markercluster
* Fix some cases zoomToShowLayer wouldn't work (Reported by [@absemetov](https://github.com/absemetov)) [#203](https://github.com/Leaflet/Leaflet.markercluster/issues/203) [#228](https://github.com/Leaflet/Leaflet.markercluster/issues/228) [#286](https://github.com/Leaflet/Leaflet.markercluster/issues/286)
##0.3 (2013-12-18)
### Improvements

View File

@@ -5,6 +5,8 @@ Provides Beautiful Animated Marker Clustering functionality for [Leaflet](http:/
*Requires Leaflet 1.0.0*
![cluster map example](example/map.png)
For a Leaflet 0.7 compatible version, [use the leaflet-0.7 branch](https://github.com/Leaflet/Leaflet.markercluster/tree/leaflet-0.7)<br>
For a Leaflet 0.5 compatible version, [Download b128e950](https://github.com/Leaflet/Leaflet.markercluster/archive/b128e950d8f5d7da5b60bd0aa9a88f6d3dd17c98.zip)<br>
For a Leaflet 0.4 compatible version, [Download the 0.2 release](https://github.com/Leaflet/Leaflet.markercluster/archive/0.2.zip)
@@ -16,6 +18,8 @@ removed link to h1 and indented back 2 spaces all links.
-->
## Table of Contents
* [Using the plugin](#using-the-plugin)
* [Building, testing and linting scripts](#building-testing-and-linting-scripts)
* [Examples](#examples)
* [Usage](#usage)
* [Options](#options)
* [Defaults](#defaults)
@@ -43,9 +47,23 @@ removed link to h1 and indented back 2 spaces all links.
## Using the plugin
Include the plugin CSS and JS files on your page after Leaflet files, using your method of choice:
* [Download the `v1.0.0` release](https://github.com/Leaflet/Leaflet.markercluster/archive/v1.0.0.zip)
* Use unpkg CDN: `https://unpkg.com/leaflet.markercluster@1.0.0/dist/`
* Install with npm: `npm install leaflet.markercluster`
Install with npm: `npm install leaflet.markercluster`
In each case, use files in the `dist` folder:
* `MarkerCluster.css`
* `MarkerCluster.Default.css` (not needed if you use your own `iconCreateFunction` instead of the default one)
* `leaflet.markercluster.js` (or `leaflet.markercluster-src.js` for the non-minified version)
### Building, testing and linting scripts
Install jake `npm install -g jake` then run `npm install`
* To check the code for errors and build Leaflet from source, run `jake`.
* To run the tests, run `jake test`.
* For a custom build, open `build/build.html` in the browser and follow the instructions
### Examples
See the included examples for usage.
The [realworld example](http://leaflet.github.io/Leaflet.markercluster/example/marker-clustering-realworld.388.html) is a good place to start, it uses all of the defaults of the clusterer.

View File

@@ -1,6 +1,6 @@
{
"name": "leaflet.markercluster",
"version": "0.4.0-hotfix.1",
"version": "1.0.2",
"homepage": "https://github.com/Leaflet/Leaflet.markercluster",
"authors": [
"Dave Leaver <danzel@localhost.geek.nz>"
@@ -22,6 +22,6 @@
"tests"
],
"dependencies": {
"leaflet": ">= 0.7.0"
"leaflet": ">= 1.0.3"
}
}

View File

@@ -69,6 +69,12 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
this._queue = [];
this._childMarkerEventHandlers = {
'dragstart': this._childMarkerDragStart,
'move': this._childMarkerMoved,
'dragend': this._childMarkerDragEnd,
};
// Hook the appropriate animation methods.
var animate = L.DomUtil.TRANSITION && this.options.animate;
L.extend(this, animate ? this._withAnimation : this._noAnimation);
@@ -85,11 +91,13 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
//Don't cluster non point data
if (!layer.getLatLng) {
this._nonPointGroup.addLayer(layer);
this.fire('layeradd', { layer: layer });
return this;
}
if (!this._map) {
this._needsClustering.push(layer);
this.fire('layeradd', { layer: layer });
return this;
}
@@ -105,6 +113,7 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
}
this._addLayer(layer, this._maxZoom);
this.fire('layeradd', { layer: layer });
// Refresh bounds and weighted positions.
this._topClusterLevel._recalculateBounds();
@@ -139,6 +148,7 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
//Non point layers
if (!layer.getLatLng) {
this._nonPointGroup.removeLayer(layer);
this.fire('layerremove', { layer: layer });
return this;
}
@@ -146,6 +156,7 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
if (!this._arraySplice(this._needsClustering, layer) && this.hasLayer(layer)) {
this._needsRemoving.push(layer);
}
this.fire('layerremove', { layer: layer });
return this;
}
@@ -160,13 +171,14 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
//Remove the marker from clusters
this._removeLayer(layer, true);
this.fire('layerremove', { layer: layer });
// Refresh bounds and weighted positions.
this._topClusterLevel._recalculateBounds();
this._refreshClustersIcons();
layer.off('move', this._childMarkerMoved, this);
layer.off(this._childMarkerEventHandlers, this);
if (this._featureGroup.hasLayer(layer)) {
this._featureGroup.removeLayer(layer);
@@ -179,7 +191,7 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
},
//Takes an array of markers and adds them in bulk
addLayers: function (layersArray) {
addLayers: function (layersArray, skipLayerAddEvent) {
if (!L.Util.isArray(layersArray)) {
return this.addLayer(layersArray);
}
@@ -228,6 +240,9 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
//Not point data, can't be clustered
if (!m.getLatLng) {
npg.addLayer(m);
if (!skipLayerAddEvent) {
this.fire('layeradd', { layer: m });
}
continue;
}
@@ -236,6 +251,9 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
}
this._addLayer(m, this._maxZoom);
if (!skipLayerAddEvent) {
this.fire('layeradd', { layer: m });
}
//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
if (m.__parent) {
@@ -328,6 +346,7 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
if (this.hasLayer(m)) {
this._needsRemoving.push(m);
}
this.fire('layerremove', { layer: m });
}
return this;
}
@@ -368,10 +387,12 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
if (!m.__parent) {
npg.removeLayer(m);
this.fire('layerremove', { layer: m });
continue;
}
this._removeLayer(m, true, true);
this.fire('layerremove', { layer: m });
if (fg.hasLayer(m)) {
fg.removeLayer(m);
@@ -412,9 +433,9 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
this._nonPointGroup.clearLayers();
this.eachLayer(function (marker) {
marker.off('move', this._childMarkerMoved, this);
marker.off(this._childMarkerEventHandlers, this);
delete marker.__parent;
});
}, this);
if (this._map) {
//Reset _topClusterLevel and the DistanceGrids
@@ -537,20 +558,9 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
this._map.on('moveend', showMarker, this);
this._map.panTo(layer.getLatLng());
} else {
var moveStart = function () {
this._map.off('movestart', moveStart, this);
moveStart = null;
};
this._map.on('movestart', moveStart, this);
this._map.on('moveend', showMarker, this);
this.on('animationend', showMarker, this);
layer.__parent.zoomToBounds();
if (moveStart) {
//Never started moving, must already be there, probably need clustering however
showMarker.call(this);
}
}
},
@@ -594,7 +604,7 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
//Actually add our markers to the map:
l = this._needsClustering;
this._needsClustering = [];
this.addLayers(l);
this.addLayers(l, true);
},
//Overrides FeatureGroup.onRemove
@@ -648,33 +658,57 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
* @private
*/
_removeFromGridUnclustered: function (marker, z) {
var map = this._map,
gridUnclustered = this._gridUnclustered;
var map = this._map,
gridUnclustered = this._gridUnclustered,
minZoom = this._map.getMinZoom();
for (; z >= 0; z--) {
for (; z >= minZoom; z--) {
if (!gridUnclustered[z].removeObject(marker, map.project(marker.getLatLng(), z))) {
break;
}
}
},
_childMarkerMoved: function (e) {
if (!this._ignoreMove) {
e.target._latlng = e.oldLatLng;
this.removeLayer(e.target);
_childMarkerDragStart: function (e) {
e.target.__dragStart = e.target._latlng;
},
e.target._latlng = e.latlng;
this.addLayer(e.target);
_childMarkerMoved: function (e) {
if (!this._ignoreMove && !e.target.__dragStart) {
var isPopupOpen = e.target._popup && e.target._popup.isOpen();
this._moveChild(e.target, e.oldLatLng, e.latlng);
if (isPopupOpen) {
e.target.openPopup();
}
}
},
_moveChild: function (layer, from, to) {
layer._latlng = from;
this.removeLayer(layer);
layer._latlng = to;
this.addLayer(layer);
},
_childMarkerDragEnd: function (e) {
if (e.target.__dragStart) {
this._moveChild(e.target, e.target.__dragStart, e.target._latlng);
}
delete e.target.__dragStart;
},
//Internal function for removing a marker from everything.
//dontUpdateMap: set to true if you will handle updating the map manually (for bulk functions)
_removeLayer: function (marker, removeFromDistanceGrid, dontUpdateMap) {
var gridClusters = this._gridClusters,
gridUnclustered = this._gridUnclustered,
fg = this._featureGroup,
map = this._map;
map = this._map,
minZoom = this._map.getMinZoom();
//Remove the marker from distance clusters it might be in
if (removeFromDistanceGrid) {
@@ -693,7 +727,7 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
cluster._childCount--;
cluster._boundsNeedUpdate = true;
if (cluster._zoom < 0) {
if (cluster._zoom < minZoom) {
//Top level, do nothing
break;
} else if (removeFromDistanceGrid && cluster._childCount <= 1) { //Cluster no longer required
@@ -876,6 +910,7 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
_generateInitialClusters: function () {
var maxZoom = this._map.getMaxZoom(),
minZoom = this._map.getMinZoom(),
radius = this.options.maxClusterRadius,
radiusFn = radius;
@@ -894,29 +929,30 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
this._gridUnclustered = {};
//Set up DistanceGrids for each zoom
for (var zoom = maxZoom; zoom >= 0; zoom--) {
for (var zoom = maxZoom; zoom >= minZoom; zoom--) {
this._gridClusters[zoom] = new L.DistanceGrid(radiusFn(zoom));
this._gridUnclustered[zoom] = new L.DistanceGrid(radiusFn(zoom));
}
// Instantiate the appropriate L.MarkerCluster class (animated or not).
this._topClusterLevel = new this._markerCluster(this, -1);
this._topClusterLevel = new this._markerCluster(this, minZoom - 1);
},
//Zoom: Zoom to start adding at (Pass this._maxZoom to start at the bottom)
_addLayer: function (layer, zoom) {
var gridClusters = this._gridClusters,
gridUnclustered = this._gridUnclustered,
minZoom = this._map.getMinZoom(),
markerPoint, z;
if (this.options.singleMarkerMode) {
this._overrideMarkerIcon(layer);
}
layer.on('move', this._childMarkerMoved, this);
layer.on(this._childMarkerEventHandlers, this);
//Find the lowest zoom level to slot this one in
for (; zoom >= 0; zoom--) {
for (; zoom >= minZoom; zoom--) {
markerPoint = this._map.project(layer.getLatLng(), zoom); // calculate pixel position
//Try find a cluster close by
@@ -1156,13 +1192,14 @@ L.MarkerClusterGroup.include({
_animationZoomIn: function (previousZoomLevel, newZoomLevel) {
var bounds = this._getExpandedVisibleBounds(),
fg = this._featureGroup,
fg = this._featureGroup,
minZoom = this._map.getMinZoom(),
i;
this._ignoreMove = true;
//Add all children of current clusters to map and remove those clusters from map
this._topClusterLevel._recursively(bounds, previousZoomLevel, 0, function (c) {
this._topClusterLevel._recursively(bounds, previousZoomLevel, minZoom, function (c) {
var startPos = c._latlng,
markers = c._markers,
m;
@@ -1212,7 +1249,7 @@ L.MarkerClusterGroup.include({
//Remove the old clusters and close the zoom animation
this._enqueue(function () {
//update the positions of the just added clusters/markers
this._topClusterLevel._recursively(bounds, previousZoomLevel, 0, function (c) {
this._topClusterLevel._recursively(bounds, previousZoomLevel, minZoom, function (c) {
fg.removeLayer(c);
c.clusterShow();
});
@@ -1264,7 +1301,8 @@ L.MarkerClusterGroup.include({
// Private methods for animated versions.
_animationZoomOutSingle: function (cluster, previousZoomLevel, newZoomLevel) {
var bounds = this._getExpandedVisibleBounds();
var bounds = this._getExpandedVisibleBounds(),
minZoom = this._map.getMinZoom();
//Animate all of the markers in the clusters to move to their cluster center point
cluster._recursivelyAnimateChildrenInAndAddSelfToMap(bounds, previousZoomLevel + 1, newZoomLevel);
@@ -1290,7 +1328,7 @@ L.MarkerClusterGroup.include({
m.clusterShow();
}
} else {
cluster._recursively(bounds, newZoomLevel, 0, function (c) {
cluster._recursively(bounds, newZoomLevel, minZoom, function (c) {
c._recursivelyRemoveChildrenFromMap(bounds, previousZoomLevel + 1);
});
}
@@ -1536,7 +1574,7 @@ L.MarkerCluster = L.Marker.extend({
},
_recursivelyAnimateChildrenIn: function (bounds, center, maxZoom) {
this._recursively(bounds, 0, maxZoom - 1,
this._recursively(bounds, this._group._map.getMinZoom(), maxZoom - 1,
function (c) {
var markers = c._markers,
i, m;
@@ -1565,7 +1603,7 @@ L.MarkerCluster = L.Marker.extend({
},
_recursivelyAnimateChildrenInAndAddSelfToMap: function (bounds, previousZoomLevel, newZoomLevel) {
this._recursively(bounds, newZoomLevel, 0,
this._recursively(bounds, newZoomLevel, this._group._map.getMinZoom(),
function (c) {
c._recursivelyAnimateChildrenIn(bounds, c._group._map.latLngToLayerPoint(c.getLatLng()).round(), previousZoomLevel);
@@ -1584,13 +1622,13 @@ L.MarkerCluster = L.Marker.extend({
},
_recursivelyBecomeVisible: function (bounds, zoomLevel) {
this._recursively(bounds, 0, zoomLevel, null, function (c) {
this._recursively(bounds, this._group._map.getMinZoom(), zoomLevel, null, function (c) {
c.clusterShow();
});
},
_recursivelyAddChildrenToMap: function (startPos, zoomLevel, bounds) {
this._recursively(bounds, -1, zoomLevel,
this._recursively(bounds, this._group._map.getMinZoom() - 1, zoomLevel,
function (c) {
if (zoomLevel === c._zoom) {
return;
@@ -1654,7 +1692,7 @@ L.MarkerCluster = L.Marker.extend({
//exceptBounds: If set, don't remove any markers/clusters in it
_recursivelyRemoveChildrenFromMap: function (previousBounds, zoomLevel, exceptBounds) {
var m, i;
this._recursively(previousBounds, -1, zoomLevel - 1,
this._recursively(previousBounds, this._group._map.getMinZoom() - 1, zoomLevel - 1,
function (c) {
//Remove markers at every level
for (i = c._markers.length - 1; i >= 0; i--) {
@@ -2336,6 +2374,9 @@ L.MarkerCluster.include({
continue;
}
//Close any popup on the marker first, otherwise setting the location of the marker will make the map scroll
m.closePopup();
//Fix up the location to the real one
m.setLatLng(m._preSpiderfyLatlng);
delete m._preSpiderfyLatlng;

File diff suppressed because one or more lines are too long

View File

@@ -1,7 +1,7 @@
{
"name": "leaflet.markercluster",
"repository": "https://github.com/Leaflet/Leaflet.markercluster",
"version": "1.0.0",
"version": "1.0.2",
"description": "Provides Beautiful Animated Marker Clustering functionality for Leaflet",
"devDependencies": {
"jshint": "~2.1.3",
@@ -10,7 +10,7 @@
"uglify-js": "~2.3.6",
"jake": "~0.5.16",
"magic-string": "^0.7.0",
"leaflet": "~1.0.0-rc.1"
"leaflet": "~1.0.3"
},
"main": "dist/leaflet.markercluster.js",
"scripts": {

View File

@@ -36,7 +36,7 @@ $GLOBALS['LEAFLET_LIBRARIES']['leaflet-providers'] = array
$GLOBALS['LEAFLET_LIBRARIES']['leaflet-markercluster'] = array
(
'name' => 'Leaflet.markercluster',
'version' => '1.0.0',
'version' => '1.0.2',
'license' => '<a href="https://github.com/Leaflet/Leaflet.markercluster/blob/master/MIT-LICENCE.txt" target="_blank">MIT</a>',
'homepage' => 'https://github.com/Leaflet/Leaflet.markercluster',
'css' => 'assets/leaflet/libs/leaflet-markercluster/MarkerCluster.css',