forked from Snck3rs/contao-leaflet-libraries
Update leaflet marker cluster.
This commit is contained in:
@@ -5,7 +5,7 @@ Leaflet.markercluster
|
|||||||
|
|
||||||
## Master
|
## Master
|
||||||
|
|
||||||
##0.4 (2012-12-19)
|
##0.4 (2013-12-19)
|
||||||
|
|
||||||
### Improvements
|
### Improvements
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,9 @@ For a Leaflet 0.5 compatible version, [Download b128e950](https://github.com/Lea
|
|||||||
For a Leaflet 0.4 compatible version, [Download the 0.2 release](https://github.com/Leaflet/Leaflet.markercluster/archive/0.2.zip)
|
For a Leaflet 0.4 compatible version, [Download the 0.2 release](https://github.com/Leaflet/Leaflet.markercluster/archive/0.2.zip)
|
||||||
|
|
||||||
## Using the plugin
|
## Using the plugin
|
||||||
|
|
||||||
|
Install with Bower: `bower install leaflet.markercluster`
|
||||||
|
|
||||||
See the included examples for usage.
|
See the included examples for usage.
|
||||||
|
|
||||||
The [realworld example](http://leaflet.github.com/Leaflet.markercluster/example/marker-clustering-realworld.388.html) is a good place to start, it uses all of the defaults of the clusterer.
|
The [realworld example](http://leaflet.github.com/Leaflet.markercluster/example/marker-clustering-realworld.388.html) is a good place to start, it uses all of the defaults of the clusterer.
|
||||||
@@ -28,8 +31,9 @@ map.addLayer(markers);
|
|||||||
By default the Clusterer enables some nice defaults for you:
|
By default the Clusterer enables some nice defaults for you:
|
||||||
* **showCoverageOnHover**: When you mouse over a cluster it shows the bounds of its markers.
|
* **showCoverageOnHover**: When you mouse over a cluster it shows the bounds of its markers.
|
||||||
* **zoomToBoundsOnClick**: When you click a cluster we zoom to its bounds.
|
* **zoomToBoundsOnClick**: When you click a cluster we zoom to its bounds.
|
||||||
* **spiderfyOnMaxZoom**: When you click a cluster at the bottom zoom level we spiderfy it so you can see all of its markers.
|
* **spiderfyOnMaxZoom**: When you click a cluster at the bottom zoom level we spiderfy it so you can see all of its markers. (*Note: the spiderfy occurs at the current zoom level if all items within the cluster are physically located at the same latitude and longitude.*)
|
||||||
* **removeOutsideVisibleBounds**: Clusters and markers too far from the viewport are removed from the map for performance.
|
* **removeOutsideVisibleBounds**: Clusters and markers too far from the viewport are removed from the map for performance.
|
||||||
|
* **spiderLegPolylineOptions**: Allows you to specify [PolylineOptions](http://leafletjs.com/reference.html#polyline-options) to style spider legs. By default, they are `{ weight: 1.5, color: '#222' }`.
|
||||||
|
|
||||||
You can disable any of these as you want in the options when you create the MarkerClusterGroup:
|
You can disable any of these as you want in the options when you create the MarkerClusterGroup:
|
||||||
```javascript
|
```javascript
|
||||||
@@ -55,13 +59,13 @@ Check out the [custom example](http://leaflet.github.com/Leaflet.markercluster/e
|
|||||||
Enabled by default (boolean options):
|
Enabled by default (boolean options):
|
||||||
* **showCoverageOnHover**: When you mouse over a cluster it shows the bounds of its markers.
|
* **showCoverageOnHover**: When you mouse over a cluster it shows the bounds of its markers.
|
||||||
* **zoomToBoundsOnClick**: When you click a cluster we zoom to its bounds.
|
* **zoomToBoundsOnClick**: When you click a cluster we zoom to its bounds.
|
||||||
* **spiderfyOnMaxZoom**: When you click a cluster at the bottom zoom level we spiderfy it so you can see all of its markers.
|
* **spiderfyOnMaxZoom**: When you click a cluster at the bottom zoom level we spiderfy it so you can see all of its markers. (*Note: the spiderfy occurs at the current zoom level if all items within the cluster are physically located at the same latitude and longitude.*)
|
||||||
* **removeOutsideVisibleBounds**: Clusters and markers too far from the viewport are removed from the map for performance.
|
* **removeOutsideVisibleBounds**: Clusters and markers too far from the viewport are removed from the map for performance.
|
||||||
|
|
||||||
Other options
|
Other options
|
||||||
* **animateAddingMarkers**: If set to true then adding individual markers to the MarkerClusterGroup after it has been added to the map will add the marker and animate it in to the cluster. Defaults to false as this gives better performance when bulk adding markers. addLayers does not support this, only addLayer with individual Markers.
|
* **animateAddingMarkers**: If set to true then adding individual markers to the MarkerClusterGroup after it has been added to the map will add the marker and animate it in to 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.com/Leaflet.markercluster/example/marker-clustering-realworld-maxzoom.388.html)
|
* **disableClusteringAtZoom**: If set, at this zoom level and below markers will not be clustered. This defaults to disabled. [See Example](http://leaflet.github.com/Leaflet.markercluster/example/marker-clustering-realworld-maxzoom.388.html)
|
||||||
* **maxClusterRadius**: The maximum radius that a cluster will cover from the central marker (in pixels). Default 80. Decreasing will make more smaller clusters.
|
* **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
|
* **polygonOptions**: Options to pass when creating the L.Polygon(points, options) to show the bounds of a cluster
|
||||||
* **singleMarkerMode**: If set to true, overrides the icon for all added markers to make them appear as a 1 size cluster
|
* **singleMarkerMode**: If set to true, overrides the icon for all added markers to make them appear as a 1 size cluster
|
||||||
* **spiderfyDistanceMultiplier**: Increase from 1 to increase the distance away from the center that spiderfied markers are placed. Use if you are using big marker icons (Default:1)
|
* **spiderfyDistanceMultiplier**: Increase from 1 to increase the distance away from the center that spiderfied markers are placed. Use if you are using big marker icons (Default:1)
|
||||||
@@ -69,7 +73,7 @@ Other options
|
|||||||
|
|
||||||
## Events
|
## Events
|
||||||
If you register for click, mouseover, etc events just related to Markers in the cluster.
|
If you register for click, mouseover, etc events just related to Markers in the cluster.
|
||||||
To recieve events for clusters listen to 'cluster' + 'eventIWant', ex: 'clusterclick', 'clustermouseover'.
|
To receive events for clusters listen to 'cluster' + 'eventIWant', ex: 'clusterclick', 'clustermouseover'.
|
||||||
|
|
||||||
Set your callback up as follows to handle both cases:
|
Set your callback up as follows to handle both cases:
|
||||||
|
|
||||||
@@ -83,10 +87,15 @@ markers.on('clusterclick', function (a) {
|
|||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### Additional MarkerClusterGroup Events
|
||||||
|
|
||||||
|
- **animationend**: Fires when marker clustering/unclustering animation has completed
|
||||||
|
- **spiderfied**: Fires when overlapping markers get spiderified
|
||||||
|
|
||||||
## Methods
|
## Methods
|
||||||
|
|
||||||
### Getting the bounds of a cluster
|
### Getting the bounds of a cluster
|
||||||
When you recieve an event from a cluster you can query it for the bounds.
|
When you receive an event from a cluster you can query it for the bounds.
|
||||||
See [example/marker-clustering-convexhull.html](http://leaflet.github.com/Leaflet.markercluster/example/marker-clustering-convexhull.html) for a working example.
|
See [example/marker-clustering-convexhull.html](http://leaflet.github.com/Leaflet.markercluster/example/marker-clustering-convexhull.html) for a working example.
|
||||||
```javascript
|
```javascript
|
||||||
markers.on('clusterclick', function (a) {
|
markers.on('clusterclick', function (a) {
|
||||||
@@ -95,7 +104,7 @@ markers.on('clusterclick', function (a) {
|
|||||||
```
|
```
|
||||||
|
|
||||||
### Zooming to the bounds of a cluster
|
### Zooming to the bounds of a cluster
|
||||||
When you recieve an event from a cluster you can zoom to its bounds in one easy step.
|
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.
|
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.com/Leaflet.markercluster/example/marker-clustering-zoomtobounds.html) for a working example.
|
See [marker-clustering-zoomtobounds.html](http://leaflet.github.com/Leaflet.markercluster/example/marker-clustering-zoomtobounds.html) for a working example.
|
||||||
```javascript
|
```javascript
|
||||||
@@ -138,4 +147,4 @@ Performance optimizations could be done so these are handled more gracefully (Ru
|
|||||||
|
|
||||||
Leaflet.markercluster is free software, and may be redistributed under the MIT-LICENSE.
|
Leaflet.markercluster is free software, and may be redistributed under the MIT-LICENSE.
|
||||||
|
|
||||||
[](https://travis-ci.org/Leaflet/Leaflet.markercluster)
|
[](https://travis-ci.org/Leaflet/Leaflet.markercluster)
|
||||||
|
|||||||
27
assets/leaflet-markercluster/bower.json
Normal file
27
assets/leaflet-markercluster/bower.json
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
{
|
||||||
|
"name": "leaflet.markercluster",
|
||||||
|
"version": "0.4.0-hotfix.1",
|
||||||
|
"homepage": "https://github.com/Leaflet/Leaflet.markercluster",
|
||||||
|
"authors": [
|
||||||
|
"Dave Leaver <danzel@localhost.geek.nz>"
|
||||||
|
],
|
||||||
|
"description": "Marker Clustering plugin for Leaflet.",
|
||||||
|
"main": [
|
||||||
|
"dist/leaflet.markercluster-src.js",
|
||||||
|
"dist/MarkerCluster.css",
|
||||||
|
"dist/MarkerCluster.Default.css"
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"ignore": [
|
||||||
|
"**/.*",
|
||||||
|
"node_modules",
|
||||||
|
"bower_components",
|
||||||
|
"example",
|
||||||
|
"spec",
|
||||||
|
"test",
|
||||||
|
"tests"
|
||||||
|
],
|
||||||
|
"dependencies": {
|
||||||
|
"leaflet": ">= 0.7.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,8 +3,7 @@
|
|||||||
https://github.com/Leaflet/Leaflet.markercluster
|
https://github.com/Leaflet/Leaflet.markercluster
|
||||||
(c) 2012-2013, Dave Leaver, smartrak
|
(c) 2012-2013, Dave Leaver, smartrak
|
||||||
*/
|
*/
|
||||||
(function (window, document, undefined) {
|
(function (window, document, undefined) {/*
|
||||||
/*
|
|
||||||
* L.MarkerClusterGroup extends L.FeatureGroup by clustering the markers contained within
|
* L.MarkerClusterGroup extends L.FeatureGroup by clustering the markers contained within
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -32,6 +31,15 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
|
|||||||
//Increase to increase the distance away that spiderfied markers appear from the center
|
//Increase to increase the distance away that spiderfied markers appear from the center
|
||||||
spiderfyDistanceMultiplier: 1,
|
spiderfyDistanceMultiplier: 1,
|
||||||
|
|
||||||
|
// Make it possible to specify a polyline options on a spider leg
|
||||||
|
spiderLegPolylineOptions: { weight: 1.5, color: '#222' },
|
||||||
|
|
||||||
|
// 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
|
||||||
|
chunkedLoading: false,
|
||||||
|
chunkInterval: 200, // process markers for a maximum of ~ n milliseconds (then trigger the chunkProgress callback)
|
||||||
|
chunkDelay: 50, // at the end of each interval, give n milliseconds back to system/browser
|
||||||
|
chunkProgress: null, // progress callback: function(processed, total, elapsed) (e.g. for a progress indicator)
|
||||||
|
|
||||||
//Options to pass to the L.Polygon constructor
|
//Options to pass to the L.Polygon constructor
|
||||||
polygonOptions: {}
|
polygonOptions: {}
|
||||||
},
|
},
|
||||||
@@ -148,8 +156,8 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
|
|||||||
|
|
||||||
if (this._featureGroup.hasLayer(layer)) {
|
if (this._featureGroup.hasLayer(layer)) {
|
||||||
this._featureGroup.removeLayer(layer);
|
this._featureGroup.removeLayer(layer);
|
||||||
if (layer.setOpacity) {
|
if (layer.clusterShow) {
|
||||||
layer.setOpacity(1);
|
layer.clusterShow();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -158,52 +166,90 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
|
|||||||
|
|
||||||
//Takes an array of markers and adds them in bulk
|
//Takes an array of markers and adds them in bulk
|
||||||
addLayers: function (layersArray) {
|
addLayers: function (layersArray) {
|
||||||
var i, l, m,
|
var fg = this._featureGroup,
|
||||||
onMap = this._map,
|
npg = this._nonPointGroup,
|
||||||
fg = this._featureGroup,
|
chunked = this.options.chunkedLoading,
|
||||||
npg = this._nonPointGroup;
|
chunkInterval = this.options.chunkInterval,
|
||||||
|
chunkProgress = this.options.chunkProgress,
|
||||||
|
newMarkers, i, l, m;
|
||||||
|
|
||||||
for (i = 0, l = layersArray.length; i < l; i++) {
|
if (this._map) {
|
||||||
m = layersArray[i];
|
var offset = 0,
|
||||||
|
started = (new Date()).getTime();
|
||||||
|
var process = L.bind(function () {
|
||||||
|
var start = (new Date()).getTime();
|
||||||
|
for (; offset < layersArray.length; offset++) {
|
||||||
|
if (chunked && offset % 200 === 0) {
|
||||||
|
// every couple hundred markers, instrument the time elapsed since processing started:
|
||||||
|
var elapsed = (new Date()).getTime() - start;
|
||||||
|
if (elapsed > chunkInterval) {
|
||||||
|
break; // been working too hard, time to take a break :-)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//Not point data, can't be clustered
|
m = layersArray[offset];
|
||||||
if (!m.getLatLng) {
|
|
||||||
npg.addLayer(m);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.hasLayer(m)) {
|
//Not point data, can't be clustered
|
||||||
continue;
|
if (!m.getLatLng) {
|
||||||
}
|
npg.addLayer(m);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (!onMap) {
|
if (this.hasLayer(m)) {
|
||||||
this._needsClustering.push(m);
|
continue;
|
||||||
continue;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
this._addLayer(m, this._maxZoom);
|
this._addLayer(m, this._maxZoom);
|
||||||
|
|
||||||
//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 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) {
|
if (m.__parent) {
|
||||||
if (m.__parent.getChildCount() === 2) {
|
if (m.__parent.getChildCount() === 2) {
|
||||||
var markers = m.__parent.getAllChildMarkers(),
|
var markers = m.__parent.getAllChildMarkers(),
|
||||||
otherMarker = markers[0] === m ? markers[1] : markers[0];
|
otherMarker = markers[0] === m ? markers[1] : markers[0];
|
||||||
fg.removeLayer(otherMarker);
|
fg.removeLayer(otherMarker);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (onMap) {
|
if (chunkProgress) {
|
||||||
//Update the icons of all those visible clusters that were affected
|
// report progress and time elapsed:
|
||||||
fg.eachLayer(function (c) {
|
chunkProgress(offset, layersArray.length, (new Date()).getTime() - started);
|
||||||
if (c instanceof L.MarkerCluster && c._iconNeedsUpdate) {
|
|
||||||
c._updateIcon();
|
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
|
||||||
this._topClusterLevel._recursivelyAddChildrenToMap(null, this._zoom, this._currentShownBounds);
|
if (offset === layersArray.length) {
|
||||||
|
//Update the icons of all those visible clusters that were affected
|
||||||
|
this._featureGroup.eachLayer(function (c) {
|
||||||
|
if (c instanceof L.MarkerCluster && c._iconNeedsUpdate) {
|
||||||
|
c._updateIcon();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this._topClusterLevel._recursivelyAddChildrenToMap(null, this._zoom, this._currentShownBounds);
|
||||||
|
} else {
|
||||||
|
setTimeout(process, this.options.chunkDelay);
|
||||||
|
}
|
||||||
|
}, this);
|
||||||
|
|
||||||
|
process();
|
||||||
|
} else {
|
||||||
|
newMarkers = [];
|
||||||
|
for (i = 0, l = layersArray.length; i < l; i++) {
|
||||||
|
m = layersArray[i];
|
||||||
|
|
||||||
|
//Not point data, can't be clustered
|
||||||
|
if (!m.getLatLng) {
|
||||||
|
npg.addLayer(m);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.hasLayer(m)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
newMarkers.push(m);
|
||||||
|
}
|
||||||
|
this._needsClustering = this._needsClustering.concat(newMarkers);
|
||||||
}
|
}
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -213,6 +259,10 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
|
|||||||
fg = this._featureGroup,
|
fg = this._featureGroup,
|
||||||
npg = this._nonPointGroup;
|
npg = this._nonPointGroup;
|
||||||
|
|
||||||
|
if (this._unspiderfy) {
|
||||||
|
this._unspiderfy();
|
||||||
|
}
|
||||||
|
|
||||||
if (!this._map) {
|
if (!this._map) {
|
||||||
for (i = 0, l = layersArray.length; i < l; i++) {
|
for (i = 0, l = layersArray.length; i < l; i++) {
|
||||||
m = layersArray[i];
|
m = layersArray[i];
|
||||||
@@ -234,8 +284,8 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
|
|||||||
|
|
||||||
if (fg.hasLayer(m)) {
|
if (fg.hasLayer(m)) {
|
||||||
fg.removeLayer(m);
|
fg.removeLayer(m);
|
||||||
if (m.setOpacity) {
|
if (m.clusterShow) {
|
||||||
m.setOpacity(1);
|
m.clusterShow();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -286,12 +336,13 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
|
|||||||
//Override FeatureGroup.getBounds as it doesn't work
|
//Override FeatureGroup.getBounds as it doesn't work
|
||||||
getBounds: function () {
|
getBounds: function () {
|
||||||
var bounds = new L.LatLngBounds();
|
var bounds = new L.LatLngBounds();
|
||||||
|
|
||||||
if (this._topClusterLevel) {
|
if (this._topClusterLevel) {
|
||||||
bounds.extend(this._topClusterLevel._bounds);
|
bounds.extend(this._topClusterLevel._bounds);
|
||||||
} else {
|
}
|
||||||
for (var i = this._needsClustering.length - 1; i >= 0; i--) {
|
|
||||||
bounds.extend(this._needsClustering[i].getLatLng());
|
for (var i = this._needsClustering.length - 1; i >= 0; i--) {
|
||||||
}
|
bounds.extend(this._needsClustering[i].getLatLng());
|
||||||
}
|
}
|
||||||
|
|
||||||
bounds.extend(this._nonPointGroup.getBounds());
|
bounds.extend(this._nonPointGroup.getBounds());
|
||||||
@@ -302,7 +353,7 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
|
|||||||
//Overrides LayerGroup.eachLayer
|
//Overrides LayerGroup.eachLayer
|
||||||
eachLayer: function (method, context) {
|
eachLayer: function (method, context) {
|
||||||
var markers = this._needsClustering.slice(),
|
var markers = this._needsClustering.slice(),
|
||||||
i;
|
i;
|
||||||
|
|
||||||
if (this._topClusterLevel) {
|
if (this._topClusterLevel) {
|
||||||
this._topClusterLevel.getAllChildMarkers(markers);
|
this._topClusterLevel.getAllChildMarkers(markers);
|
||||||
@@ -384,16 +435,27 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (layer._icon && this._map.getBounds().contains(layer.getLatLng())) {
|
if (layer._icon && this._map.getBounds().contains(layer.getLatLng())) {
|
||||||
|
//Layer is visible ond on screen, immediate return
|
||||||
callback();
|
callback();
|
||||||
} else if (layer.__parent._zoom < this._map.getZoom()) {
|
} else if (layer.__parent._zoom < this._map.getZoom()) {
|
||||||
//Layer should be visible now but isn't on screen, just pan over to it
|
//Layer should be visible at this zoom level. It must not be on screen so just pan over to it
|
||||||
this._map.on('moveend', showMarker, this);
|
this._map.on('moveend', showMarker, this);
|
||||||
this._map.panTo(layer.getLatLng());
|
this._map.panTo(layer.getLatLng());
|
||||||
} else {
|
} 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._map.on('moveend', showMarker, this);
|
||||||
this.on('animationend', showMarker, this);
|
this.on('animationend', showMarker, this);
|
||||||
this._map.setView(layer.getLatLng(), layer.__parent._zoom + 1);
|
|
||||||
layer.__parent.zoomToBounds();
|
layer.__parent.zoomToBounds();
|
||||||
|
|
||||||
|
if (moveStart) {
|
||||||
|
//Never started moving, must already be there, probably need clustering however
|
||||||
|
showMarker.call(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -419,23 +481,9 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
|
|||||||
}
|
}
|
||||||
this._needsRemoving = [];
|
this._needsRemoving = [];
|
||||||
|
|
||||||
for (i = 0, l = this._needsClustering.length; i < l; i++) {
|
//Remember the current zoom level and bounds
|
||||||
layer = this._needsClustering[i];
|
this._zoom = this._map.getZoom();
|
||||||
|
this._currentShownBounds = this._getExpandedVisibleBounds();
|
||||||
//If the layer doesn't have a getLatLng then we can't cluster it, so add it to our child featureGroup
|
|
||||||
if (!layer.getLatLng) {
|
|
||||||
this._featureGroup.addLayer(layer);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (layer.__parent) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
this._addLayer(layer, this._maxZoom);
|
|
||||||
}
|
|
||||||
this._needsClustering = [];
|
|
||||||
|
|
||||||
|
|
||||||
this._map.on('zoomend', this._zoomEnd, this);
|
this._map.on('zoomend', this._zoomEnd, this);
|
||||||
this._map.on('moveend', this._moveEnd, this);
|
this._map.on('moveend', this._moveEnd, this);
|
||||||
@@ -446,15 +494,10 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
|
|||||||
|
|
||||||
this._bindEvents();
|
this._bindEvents();
|
||||||
|
|
||||||
|
|
||||||
//Actually add our markers to the map:
|
//Actually add our markers to the map:
|
||||||
|
l = this._needsClustering;
|
||||||
//Remember the current zoom level and bounds
|
this._needsClustering = [];
|
||||||
this._zoom = this._map.getZoom();
|
this.addLayers(l);
|
||||||
this._currentShownBounds = this._getExpandedVisibleBounds();
|
|
||||||
|
|
||||||
//Make things appear on the map
|
|
||||||
this._topClusterLevel._recursivelyAddChildrenToMap(null, this._zoom, this._currentShownBounds);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
//Overrides FeatureGroup.onRemove
|
//Overrides FeatureGroup.onRemove
|
||||||
@@ -624,7 +667,11 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
|
|||||||
|
|
||||||
_zoomOrSpiderfy: function (e) {
|
_zoomOrSpiderfy: function (e) {
|
||||||
var map = this._map;
|
var map = this._map;
|
||||||
if (map.getMaxZoom() === map.getZoom()) {
|
if (e.layer._bounds._northEast.equals(e.layer._bounds._southWest)) {
|
||||||
|
if (this.options.spiderfyOnMaxZoom) {
|
||||||
|
e.layer.spiderfy();
|
||||||
|
}
|
||||||
|
} else if (map.getMaxZoom() === map.getZoom()) {
|
||||||
if (this.options.spiderfyOnMaxZoom) {
|
if (this.options.spiderfyOnMaxZoom) {
|
||||||
e.layer.spiderfy();
|
e.layer.spiderfy();
|
||||||
}
|
}
|
||||||
@@ -632,7 +679,7 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
|
|||||||
e.layer.zoomToBounds();
|
e.layer.zoomToBounds();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Focus the map again for keyboard users.
|
// Focus the map again for keyboard users.
|
||||||
if (e.originalEvent && e.originalEvent.keyCode === 13) {
|
if (e.originalEvent && e.originalEvent.keyCode === 13) {
|
||||||
map._container.focus();
|
map._container.focus();
|
||||||
}
|
}
|
||||||
@@ -701,7 +748,15 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
|
|||||||
|
|
||||||
_generateInitialClusters: function () {
|
_generateInitialClusters: function () {
|
||||||
var maxZoom = this._map.getMaxZoom(),
|
var maxZoom = this._map.getMaxZoom(),
|
||||||
radius = this.options.maxClusterRadius;
|
radius = this.options.maxClusterRadius,
|
||||||
|
radiusFn = radius;
|
||||||
|
|
||||||
|
//If we just set maxClusterRadius to a single number, we need to create
|
||||||
|
//a simple function to return that number. Otherwise, we just have to
|
||||||
|
//use the function we've passed in.
|
||||||
|
if (typeof radius !== "function") {
|
||||||
|
radiusFn = function () { return radius; };
|
||||||
|
}
|
||||||
|
|
||||||
if (this.options.disableClusteringAtZoom) {
|
if (this.options.disableClusteringAtZoom) {
|
||||||
maxZoom = this.options.disableClusteringAtZoom - 1;
|
maxZoom = this.options.disableClusteringAtZoom - 1;
|
||||||
@@ -709,11 +764,11 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
|
|||||||
this._maxZoom = maxZoom;
|
this._maxZoom = maxZoom;
|
||||||
this._gridClusters = {};
|
this._gridClusters = {};
|
||||||
this._gridUnclustered = {};
|
this._gridUnclustered = {};
|
||||||
|
|
||||||
//Set up DistanceGrids for each zoom
|
//Set up DistanceGrids for each zoom
|
||||||
for (var zoom = maxZoom; zoom >= 0; zoom--) {
|
for (var zoom = maxZoom; zoom >= 0; zoom--) {
|
||||||
this._gridClusters[zoom] = new L.DistanceGrid(radius);
|
this._gridClusters[zoom] = new L.DistanceGrid(radiusFn(zoom));
|
||||||
this._gridUnclustered[zoom] = new L.DistanceGrid(radius);
|
this._gridUnclustered[zoom] = new L.DistanceGrid(radiusFn(zoom));
|
||||||
}
|
}
|
||||||
|
|
||||||
this._topClusterLevel = new L.MarkerCluster(this, -1);
|
this._topClusterLevel = new L.MarkerCluster(this, -1);
|
||||||
@@ -813,7 +868,7 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
|
|||||||
//Incase we are starting to split before the animation finished
|
//Incase we are starting to split before the animation finished
|
||||||
this._processQueue();
|
this._processQueue();
|
||||||
|
|
||||||
if (this._zoom < this._map._zoom && this._currentShownBounds.contains(this._getExpandedVisibleBounds())) { //Zoom in, split
|
if (this._zoom < this._map._zoom && this._currentShownBounds.intersects(this._getExpandedVisibleBounds())) { //Zoom in, split
|
||||||
this._animationStart();
|
this._animationStart();
|
||||||
//Remove clusters now off screen
|
//Remove clusters now off screen
|
||||||
this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds, this._zoom, this._getExpandedVisibleBounds());
|
this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds, this._zoom, this._getExpandedVisibleBounds());
|
||||||
@@ -832,7 +887,7 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
|
|||||||
//Gets the maps visible bounds expanded in each direction by the size of the screen (so the user cannot see an area we do not cover in one pan)
|
//Gets the maps visible bounds expanded in each direction by the size of the screen (so the user cannot see an area we do not cover in one pan)
|
||||||
_getExpandedVisibleBounds: function () {
|
_getExpandedVisibleBounds: function () {
|
||||||
if (!this.options.removeOutsideVisibleBounds) {
|
if (!this.options.removeOutsideVisibleBounds) {
|
||||||
return this.getBounds();
|
return this._map.getBounds();
|
||||||
}
|
}
|
||||||
|
|
||||||
var map = this._map,
|
var map = this._map,
|
||||||
@@ -872,10 +927,16 @@ L.MarkerClusterGroup.include(!L.DomUtil.TRANSITION ? {
|
|||||||
_animationZoomIn: function (previousZoomLevel, newZoomLevel) {
|
_animationZoomIn: function (previousZoomLevel, newZoomLevel) {
|
||||||
this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds, previousZoomLevel);
|
this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds, previousZoomLevel);
|
||||||
this._topClusterLevel._recursivelyAddChildrenToMap(null, newZoomLevel, this._getExpandedVisibleBounds());
|
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) {
|
_animationZoomOut: function (previousZoomLevel, newZoomLevel) {
|
||||||
this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds, previousZoomLevel);
|
this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds, previousZoomLevel);
|
||||||
this._topClusterLevel._recursivelyAddChildrenToMap(null, newZoomLevel, this._getExpandedVisibleBounds());
|
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');
|
||||||
},
|
},
|
||||||
_animationAddLayer: function (layer, newCluster) {
|
_animationAddLayer: function (layer, newCluster) {
|
||||||
this._animationAddLayerNonAnimated(layer, newCluster);
|
this._animationAddLayerNonAnimated(layer, newCluster);
|
||||||
@@ -914,7 +975,7 @@ L.MarkerClusterGroup.include(!L.DomUtil.TRANSITION ? {
|
|||||||
c._recursivelyAddChildrenToMap(null, newZoomLevel, bounds);
|
c._recursivelyAddChildrenToMap(null, newZoomLevel, bounds);
|
||||||
} else {
|
} else {
|
||||||
//Fade out old cluster
|
//Fade out old cluster
|
||||||
c.setOpacity(0);
|
c.clusterHide();
|
||||||
c._recursivelyAddChildrenToMap(startPos, newZoomLevel, bounds);
|
c._recursivelyAddChildrenToMap(startPos, newZoomLevel, bounds);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -936,7 +997,7 @@ L.MarkerClusterGroup.include(!L.DomUtil.TRANSITION ? {
|
|||||||
//TODO Maybe? Update markers in _recursivelyBecomeVisible
|
//TODO Maybe? Update markers in _recursivelyBecomeVisible
|
||||||
fg.eachLayer(function (n) {
|
fg.eachLayer(function (n) {
|
||||||
if (!(n instanceof L.MarkerCluster) && n._icon) {
|
if (!(n instanceof L.MarkerCluster) && n._icon) {
|
||||||
n.setOpacity(1);
|
n.clusterShow();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -950,7 +1011,7 @@ L.MarkerClusterGroup.include(!L.DomUtil.TRANSITION ? {
|
|||||||
//update the positions of the just added clusters/markers
|
//update the positions of the just added clusters/markers
|
||||||
this._topClusterLevel._recursively(bounds, previousZoomLevel, 0, function (c) {
|
this._topClusterLevel._recursively(bounds, previousZoomLevel, 0, function (c) {
|
||||||
fg.removeLayer(c);
|
fg.removeLayer(c);
|
||||||
c.setOpacity(1);
|
c.clusterShow();
|
||||||
});
|
});
|
||||||
|
|
||||||
this._animationEnd();
|
this._animationEnd();
|
||||||
@@ -986,7 +1047,9 @@ L.MarkerClusterGroup.include(!L.DomUtil.TRANSITION ? {
|
|||||||
var m = cluster._markers[0];
|
var m = cluster._markers[0];
|
||||||
//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
|
//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
|
||||||
m.setLatLng(m.getLatLng());
|
m.setLatLng(m.getLatLng());
|
||||||
m.setOpacity(1);
|
if (m.clusterShow) {
|
||||||
|
m.clusterShow();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
cluster._recursively(bounds, newZoomLevel, 0, function (c) {
|
cluster._recursively(bounds, newZoomLevel, 0, function (c) {
|
||||||
c._recursivelyRemoveChildrenFromMap(bounds, previousZoomLevel + 1);
|
c._recursivelyRemoveChildrenFromMap(bounds, previousZoomLevel + 1);
|
||||||
@@ -1008,11 +1071,11 @@ L.MarkerClusterGroup.include(!L.DomUtil.TRANSITION ? {
|
|||||||
this._animationStart();
|
this._animationStart();
|
||||||
|
|
||||||
layer._setPos(this._map.latLngToLayerPoint(newCluster.getLatLng()));
|
layer._setPos(this._map.latLngToLayerPoint(newCluster.getLatLng()));
|
||||||
layer.setOpacity(0);
|
layer.clusterHide();
|
||||||
|
|
||||||
this._enqueue(function () {
|
this._enqueue(function () {
|
||||||
fg.removeLayer(layer);
|
fg.removeLayer(layer);
|
||||||
layer.setOpacity(1);
|
layer.clusterShow();
|
||||||
|
|
||||||
me._animationEnd();
|
me._animationEnd();
|
||||||
});
|
});
|
||||||
@@ -1094,7 +1157,7 @@ L.MarkerCluster = L.Marker.extend({
|
|||||||
mapZoom = map.getZoom(),
|
mapZoom = map.getZoom(),
|
||||||
i;
|
i;
|
||||||
|
|
||||||
//calculate how fare we need to zoom down to see all of the markers
|
//calculate how far we need to zoom down to see all of the markers
|
||||||
while (childClusters.length > 0 && boundsZoom > zoom) {
|
while (childClusters.length > 0 && boundsZoom > zoom) {
|
||||||
zoom++;
|
zoom++;
|
||||||
var newClusters = [];
|
var newClusters = [];
|
||||||
@@ -1212,7 +1275,7 @@ L.MarkerCluster = L.Marker.extend({
|
|||||||
//Only do it if the icon is still on the map
|
//Only do it if the icon is still on the map
|
||||||
if (m._icon) {
|
if (m._icon) {
|
||||||
m._setPos(center);
|
m._setPos(center);
|
||||||
m.setOpacity(0);
|
m.clusterHide();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -1223,7 +1286,7 @@ L.MarkerCluster = L.Marker.extend({
|
|||||||
cm = childClusters[j];
|
cm = childClusters[j];
|
||||||
if (cm._icon) {
|
if (cm._icon) {
|
||||||
cm._setPos(center);
|
cm._setPos(center);
|
||||||
cm.setOpacity(0);
|
cm.clusterHide();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1238,10 +1301,10 @@ L.MarkerCluster = L.Marker.extend({
|
|||||||
//TODO: depthToAnimateIn affects _isSingleParent, if there is a multizoom we may/may not be.
|
//TODO: depthToAnimateIn affects _isSingleParent, if there is a multizoom we may/may not be.
|
||||||
//As a hack we only do a animation free zoom on a single level zoom, if someone does multiple levels then we always animate
|
//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) {
|
if (c._isSingleParent() && previousZoomLevel - 1 === newZoomLevel) {
|
||||||
c.setOpacity(1);
|
c.clusterShow();
|
||||||
c._recursivelyRemoveChildrenFromMap(bounds, previousZoomLevel); //Immediately remove our children as we are replacing them. TODO previousBounds not bounds
|
c._recursivelyRemoveChildrenFromMap(bounds, previousZoomLevel); //Immediately remove our children as we are replacing them. TODO previousBounds not bounds
|
||||||
} else {
|
} else {
|
||||||
c.setOpacity(0);
|
c.clusterHide();
|
||||||
}
|
}
|
||||||
|
|
||||||
c._addToMap();
|
c._addToMap();
|
||||||
@@ -1251,7 +1314,7 @@ L.MarkerCluster = L.Marker.extend({
|
|||||||
|
|
||||||
_recursivelyBecomeVisible: function (bounds, zoomLevel) {
|
_recursivelyBecomeVisible: function (bounds, zoomLevel) {
|
||||||
this._recursively(bounds, 0, zoomLevel, null, function (c) {
|
this._recursively(bounds, 0, zoomLevel, null, function (c) {
|
||||||
c.setOpacity(1);
|
c.clusterShow();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -1274,8 +1337,8 @@ L.MarkerCluster = L.Marker.extend({
|
|||||||
nm._backupLatlng = nm.getLatLng();
|
nm._backupLatlng = nm.getLatLng();
|
||||||
|
|
||||||
nm.setLatLng(startPos);
|
nm.setLatLng(startPos);
|
||||||
if (nm.setOpacity) {
|
if (nm.clusterHide) {
|
||||||
nm.setOpacity(0);
|
nm.clusterHide();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1327,8 +1390,8 @@ L.MarkerCluster = L.Marker.extend({
|
|||||||
m = c._markers[i];
|
m = c._markers[i];
|
||||||
if (!exceptBounds || !exceptBounds.contains(m._latlng)) {
|
if (!exceptBounds || !exceptBounds.contains(m._latlng)) {
|
||||||
c._group._featureGroup.removeLayer(m);
|
c._group._featureGroup.removeLayer(m);
|
||||||
if (m.setOpacity) {
|
if (m.clusterShow) {
|
||||||
m.setOpacity(1);
|
m.clusterShow();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1339,8 +1402,8 @@ L.MarkerCluster = L.Marker.extend({
|
|||||||
m = c._childClusters[i];
|
m = c._childClusters[i];
|
||||||
if (!exceptBounds || !exceptBounds.contains(m._latlng)) {
|
if (!exceptBounds || !exceptBounds.contains(m._latlng)) {
|
||||||
c._group._featureGroup.removeLayer(m);
|
c._group._featureGroup.removeLayer(m);
|
||||||
if (m.setOpacity) {
|
if (m.clusterShow) {
|
||||||
m.setOpacity(1);
|
m.clusterShow();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1357,7 +1420,7 @@ L.MarkerCluster = L.Marker.extend({
|
|||||||
_recursively: function (boundsToApplyTo, zoomLevelToStart, zoomLevelToStop, runAtEveryLevel, runAtBottomLevel) {
|
_recursively: function (boundsToApplyTo, zoomLevelToStart, zoomLevelToStop, runAtEveryLevel, runAtBottomLevel) {
|
||||||
var childClusters = this._childClusters,
|
var childClusters = this._childClusters,
|
||||||
zoom = this._zoom,
|
zoom = this._zoom,
|
||||||
i, c;
|
i, c;
|
||||||
|
|
||||||
if (zoomLevelToStart > zoom) { //Still going down to required depth, just recurse to child clusters
|
if (zoomLevelToStart > zoom) { //Still going down to required depth, just recurse to child clusters
|
||||||
for (i = childClusters.length - 1; i >= 0; i--) {
|
for (i = childClusters.length - 1; i >= 0; i--) {
|
||||||
@@ -1413,6 +1476,34 @@ L.MarkerCluster = L.Marker.extend({
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Extends L.Marker to include two extra methods: clusterHide and clusterShow.
|
||||||
|
*
|
||||||
|
* They work as setOpacity(0) and setOpacity(1) respectively, but
|
||||||
|
* they will remember the marker's opacity when hiding and showing it again.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
L.Marker.include({
|
||||||
|
|
||||||
|
clusterHide: function () {
|
||||||
|
this.options.opacityWhenUnclustered = this.options.opacity || 1;
|
||||||
|
return this.setOpacity(0);
|
||||||
|
},
|
||||||
|
|
||||||
|
clusterShow: function () {
|
||||||
|
var ret = this.setOpacity(this.options.opacity || this.options.opacityWhenUnclustered);
|
||||||
|
delete this.options.opacityWhenUnclustered;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
L.DistanceGrid = function (cellSize) {
|
L.DistanceGrid = function (cellSize) {
|
||||||
this._cellSize = cellSize;
|
this._cellSize = cellSize;
|
||||||
this._sqCellSize = cellSize * cellSize;
|
this._sqCellSize = cellSize * cellSize;
|
||||||
@@ -1815,8 +1906,8 @@ L.MarkerCluster.include(!L.DomUtil.TRANSITION ? {
|
|||||||
|
|
||||||
fg.addLayer(m);
|
fg.addLayer(m);
|
||||||
|
|
||||||
|
var legOptions = this._group.options.spiderLegPolylineOptions;
|
||||||
leg = new L.Polyline([this._latlng, newPos], { weight: 1.5, color: '#222' });
|
leg = new L.Polyline([this._latlng, newPos], legOptions);
|
||||||
map.addLayer(leg);
|
map.addLayer(leg);
|
||||||
m._spiderLeg = leg;
|
m._spiderLeg = leg;
|
||||||
}
|
}
|
||||||
@@ -1848,7 +1939,7 @@ L.MarkerCluster.include(!L.DomUtil.TRANSITION ? {
|
|||||||
//If it is a marker, add it now and we'll animate it out
|
//If it is a marker, add it now and we'll animate it out
|
||||||
if (m.setOpacity) {
|
if (m.setOpacity) {
|
||||||
m.setZIndexOffset(1000000); //Make these appear on top of EVERYTHING
|
m.setZIndexOffset(1000000); //Make these appear on top of EVERYTHING
|
||||||
m.setOpacity(0);
|
m.clusterHide();
|
||||||
|
|
||||||
fg.addLayer(m);
|
fg.addLayer(m);
|
||||||
|
|
||||||
@@ -1875,12 +1966,16 @@ L.MarkerCluster.include(!L.DomUtil.TRANSITION ? {
|
|||||||
m.setLatLng(newPos);
|
m.setLatLng(newPos);
|
||||||
|
|
||||||
if (m.setOpacity) {
|
if (m.setOpacity) {
|
||||||
m.setOpacity(1);
|
m.clusterShow();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//Add Legs.
|
//Add Legs.
|
||||||
leg = new L.Polyline([me._latlng, newPos], { weight: 1.5, color: '#222', opacity: initialLegOpacity });
|
var legOptions = this._group.options.spiderLegPolylineOptions;
|
||||||
|
if (legOptions.opacity === undefined) {
|
||||||
|
legOptions.opacity = initialLegOpacity;
|
||||||
|
}
|
||||||
|
leg = new L.Polyline([me._latlng, newPos], legOptions);
|
||||||
map.addLayer(leg);
|
map.addLayer(leg);
|
||||||
m._spiderLeg = leg;
|
m._spiderLeg = leg;
|
||||||
|
|
||||||
@@ -1966,7 +2061,7 @@ L.MarkerCluster.include(!L.DomUtil.TRANSITION ? {
|
|||||||
//Hack override the location to be our center
|
//Hack override the location to be our center
|
||||||
if (m.setOpacity) {
|
if (m.setOpacity) {
|
||||||
m._setPos(thisLayerPos);
|
m._setPos(thisLayerPos);
|
||||||
m.setOpacity(0);
|
m.clusterHide();
|
||||||
} else {
|
} else {
|
||||||
fg.removeLayer(m);
|
fg.removeLayer(m);
|
||||||
}
|
}
|
||||||
@@ -2008,7 +2103,7 @@ L.MarkerCluster.include(!L.DomUtil.TRANSITION ? {
|
|||||||
|
|
||||||
|
|
||||||
if (m.setOpacity) {
|
if (m.setOpacity) {
|
||||||
m.setOpacity(1);
|
m.clusterShow();
|
||||||
m.setZIndexOffset(0);
|
m.setZIndexOffset(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -45,7 +45,7 @@ $GLOBALS['LEAFLET_LIBRARIES']['leaflet-omnivore'] = array
|
|||||||
$GLOBALS['LEAFLET_LIBRARIES']['leaflet-markercluster'] = array
|
$GLOBALS['LEAFLET_LIBRARIES']['leaflet-markercluster'] = array
|
||||||
(
|
(
|
||||||
'name' => 'Leaflet.markercluster',
|
'name' => 'Leaflet.markercluster',
|
||||||
'version' => '0.4.0',
|
'version' => '0.4.0-hotfix.1',
|
||||||
'license' => '<a href="https://github.com/Leaflet/Leaflet.markercluster/blob/master/MIT-LICENCE.txt" target="_blank">MIT</a>',
|
'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',
|
'homepage' => 'https://github.com/Leaflet/Leaflet.markercluster',
|
||||||
'css' => 'assets/leaflet/libs/leaflet-markercluster/MarkerCluster.css',
|
'css' => 'assets/leaflet/libs/leaflet-markercluster/MarkerCluster.css',
|
||||||
|
|||||||
Reference in New Issue
Block a user