[Pkg-javascript-commits] [leaflet-markercluster] 32/479: tidy up JS

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 9da6156fd49c93d957058c4f50b57215b7db515e
Author: danzel <danzel at localhost.geek.nz>
Date:   Wed Jul 18 11:01:54 2012 +1200

    tidy up JS
---
 src/MarkerCluster.QuickHull.js | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/src/MarkerCluster.QuickHull.js b/src/MarkerCluster.QuickHull.js
index 5012904..db2f3a7 100644
--- a/src/MarkerCluster.QuickHull.js
+++ b/src/MarkerCluster.QuickHull.js
@@ -27,9 +27,9 @@ Retrieved from: http://en.literateprograms.org/Quickhull_(Javascript)?oldid=1843
 (function () {
 	L.QuickHull = {
 		getDistant: function (cpt, bl) {
-			var Vy = bl[1][0] - bl[0][0];
-			var Vx = bl[0][1] - bl[1][1];
-			return (Vx * (cpt[0] - bl[0][0]) + Vy * (cpt[1] - bl[0][1]))
+			var vY = bl[1][0] - bl[0][0];
+			var vX = bl[0][1] - bl[1][1];
+			return (vX * (cpt[0] - bl[0][0]) + vY * (cpt[1] - bl[0][1]));
 		},
 
 
@@ -53,7 +53,7 @@ Retrieved from: http://en.literateprograms.org/Quickhull_(Javascript)?oldid=1843
 				}
 
 			}
-			return { 'maxPoint': maxPt, 'newPoints': newPoints }
+			return { 'maxPoint': maxPt, 'newPoints': newPoints };
 		},
 
 		buildConvexHull: function (baseLine, points) {
@@ -76,24 +76,25 @@ Retrieved from: http://en.literateprograms.org/Quickhull_(Javascript)?oldid=1843
 
 		getConvexHull: function (points) {
 			//find first baseline
-			var maxX, minX;
-			var maxPt, minPt;
+			var maxX = false, minX = false;
+			var maxPt = null, minPt = null;
+
 			for (var idx in points) {
 				var pt = points[idx];
-				if (pt[0] > maxX || !maxX) {
+				if (maxX === false || pt[0] > maxX) {
 					maxPt = pt;
 					maxX = pt[0];
 				}
-				if (pt[0] < minX || !minX) {
+				if (minX === false || pt[0] < minX) {
 					minPt = pt;
 					minX = pt[0];
 				}
 			}
 			var ch = [].concat(this.buildConvexHull([minPt, maxPt], points),
-								this.buildConvexHull([maxPt, minPt], points))
+								this.buildConvexHull([maxPt, minPt], points));
 			return ch;
 		}
-	}
+	};
 }());
 
 L.MarkerCluster.include({

-- 
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