mirror of
https://github.com/netzmacht/contao-leaflet-libraries.git
synced 2025-11-28 11:04:07 +01:00
Update to marker cluster version 1.0.6.
This commit is contained in:
@@ -14,7 +14,7 @@ This package contains following packages:
|
||||
|
||||
- [leaflet 1.1.0](http://leafletjs.com)
|
||||
- [Leaflet-providers 1.1.15](http://leaflet-extras.github.io/leaflet-providers)
|
||||
- [Leaflet.markercluster 1.0.2](https://github.com/Leaflet/Leaflet.markercluster)
|
||||
- [Leaflet.markercluster 1.0.6](https://github.com/Leaflet/Leaflet.markercluster)
|
||||
- [Leaflet-omnivore 0.3.4](https://github.com/mapbox/leaflet-omnivore)
|
||||
- [Leaflet.loading 0.1.24](https://github.com/ebrelsford/Leaflet.loading)
|
||||
- [Leaflet.Control.FullScreen 1.4.3](https://github.com/brunob/leaflet.fullscreen)
|
||||
|
||||
@@ -3,7 +3,36 @@ Leaflet.markercluster
|
||||
|
||||
(all changes without author notice are by [@danzel](https://github.com/danzel))
|
||||
|
||||
## 1.0.2 (2016-01-27)
|
||||
## 1.0.6 (2017-06-19)
|
||||
|
||||
### Bugfixes
|
||||
|
||||
* Fix some issues when used with non-integer zoom [#789](https://github.com/Leaflet/Leaflet.markercluster/issues/789)
|
||||
* Change examples to use https (by [@ghybs](https://github.com/ghybs)) [#794](https://github.com/Leaflet/Leaflet.markercluster/pull/794)
|
||||
|
||||
## 1.0.5 (2017-04-26)
|
||||
|
||||
### Improvements
|
||||
|
||||
* Allow passing fitBounds options to zoomToBounds (by [@timkelty](https://github.com/timkelty)) [#779](https://github.com/Leaflet/Leaflet.markercluster/pull/779)
|
||||
|
||||
### Bugfixes
|
||||
|
||||
* Fixed bug where disableClusteringAtZoom being 0 is treated the same as null (by [@MrCheeze](https://github.com/MrCheeze)) [#773](https://github.com/Leaflet/Leaflet.markercluster/pull/773)
|
||||
|
||||
## 1.0.4 (2017-03-14)
|
||||
|
||||
### Bugfixes
|
||||
|
||||
* Fix errors removing a MarkerClusterGroup from the map during an animation [#758](https://github.com/Leaflet/Leaflet.markercluster/issues/758)
|
||||
|
||||
## 1.0.3 (2017-02-02)
|
||||
|
||||
### Bugfixes
|
||||
|
||||
* Fix moving markers while the MarkerClusterGroup is not on the map [#753](https://github.com/Leaflet/Leaflet.markercluster/issues/753)
|
||||
|
||||
## 1.0.2 (2017-01-27)
|
||||
|
||||
### Improvements
|
||||
|
||||
@@ -17,7 +46,7 @@ Leaflet.markercluster
|
||||
* 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)
|
||||
## 1.0.1 (2017-01-25)
|
||||
|
||||
### Improvements
|
||||
|
||||
@@ -78,7 +107,7 @@ Leaflet.markercluster
|
||||
* 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)
|
||||
## 0.4 (2013-12-19)
|
||||
|
||||
### Improvements
|
||||
|
||||
@@ -90,7 +119,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)
|
||||
## 0.3 (2013-12-18)
|
||||
|
||||
### Improvements
|
||||
|
||||
|
||||
@@ -48,8 +48,8 @@ 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/`
|
||||
* [Download the `v1.0.6` release](https://github.com/Leaflet/Leaflet.markercluster/archive/v1.0.6.zip)
|
||||
* Use unpkg CDN: `https://unpkg.com/leaflet.markercluster@1.0.6/dist/`
|
||||
* Install with npm: `npm install leaflet.markercluster`
|
||||
|
||||
In each case, use files in the `dist` folder:
|
||||
@@ -61,13 +61,12 @@ In each case, use files in the `dist` folder:
|
||||
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.
|
||||
Or check out the [custom example](http://leaflet.github.io/Leaflet.markercluster/example/marker-clustering-custom.html) for how to customise the behaviour and appearance of the clusterer
|
||||
The [realworld example](https://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.
|
||||
Or check out the [custom example](https://leaflet.github.io/Leaflet.markercluster/example/marker-clustering-custom.html) for how to customise the behaviour and appearance of the clusterer
|
||||
|
||||
### Usage
|
||||
Create a new MarkerClusterGroup, add your markers to it, then add it to the map
|
||||
@@ -110,7 +109,7 @@ var markers = L.markerClusterGroup({
|
||||
}
|
||||
});
|
||||
```
|
||||
Check out the [custom example](http://leaflet.github.io/Leaflet.markercluster/example/marker-clustering-custom.html) for an example of this.
|
||||
Check out the [custom example](https://leaflet.github.io/Leaflet.markercluster/example/marker-clustering-custom.html) for an example of this.
|
||||
|
||||
If you need to update the clusters icon (e.g. they are based on markers real-time data), use the method [refreshClusters()](#refreshing-the-clusters-icon).
|
||||
|
||||
@@ -124,7 +123,7 @@ If you need to update the clusters icon (e.g. they are based on markers real-tim
|
||||
|
||||
#### Other options
|
||||
* **animateAddingMarkers**: If set to true (and `animate` option is also true) then adding individual markers to the MarkerClusterGroup after it has been added to the map will add the marker and animate it into the cluster. Defaults to false as this gives better performance when bulk adding markers. addLayers does not support this, only addLayer with individual Markers.
|
||||
* **disableClusteringAtZoom**: If set, at this zoom level and below, markers will not be clustered. This defaults to disabled. [See Example](http://leaflet.github.io/Leaflet.markercluster/example/marker-clustering-realworld-maxzoom.388.html). Note: you may be interested in disabling `spiderfyOnMaxZoom` option when using `disableClusteringAtZoom`.
|
||||
* **disableClusteringAtZoom**: If set, at this zoom level and below, markers will not be clustered. This defaults to disabled. [See Example](https://leaflet.github.io/Leaflet.markercluster/example/marker-clustering-realworld-maxzoom.388.html). Note: you may be interested in disabling `spiderfyOnMaxZoom` option when using `disableClusteringAtZoom`.
|
||||
* **maxClusterRadius**: The maximum radius that a cluster will cover from the central marker (in pixels). Default 80. Decreasing will make more, smaller clusters. You can also use a function that accepts the current map zoom and returns the maximum cluster radius in pixels.
|
||||
* **polygonOptions**: Options to pass when creating the L.Polygon(points, options) to show the bounds of a cluster. Defaults to empty, which lets Leaflet use the [default Path options](http://leafletjs.com/reference.html#path-options).
|
||||
* **singleMarkerMode**: If set to true, overrides the icon for all added markers to make them appear as a 1 size cluster. Note: the markers are not replaced by cluster objects, only their icon is replaced. Hence they still react to normal events, and option `disableClusteringAtZoom` does not restore their previous icon (see [#391](https://github.com/Leaflet/Leaflet.markercluster/issues/391)).
|
||||
@@ -235,7 +234,7 @@ markers.on('clusterclick', function (a) {
|
||||
```
|
||||
|
||||
You can also query for the bounding convex polygon.
|
||||
See [example/marker-clustering-convexhull.html](http://leaflet.github.io/Leaflet.markercluster/example/marker-clustering-convexhull.html) for a working example.
|
||||
See [example/marker-clustering-convexhull.html](https://leaflet.github.io/Leaflet.markercluster/example/marker-clustering-convexhull.html) for a working example.
|
||||
```javascript
|
||||
markers.on('clusterclick', function (a) {
|
||||
map.addLayer(L.polygon(a.layer.getConvexHull()));
|
||||
@@ -245,10 +244,12 @@ markers.on('clusterclick', function (a) {
|
||||
#### Zooming to the bounds of a cluster
|
||||
When you receive an event from a cluster you can zoom to its bounds in one easy step.
|
||||
If all of the markers will appear at a higher zoom level, that zoom level is zoomed to instead.
|
||||
See [marker-clustering-zoomtobounds.html](http://leaflet.github.io/Leaflet.markercluster/example/marker-clustering-zoomtobounds.html) for a working example.
|
||||
`zoomToBounds` takes an optional argument to pass [options to the resulting `fitBounds` call](http://leafletjs.com/reference.html#map-fitboundsoptions).
|
||||
|
||||
See [marker-clustering-zoomtobounds.html](https://leaflet.github.io/Leaflet.markercluster/example/marker-clustering-zoomtobounds.html) for a working example.
|
||||
```javascript
|
||||
markers.on('clusterclick', function (a) {
|
||||
a.layer.zoomToBounds();
|
||||
a.layer.zoomToBounds({padding: [20, 20]});
|
||||
});
|
||||
```
|
||||
|
||||
@@ -260,8 +261,8 @@ markers.on('clusterclick', function (a) {
|
||||
|
||||
## Handling LOTS of markers
|
||||
The Clusterer can handle 10,000 or even 50,000 markers (in chrome). IE9 has some issues with 50,000.
|
||||
- [realworld 10,000 example](http://leaflet.github.io/Leaflet.markercluster/example/marker-clustering-realworld.10000.html)
|
||||
- [realworld 50,000 example](http://leaflet.github.io/Leaflet.markercluster/example/marker-clustering-realworld.50000.html)
|
||||
- [realworld 10,000 example](https://leaflet.github.io/Leaflet.markercluster/example/marker-clustering-realworld.10000.html)
|
||||
- [realworld 50,000 example](https://leaflet.github.io/Leaflet.markercluster/example/marker-clustering-realworld.50000.html)
|
||||
|
||||
Note: these two examples use the `chunkedLoading` option set to true in order to avoid locking the browser for a long time.
|
||||
|
||||
@@ -286,3 +287,4 @@ Check also the below sub-plugins:
|
||||
| [Leaflet.FeatureGroup.SubGroup](https://github.com/ghybs/Leaflet.FeatureGroup.SubGroup) | Creates a Feature Group that adds its child layers into a parent group when added to a map (e.g. through L.Control.Layers). Typical usage is to dynamically add/remove groups of markers from Marker Cluster. | [ghybs](https://github.com/ghybs) |
|
||||
| [Leaflet.MarkerCluster.LayerSupport](https://github.com/ghybs/Leaflet.MarkerCluster.LayerSupport) | Brings compatibility with L.Control.Layers and other Leaflet plugins. I.e. everything that uses direct calls to map.addLayer and map.removeLayer. | [ghybs](https://github.com/ghybs) |
|
||||
| [Leaflet.MarkerCluster.Freezable](https://github.com/ghybs/Leaflet.MarkerCluster.Freezable) | Adds the ability to freeze clusters at a specified zoom. E.g. freezing at maxZoom + 1 makes as if clustering was programmatically disabled. | [ghybs](https://github.com/ghybs) |
|
||||
| [Leaflet.MarkerCluster.PlacementStrategies](https://github.com/adammertel/Leaflet.MarkerCluster.PlacementStrategies) | Implements new strategies to position clustered markers (eg: clock, concentric circles, ...). Recommended to use with circleMarkers. [Demo](https://adammertel.github.io/Leaflet.MarkerCluster.PlacementStrategies/demo/demo1.html) | [adammertel](https://github.com/adammertel) / [UNIVIE](http://carto.univie.ac.at/) |
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "leaflet.markercluster",
|
||||
"version": "1.0.2",
|
||||
"version": "1.0.6",
|
||||
"homepage": "https://github.com/Leaflet/Leaflet.markercluster",
|
||||
"authors": [
|
||||
"Dave Leaver <danzel@localhost.geek.nz>"
|
||||
|
||||
@@ -154,7 +154,7 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
|
||||
|
||||
if (!this._map) {
|
||||
if (!this._arraySplice(this._needsClustering, layer) && this.hasLayer(layer)) {
|
||||
this._needsRemoving.push(layer);
|
||||
this._needsRemoving.push({ layer: layer, latlng: layer._latlng });
|
||||
}
|
||||
this.fire('layerremove', { layer: layer });
|
||||
return this;
|
||||
@@ -344,7 +344,7 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
|
||||
this._arraySplice(this._needsClustering, m);
|
||||
npg.removeLayer(m);
|
||||
if (this.hasLayer(m)) {
|
||||
this._needsRemoving.push(m);
|
||||
this._needsRemoving.push({ layer: m, latlng: m._latlng });
|
||||
}
|
||||
this.fire('layerremove', { layer: m });
|
||||
}
|
||||
@@ -466,14 +466,23 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
|
||||
eachLayer: function (method, context) {
|
||||
var markers = this._needsClustering.slice(),
|
||||
needsRemoving = this._needsRemoving,
|
||||
i;
|
||||
thisNeedsRemoving, i, j;
|
||||
|
||||
if (this._topClusterLevel) {
|
||||
this._topClusterLevel.getAllChildMarkers(markers);
|
||||
}
|
||||
|
||||
for (i = markers.length - 1; i >= 0; i--) {
|
||||
if (needsRemoving.indexOf(markers[i]) === -1) {
|
||||
thisNeedsRemoving = true;
|
||||
|
||||
for (j = needsRemoving.length - 1; j >= 0; j--) {
|
||||
if (needsRemoving[j].layer === markers[i]) {
|
||||
thisNeedsRemoving = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (thisNeedsRemoving) {
|
||||
method.call(context, markers[i]);
|
||||
}
|
||||
}
|
||||
@@ -521,7 +530,7 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
|
||||
|
||||
anArray = this._needsRemoving;
|
||||
for (i = anArray.length - 1; i >= 0; i--) {
|
||||
if (anArray[i] === layer) {
|
||||
if (anArray[i].layer === layer) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -582,9 +591,17 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
|
||||
|
||||
this._maxLat = map.options.crs.projection.MAX_LATITUDE;
|
||||
|
||||
//Restore all the positions as they are in the MCG before removing them
|
||||
for (i = 0, l = this._needsRemoving.length; i < l; i++) {
|
||||
layer = this._needsRemoving[i];
|
||||
this._removeLayer(layer, true);
|
||||
layer.newlatlng = layer.layer._latlng;
|
||||
layer.layer._latlng = layer.latlng;
|
||||
}
|
||||
//Remove them, then restore their new positions
|
||||
for (i = 0, l = this._needsRemoving.length; i < l; i++) {
|
||||
layer = this._needsRemoving[i];
|
||||
this._removeLayer(layer.layer, true);
|
||||
layer.layer._latlng = layer.newlatlng;
|
||||
}
|
||||
this._needsRemoving = [];
|
||||
|
||||
@@ -660,7 +677,7 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
|
||||
_removeFromGridUnclustered: function (marker, z) {
|
||||
var map = this._map,
|
||||
gridUnclustered = this._gridUnclustered,
|
||||
minZoom = this._map.getMinZoom();
|
||||
minZoom = Math.floor(this._map.getMinZoom());
|
||||
|
||||
for (; z >= minZoom; z--) {
|
||||
if (!gridUnclustered[z].removeObject(marker, map.project(marker.getLatLng(), z))) {
|
||||
@@ -708,7 +725,7 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
|
||||
gridUnclustered = this._gridUnclustered,
|
||||
fg = this._featureGroup,
|
||||
map = this._map,
|
||||
minZoom = this._map.getMinZoom();
|
||||
minZoom = Math.floor(this._map.getMinZoom());
|
||||
|
||||
//Remove the marker from distance clusters it might be in
|
||||
if (removeFromDistanceGrid) {
|
||||
@@ -901,7 +918,7 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
|
||||
|
||||
var newBounds = this._getExpandedVisibleBounds();
|
||||
|
||||
this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds, this._zoom, newBounds);
|
||||
this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds, Math.floor(this._map.getMinZoom()), this._zoom, newBounds);
|
||||
this._topClusterLevel._recursivelyAddChildrenToMap(null, Math.round(this._map._zoom), newBounds);
|
||||
|
||||
this._currentShownBounds = newBounds;
|
||||
@@ -909,8 +926,8 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
|
||||
},
|
||||
|
||||
_generateInitialClusters: function () {
|
||||
var maxZoom = this._map.getMaxZoom(),
|
||||
minZoom = this._map.getMinZoom(),
|
||||
var maxZoom = Math.ceil(this._map.getMaxZoom()),
|
||||
minZoom = Math.floor(this._map.getMinZoom()),
|
||||
radius = this.options.maxClusterRadius,
|
||||
radiusFn = radius;
|
||||
|
||||
@@ -921,7 +938,7 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
|
||||
radiusFn = function () { return radius; };
|
||||
}
|
||||
|
||||
if (this.options.disableClusteringAtZoom) {
|
||||
if (this.options.disableClusteringAtZoom !== null) {
|
||||
maxZoom = this.options.disableClusteringAtZoom - 1;
|
||||
}
|
||||
this._maxZoom = maxZoom;
|
||||
@@ -942,7 +959,7 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
|
||||
_addLayer: function (layer, zoom) {
|
||||
var gridClusters = this._gridClusters,
|
||||
gridUnclustered = this._gridUnclustered,
|
||||
minZoom = this._map.getMinZoom(),
|
||||
minZoom = Math.floor(this._map.getMinZoom()),
|
||||
markerPoint, z;
|
||||
|
||||
if (this.options.singleMarkerMode) {
|
||||
@@ -1041,7 +1058,7 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
|
||||
if (this._zoom < mapZoom && this._currentShownBounds.intersects(this._getExpandedVisibleBounds())) { //Zoom in, split
|
||||
this._animationStart();
|
||||
//Remove clusters now off screen
|
||||
this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds, this._zoom, this._getExpandedVisibleBounds());
|
||||
this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds, Math.floor(this._map.getMinZoom()), this._zoom, this._getExpandedVisibleBounds());
|
||||
|
||||
this._animationZoomIn(this._zoom, mapZoom);
|
||||
|
||||
@@ -1165,14 +1182,14 @@ L.MarkerClusterGroup.include({
|
||||
//Do nothing...
|
||||
},
|
||||
_animationZoomIn: function (previousZoomLevel, newZoomLevel) {
|
||||
this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds, previousZoomLevel);
|
||||
this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds, Math.floor(this._map.getMinZoom()), previousZoomLevel);
|
||||
this._topClusterLevel._recursivelyAddChildrenToMap(null, newZoomLevel, this._getExpandedVisibleBounds());
|
||||
|
||||
//We didn't actually animate, but we use this event to mean "clustering animations have finished"
|
||||
this.fire('animationend');
|
||||
},
|
||||
_animationZoomOut: function (previousZoomLevel, newZoomLevel) {
|
||||
this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds, previousZoomLevel);
|
||||
this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds, Math.floor(this._map.getMinZoom()), previousZoomLevel);
|
||||
this._topClusterLevel._recursivelyAddChildrenToMap(null, newZoomLevel, this._getExpandedVisibleBounds());
|
||||
|
||||
//We didn't actually animate, but we use this event to mean "clustering animations have finished"
|
||||
@@ -1193,7 +1210,7 @@ L.MarkerClusterGroup.include({
|
||||
_animationZoomIn: function (previousZoomLevel, newZoomLevel) {
|
||||
var bounds = this._getExpandedVisibleBounds(),
|
||||
fg = this._featureGroup,
|
||||
minZoom = this._map.getMinZoom(),
|
||||
minZoom = Math.floor(this._map.getMinZoom()),
|
||||
i;
|
||||
|
||||
this._ignoreMove = true;
|
||||
@@ -1264,7 +1281,7 @@ L.MarkerClusterGroup.include({
|
||||
//Need to add markers for those that weren't on the map before but are now
|
||||
this._topClusterLevel._recursivelyAddChildrenToMap(null, newZoomLevel, this._getExpandedVisibleBounds());
|
||||
//Remove markers that were on the map before but won't be now
|
||||
this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds, previousZoomLevel, this._getExpandedVisibleBounds());
|
||||
this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds, Math.floor(this._map.getMinZoom()), previousZoomLevel, this._getExpandedVisibleBounds());
|
||||
},
|
||||
|
||||
_animationAddLayer: function (layer, newCluster) {
|
||||
@@ -1302,10 +1319,10 @@ L.MarkerClusterGroup.include({
|
||||
// Private methods for animated versions.
|
||||
_animationZoomOutSingle: function (cluster, previousZoomLevel, newZoomLevel) {
|
||||
var bounds = this._getExpandedVisibleBounds(),
|
||||
minZoom = this._map.getMinZoom();
|
||||
minZoom = Math.floor(this._map.getMinZoom());
|
||||
|
||||
//Animate all of the markers in the clusters to move to their cluster center point
|
||||
cluster._recursivelyAnimateChildrenInAndAddSelfToMap(bounds, previousZoomLevel + 1, newZoomLevel);
|
||||
cluster._recursivelyAnimateChildrenInAndAddSelfToMap(bounds, minZoom, previousZoomLevel + 1, newZoomLevel);
|
||||
|
||||
var me = this;
|
||||
|
||||
@@ -1329,7 +1346,7 @@ L.MarkerClusterGroup.include({
|
||||
}
|
||||
} else {
|
||||
cluster._recursively(bounds, newZoomLevel, minZoom, function (c) {
|
||||
c._recursivelyRemoveChildrenFromMap(bounds, previousZoomLevel + 1);
|
||||
c._recursivelyRemoveChildrenFromMap(bounds, minZoom, previousZoomLevel + 1);
|
||||
});
|
||||
}
|
||||
me._animationEnd();
|
||||
@@ -1405,7 +1422,7 @@ L.MarkerCluster = L.Marker.extend({
|
||||
},
|
||||
|
||||
//Zoom to the minimum of showing all of the child markers, or the extents of this cluster
|
||||
zoomToBounds: function () {
|
||||
zoomToBounds: function (fitBoundsOptions) {
|
||||
var childClusters = this._childClusters.slice(),
|
||||
map = this._group._map,
|
||||
boundsZoom = map.getBoundsZoom(this._bounds),
|
||||
@@ -1428,7 +1445,7 @@ L.MarkerCluster = L.Marker.extend({
|
||||
} else if (boundsZoom <= mapZoom) { //If fitBounds wouldn't zoom us down, zoom us down instead
|
||||
this._group._map.setView(this._latlng, mapZoom + 1);
|
||||
} else {
|
||||
this._group._map.fitBounds(this._bounds);
|
||||
this._group._map.fitBounds(this._bounds, fitBoundsOptions);
|
||||
}
|
||||
},
|
||||
|
||||
@@ -1602,8 +1619,8 @@ L.MarkerCluster = L.Marker.extend({
|
||||
);
|
||||
},
|
||||
|
||||
_recursivelyAnimateChildrenInAndAddSelfToMap: function (bounds, previousZoomLevel, newZoomLevel) {
|
||||
this._recursively(bounds, newZoomLevel, this._group._map.getMinZoom(),
|
||||
_recursivelyAnimateChildrenInAndAddSelfToMap: function (bounds, mapMinZoom, previousZoomLevel, newZoomLevel) {
|
||||
this._recursively(bounds, newZoomLevel, mapMinZoom,
|
||||
function (c) {
|
||||
c._recursivelyAnimateChildrenIn(bounds, c._group._map.latLngToLayerPoint(c.getLatLng()).round(), previousZoomLevel);
|
||||
|
||||
@@ -1611,7 +1628,7 @@ L.MarkerCluster = L.Marker.extend({
|
||||
//As a hack we only do a animation free zoom on a single level zoom, if someone does multiple levels then we always animate
|
||||
if (c._isSingleParent() && previousZoomLevel - 1 === newZoomLevel) {
|
||||
c.clusterShow();
|
||||
c._recursivelyRemoveChildrenFromMap(bounds, previousZoomLevel); //Immediately remove our children as we are replacing them. TODO previousBounds not bounds
|
||||
c._recursivelyRemoveChildrenFromMap(bounds, mapMinZoom, previousZoomLevel); //Immediately remove our children as we are replacing them. TODO previousBounds not bounds
|
||||
} else {
|
||||
c.clusterHide();
|
||||
}
|
||||
@@ -1690,9 +1707,9 @@ L.MarkerCluster = L.Marker.extend({
|
||||
},
|
||||
|
||||
//exceptBounds: If set, don't remove any markers/clusters in it
|
||||
_recursivelyRemoveChildrenFromMap: function (previousBounds, zoomLevel, exceptBounds) {
|
||||
_recursivelyRemoveChildrenFromMap: function (previousBounds, mapMinZoom, zoomLevel, exceptBounds) {
|
||||
var m, i;
|
||||
this._recursively(previousBounds, this._group._map.getMinZoom() - 1, zoomLevel - 1,
|
||||
this._recursively(previousBounds, mapMinZoom - 1, zoomLevel - 1,
|
||||
function (c) {
|
||||
//Remove markers at every level
|
||||
for (i = c._markers.length - 1; i >= 0; i--) {
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "leaflet.markercluster",
|
||||
"repository": "https://github.com/Leaflet/Leaflet.markercluster",
|
||||
"version": "1.0.2",
|
||||
"version": "1.0.6",
|
||||
"description": "Provides Beautiful Animated Marker Clustering functionality for Leaflet",
|
||||
"devDependencies": {
|
||||
"jshint": "~2.1.3",
|
||||
|
||||
@@ -36,7 +36,7 @@ $GLOBALS['LEAFLET_LIBRARIES']['leaflet-providers'] = array
|
||||
$GLOBALS['LEAFLET_LIBRARIES']['leaflet-markercluster'] = array
|
||||
(
|
||||
'name' => 'Leaflet.markercluster',
|
||||
'version' => '1.0.2',
|
||||
'version' => '1.0.6',
|
||||
'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',
|
||||
|
||||
Reference in New Issue
Block a user