[Pkg-javascript-commits] [leaflet-markercluster] 31/479: Should probably have this code compiling before I go refactoring
Jonas Smedegaard
dr at jones.dk
Thu Oct 16 16:00:05 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 f03acfaecfd4525948e6b17e34e0ccd47cb935e2
Author: danzel <danzel at localhost.geek.nz>
Date: Wed Jul 18 11:00:05 2012 +1200
Should probably have this code compiling before I go refactoring
---
example/marker-clustering-convexhull.html | 17 ++---------------
src/MarkerCluster.QuickHull.js | 8 ++++----
2 files changed, 6 insertions(+), 19 deletions(-)
diff --git a/example/marker-clustering-convexhull.html b/example/marker-clustering-convexhull.html
index 6e4531b..5b3490f 100644
--- a/example/marker-clustering-convexhull.html
+++ b/example/marker-clustering-convexhull.html
@@ -65,21 +65,8 @@
if (a.layer instanceof L.MarkerCluster) {
console.log('cluster ' + a.layer.getAllChildMarkers().length);
//a.layer.zoomToBounds();
- var ms = a.layer.getAllChildMarkers();
- var p = [];
- for (var i = 0; i < ms.length; i++) {
- var ll = ms[i].getLatLng();
- p.push([ll.lat, ll.lng]);
- }
- var hull = L.QuickHull.getConvexHull(p);
- var hullll = [];
- for (var i = 0; i < hull.length; i++) {
- var p = hull[i];
- var ll = new L.LatLng(p[0][0], p[0][1]);
- hullll.push(ll);
- }
-
- var path = new L.Polygon(hullll);
+
+ var path = new L.Polygon(a.layer.getConvexHull());
map.addLayer(path);
} else {
console.log('marker ' + a.layer);
diff --git a/src/MarkerCluster.QuickHull.js b/src/MarkerCluster.QuickHull.js
index b2afe46..5012904 100644
--- a/src/MarkerCluster.QuickHull.js
+++ b/src/MarkerCluster.QuickHull.js
@@ -103,14 +103,14 @@ L.MarkerCluster.include({
hullLatLng = [],
hull, p, i;
- for (var i = ms.lenght; i >= 0; i--) {
- ll = ms[i].getLatLng();
- points.push([ll.lat, ll.lng]);
+ for (i = childMarkers.length - 1; i >= 0; i--) {
+ p = childMarkers[i].getLatLng();
+ points.push([p.lat, p.lng]);
}
hull = L.QuickHull.getConvexHull(points);
- for (var i = 0; i < hull.length; i++) {
+ for (i = 0; i < hull.length; i++) {
p = hull[i];
hullLatLng.push(new L.LatLng(p[0][0], p[0][1]));
}
--
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