[Pkg-javascript-commits] [leaflet-markercluster] 434/479: Update build.
Jonas Smedegaard
dr at jones.dk
Thu Oct 16 16:01:04 UTC 2014
This is an automated email from the git hooks/post-receive script.
js pushed a commit to branch master
in repository leaflet-markercluster.
commit 0e73130b43b631c87117eeb778f24a012965cbbf
Author: danzel <danzel at localhost.geek.nz>
Date: Tue Oct 29 09:05:47 2013 +1300
Update build.
---
dist/leaflet.markercluster-src.js | 82 +++++++++++++++++++++++++--------------
dist/leaflet.markercluster.js | 2 +-
2 files changed, 53 insertions(+), 31 deletions(-)
diff --git a/dist/leaflet.markercluster-src.js b/dist/leaflet.markercluster-src.js
index 1d67cca..7df0cfb 100644
--- a/dist/leaflet.markercluster-src.js
+++ b/dist/leaflet.markercluster-src.js
@@ -292,11 +292,7 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
}
}
- //TODO: Can remove this isValid test when leaflet 0.6 is released
- var nonPointBounds = this._nonPointGroup.getBounds();
- if (nonPointBounds.isValid()) {
- bounds.extend(nonPointBounds);
- }
+ bounds.extend(this._nonPointGroup.getBounds());
return bounds;
},
@@ -317,6 +313,15 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
this._nonPointGroup.eachLayer(method, context);
},
+ //Overrides LayerGroup.getLayers
+ getLayers: function () {
+ var layers = [];
+ this.eachLayer(function (l) {
+ layers.push(l);
+ });
+ return layers;
+ },
+
//Returns true if the given layer is in this MarkerClusterGroup
hasLayer: function (layer) {
if (!layer) {
@@ -453,7 +458,10 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
this._spiderfierOnRemove();
}
+
+
//Clean up all the layers we added to the map
+ this._hideCoverage();
this._featureGroup.onRemove(map);
this._nonPointGroup.onRemove(map);
@@ -464,10 +472,10 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
getVisibleParent: function (marker) {
var vMarker = marker;
- while (vMarker !== null && !vMarker._icon) {
+ while (vMarker && !vMarker._icon) {
vMarker = vMarker.__parent;
}
- return vMarker;
+ return vMarker || null;
},
//Remove the given object from the given array
@@ -584,7 +592,6 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
this.on('clustermouseover', this._showCoverage, this);
this.on('clustermouseout', this._hideCoverage, this);
map.on('zoomend', this._hideCoverage, this);
- map.on('layerremove', this._hideCoverageOnRemove, this);
}
},
@@ -620,12 +627,6 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
}
},
- _hideCoverageOnRemove: function (e) {
- if (e.layer === this) {
- this._hideCoverage();
- }
- },
-
_unbindEvents: function () {
var spiderfyOnMaxZoom = this.options.spiderfyOnMaxZoom,
showCoverageOnHover = this.options.showCoverageOnHover,
@@ -639,7 +640,6 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
this.off('clustermouseover', this._showCoverage, this);
this.off('clustermouseout', this._hideCoverage, this);
map.off('zoomend', this._hideCoverage, this);
- map.off('layerremove', this._hideCoverageOnRemove, this);
}
},
@@ -761,7 +761,7 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
//Merge and split any existing clusters that are too big or small
_mergeSplitClusters: function () {
- if (this._zoom < this._map._zoom) { //Zoom in, split
+ if (this._zoom < this._map._zoom && this._currentShownBounds.contains(this._getExpandedVisibleBounds())) { //Zoom in, split
this._animationStart();
//Remove clusters now off screen
this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds, this._zoom, this._getExpandedVisibleBounds());
@@ -1485,13 +1485,26 @@ Retrieved from: http://en.literateprograms.org/Quickhull_(Javascript)?oldid=1843
(function () {
L.QuickHull = {
+
+ /*
+ * @param {Object} cpt a point to be measured from the baseline
+ * @param {Array} bl the baseline, as represented by a two-element
+ * array of latlng objects.
+ * @returns {Number} an approximate distance measure
+ */
getDistant: function (cpt, bl) {
var vY = bl[1].lat - bl[0].lat,
vX = bl[0].lng - bl[1].lng;
return (vX * (cpt.lat - bl[0].lat) + vY * (cpt.lng - bl[0].lng));
},
-
+ /*
+ * @param {Array} baseLine a two-element array of latlng objects
+ * representing the baseline to project from
+ * @param {Array} latLngs an array of latlng objects
+ * @returns {Object} the maximum point and all new points to stay
+ * in consideration for the hull.
+ */
findMostDistantPointFromBaseLine: function (baseLine, latLngs) {
var maxD = 0,
maxPt = null,
@@ -1512,11 +1525,19 @@ Retrieved from: http://en.literateprograms.org/Quickhull_(Javascript)?oldid=1843
maxD = d;
maxPt = pt;
}
-
}
- return { 'maxPoint': maxPt, 'newPoints': newPoints };
+
+ return { maxPoint: maxPt, newPoints: newPoints };
},
+
+ /*
+ * Given a baseline, compute the convex hull of latLngs as an array
+ * of latLngs.
+ *
+ * @param {Array} latLngs
+ * @returns {Array}
+ */
buildConvexHull: function (baseLine, latLngs) {
var convexHullBaseLines = [],
t = this.findMostDistantPointFromBaseLine(baseLine, latLngs);
@@ -1532,12 +1553,19 @@ Retrieved from: http://en.literateprograms.org/Quickhull_(Javascript)?oldid=1843
);
return convexHullBaseLines;
} else { // if there is no more point "outside" the base line, the current base line is part of the convex hull
- return [baseLine];
+ return [baseLine[0]];
}
},
+ /*
+ * Given an array of latlngs, compute a convex hull as an array
+ * of latlngs
+ *
+ * @param {Array} latLngs
+ * @returns {Array}
+ */
getConvexHull: function (latLngs) {
- //find first baseline
+ // find first baseline
var maxLat = false, minLat = false,
maxPt = null, minPt = null,
i;
@@ -1564,24 +1592,18 @@ L.MarkerCluster.include({
getConvexHull: function () {
var childMarkers = this.getAllChildMarkers(),
points = [],
- hullLatLng = [],
- hull, p, i;
+ p, i;
for (i = childMarkers.length - 1; i >= 0; i--) {
p = childMarkers[i].getLatLng();
points.push(p);
}
- hull = L.QuickHull.getConvexHull(points);
-
- for (i = hull.length - 1; i >= 0; i--) {
- hullLatLng.push(hull[i][0]);
- }
-
- return hullLatLng;
+ return L.QuickHull.getConvexHull(points);
}
});
+
//This code is 100% based on https://github.com/jawj/OverlappingMarkerSpiderfier-Leaflet
//Huge thanks to jawj for implementing it first to make my job easy :-)
diff --git a/dist/leaflet.markercluster.js b/dist/leaflet.markercluster.js
index 079d2ed..9fb14ff 100644
--- a/dist/leaflet.markercluster.js
+++ b/dist/leaflet.markercluster.js
@@ -3,4 +3,4 @@
https://github.com/Leaflet/Leaflet.markercluster
(c) 2012-2013, Dave Leaver, smartrak
*/
-!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._featureG [...]
\ No newline at end of file
+!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._featureG [...]
\ No newline at end of file
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/leaflet-markercluster.git
More information about the Pkg-javascript-commits
mailing list