Skip to content

Commit 6ba3cbe

Browse files
authored
Earcut: Updated to latest version. (#31956)
* merge latest earcut changes fix hashed earcut not taking the first point into account * updated version headers
1 parent e43225c commit 6ba3cbe

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/extras/lib/earcut.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* eslint-disable */
2-
// copy of mapbox/earcut version 3.0.1
3-
// https://github.com/mapbox/earcut/tree/v3.0.1
2+
// copy of mapbox/earcut version 3.0.2
3+
// https://github.com/mapbox/earcut/tree/v3.0.2
44

55
export default function earcut(data, holeIndices, dim = 2) {
66

@@ -17,10 +17,10 @@ export default function earcut(data, holeIndices, dim = 2) {
1717

1818
// if the shape is not too simple, we'll use z-order curve hash later; calculate polygon bbox
1919
if (data.length > 80 * dim) {
20-
minX = Infinity;
21-
minY = Infinity;
22-
let maxX = -Infinity;
23-
let maxY = -Infinity;
20+
minX = data[0];
21+
minY = data[1];
22+
let maxX = minX;
23+
let maxY = minY;
2424

2525
for (let i = dim; i < outerLen; i += dim) {
2626
const x = data[i];
@@ -296,7 +296,7 @@ function compareXYSlope(a, b) {
296296
return result;
297297
}
298298

299-
// find a bridge between vertices that connects hole with an outer ring and and link it
299+
// find a bridge between vertices that connects hole with an outer ring and link it
300300
function eliminateHole(hole, outerNode) {
301301
const bridge = findHoleBridge(hole, outerNode);
302302
if (!bridge) {

0 commit comments

Comments
 (0)