Skip to content

Commit 188a0db

Browse files
committed
inline rectFirstEdgeTest
1 parent 3c40c41 commit 188a0db

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

src/lib/polygon.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,24 +49,21 @@ polygon.tester = function tester(ptsIn) {
4949
var isRect = false,
5050
rectFirstEdgeTest;
5151

52-
function onFirstVert(pt) { return pt[0] === pts[0][0]; }
53-
function onFirstHorz(pt) { return pt[1] === pts[0][1]; }
54-
5552
if(pts.length === 5) {
5653
if(pts[0][0] === pts[1][0]) { // vert, horz, vert, horz
5754
if(pts[2][0] === pts[3][0] &&
5855
pts[0][1] === pts[3][1] &&
5956
pts[1][1] === pts[2][1]) {
6057
isRect = true;
61-
rectFirstEdgeTest = onFirstVert;
58+
rectFirstEdgeTest = function(pt) { return pt[0] === pts[0][0]; };
6259
}
6360
}
6461
else if(pts[0][1] === pts[1][1]) { // horz, vert, horz, vert
6562
if(pts[2][1] === pts[3][1] &&
6663
pts[0][0] === pts[3][0] &&
6764
pts[1][0] === pts[2][0]) {
6865
isRect = true;
69-
rectFirstEdgeTest = onFirstHorz;
66+
rectFirstEdgeTest = function(pt) { return pt[1] === pts[0][1]; };
7067
}
7168
}
7269
}

0 commit comments

Comments
 (0)