Skip to content

Commit e1370f3

Browse files
committed
Ignore EarCut from jshint. Too many errors.
1 parent 69db363 commit e1370f3

1 file changed

Lines changed: 32 additions & 28 deletions

File tree

src/utils/EarCut.js

Lines changed: 32 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/* jshint ignore:start */
2+
13
/*
24
Copyright (c) 2016, Mapbox
35
@@ -55,7 +57,7 @@ Phaser.EarCut.Triangulate = function (data, holeIndices, dim) {
5557
Phaser.EarCut.earcutLinked(outerNode, triangles, dim, minX, minY, size);
5658

5759
return triangles;
58-
}
60+
};
5961

6062
// create a circular doubly linked list from polygon points in the specified winding order
6163

@@ -77,7 +79,7 @@ Phaser.EarCut.linkedList = function (data, start, end, dim, clockwise) {
7779
}
7880

7981
return last;
80-
}
82+
};
8183

8284
// eliminate colinear or duplicate points
8385

@@ -102,7 +104,7 @@ Phaser.EarCut.filterPoints = function (start, end) {
102104
} while (again || p !== end);
103105

104106
return end;
105-
}
107+
};
106108

107109
// main ear slicing loop which triangulates a polygon (given as a linked list)
108110

@@ -156,7 +158,7 @@ Phaser.EarCut.earcutLinked = function (ear, triangles, dim, minX, minY, size, pa
156158
break;
157159
}
158160
}
159-
}
161+
};
160162

161163
// check whether a polygon node forms a valid ear with adjacent nodes
162164

@@ -177,7 +179,7 @@ Phaser.EarCut.isEar = function (ear) {
177179
}
178180

179181
return true;
180-
}
182+
};
181183

182184
Phaser.EarCut.isEarHashed = function (ear, minX, minY, size) {
183185
var a = ear.prev,
@@ -217,7 +219,7 @@ Phaser.EarCut.isEarHashed = function (ear, minX, minY, size) {
217219
}
218220

219221
return true;
220-
}
222+
};
221223

222224
// go through all polygon nodes and cure small local self-intersections
223225

@@ -244,7 +246,7 @@ Phaser.EarCut.cureLocalIntersections = function (start, triangles, dim) {
244246
} while (p !== start);
245247

246248
return p;
247-
}
249+
};
248250

249251
// try splitting polygon into two and triangulate them independently
250252

@@ -271,7 +273,7 @@ Phaser.EarCut.splitEarcut = function (start, triangles, dim, minX, minY, size) {
271273
}
272274
a = a.next;
273275
} while (a !== start);
274-
}
276+
};
275277

276278
// link every hole into the outer loop, producing a single-ring polygon without holes
277279

@@ -296,11 +298,11 @@ Phaser.EarCut.eliminateHoles = function (data, holeIndices, outerNode, dim) {
296298
}
297299

298300
return outerNode;
299-
}
301+
};
300302

301303
Phaser.EarCut.compareX = function (a, b) {
302304
return a.x - b.x;
303-
}
305+
};
304306

305307
// find a bridge between vertices that connects hole with an outer ring and and link it
306308

@@ -310,7 +312,7 @@ Phaser.EarCut.eliminateHole = function (hole, outerNode) {
310312
var b = Phaser.EarCut.splitPolygon(outerNode, hole);
311313
Phaser.EarCut.filterPoints(b, b.next);
312314
}
313-
}
315+
};
314316

315317
// David Eberly's algorithm for finding a bridge between hole and outer polygon
316318

@@ -364,7 +366,7 @@ Phaser.EarCut.findHoleBridge = function (hole, outerNode) {
364366
}
365367

366368
return m;
367-
}
369+
};
368370

369371
// interlink polygon nodes in z-order
370372

@@ -381,7 +383,7 @@ Phaser.EarCut.indexCurve = function (start, minX, minY, size) {
381383
p.prevZ = null;
382384

383385
Phaser.EarCut.sortLinked(p);
384-
}
386+
};
385387

386388
// Simon Tatham's linked list merge sort algorithm
387389
// http://www.chiark.greenend.org.uk/~sgtatham/algorithms/listsort.html
@@ -444,7 +446,7 @@ Phaser.EarCut.sortLinked = function (list) {
444446
} while (numMerges > 1);
445447

446448
return list;
447-
}
449+
};
448450

449451
// z-order of a point given coords and size of the data bounding box
450452

@@ -464,7 +466,7 @@ Phaser.EarCut.zOrder = function (x, y, minX, minY, size) {
464466
y = (y | (y << 1)) & 0x55555555;
465467

466468
return x | (y << 1);
467-
}
469+
};
468470

469471
// find the leftmost node of a polygon ring
470472

@@ -477,41 +479,41 @@ Phaser.EarCut.getLeftmost = function (start) {
477479
} while (p !== start);
478480

479481
return leftmost;
480-
}
482+
};
481483

482484
// check if a point lies within a convex triangle
483485

484486
Phaser.EarCut.pointInTriangle = function (ax, ay, bx, by, cx, cy, px, py) {
485487
return (cx - px) * (ay - py) - (ax - px) * (cy - py) >= 0 &&
486488
(ax - px) * (by - py) - (bx - px) * (ay - py) >= 0 &&
487489
(bx - px) * (cy - py) - (cx - px) * (by - py) >= 0;
488-
}
490+
};
489491

490492
// check if a diagonal between two polygon nodes is valid (lies in polygon interior)
491493

492494
Phaser.EarCut.isValidDiagonal = function (a, b) {
493495
return Phaser.EarCut.equals(a, b) || a.next.i !== b.i && a.prev.i !== b.i && !Phaser.EarCut.intersectsPolygon(a, b) &&
494496
Phaser.EarCut.locallyInside(a, b) && Phaser.EarCut.locallyInside(b, a) && Phaser.EarCut.middleInside(a, b);
495-
}
497+
};
496498

497499
// signed area of a triangle
498500

499501
Phaser.EarCut.area = function (p, q, r) {
500502
return (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y);
501-
}
503+
};
502504

503505
// check if two points are equal
504506

505507
Phaser.EarCut.equals = function (p1, p2) {
506508
return p1.x === p2.x && p1.y === p2.y;
507-
}
509+
};
508510

509511
// check if two segments intersect
510512

511513
Phaser.EarCut.intersects = function (p1, q1, p2, q2) {
512514
return Phaser.EarCut.area(p1, q1, p2) > 0 !== Phaser.EarCut.area(p1, q1, q2) > 0 &&
513515
Phaser.EarCut.area(p2, q2, p1) > 0 !== Phaser.EarCut.area(p2, q2, q1) > 0;
514-
}
516+
};
515517

516518
// check if a polygon diagonal intersects any polygon segments
517519

@@ -524,15 +526,15 @@ Phaser.EarCut.intersectsPolygon = function (a, b) {
524526
} while (p !== a);
525527

526528
return false;
527-
}
529+
};
528530

529531
// check if a polygon diagonal is locally inside the polygon
530532

531533
Phaser.EarCut.locallyInside = function (a, b) {
532534
return Phaser.EarCut.area(a.prev, a, a.next) < 0 ?
533535
Phaser.EarCut.area(a, b, a.next) >= 0 && Phaser.EarCut.area(a, a.prev, b) >= 0 :
534536
Phaser.EarCut.area(a, b, a.prev) < 0 || Phaser.EarCut.area(a, a.next, b) < 0;
535-
}
537+
};
536538

537539
// check if the middle point of a polygon diagonal is inside the polygon
538540

@@ -548,7 +550,7 @@ Phaser.EarCut.middleInside = function (a, b) {
548550
} while (p !== a);
549551

550552
return inside;
551-
}
553+
};
552554

553555
// link two polygon vertices with a bridge; if the vertices belong to the same ring, it splits polygon into two;
554556
// if one belongs to the outer ring and another to a hole, it merges it into a single ring
@@ -572,7 +574,7 @@ Phaser.EarCut.splitPolygon = function (a, b) {
572574
b2.prev = bp;
573575

574576
return b2;
575-
}
577+
};
576578

577579
// create a node and optionally link it with previous one (in a circular doubly linked list)
578580

@@ -590,15 +592,15 @@ Phaser.EarCut.insertNode = function (i, x, y, last) {
590592
last.next = p;
591593
}
592594
return p;
593-
}
595+
};
594596

595597
Phaser.EarCut.removeNode = function (p) {
596598
p.next.prev = p.prev;
597599
p.prev.next = p.next;
598600

599601
if (p.prevZ) p.prevZ.nextZ = p.nextZ;
600602
if (p.nextZ) p.nextZ.prevZ = p.prevZ;
601-
}
603+
};
602604

603605
Phaser.EarCut.Node = function (i, x, y) {
604606
// vertice index in coordinates array
@@ -621,4 +623,6 @@ Phaser.EarCut.Node = function (i, x, y) {
621623

622624
// indicates whether this is a steiner point
623625
this.steiner = false;
624-
}
626+
};
627+
628+
/* jshint ignore:end */

0 commit comments

Comments
 (0)