@pixerate/editor 0.74.0 → 0.75.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/THIRD_PARTY_NOTICES.md +2 -0
- package/dist/animation-editor/index.cjs +263 -144
- package/dist/animation-editor/index.cjs.map +1 -1
- package/dist/animation-editor/index.d.cts +96 -3
- package/dist/animation-editor/index.d.ts +96 -3
- package/dist/animation-editor/index.js +131 -12
- package/dist/animation-editor/index.js.map +1 -1
- package/dist/canvas/index.cjs +26 -26
- package/dist/canvas/index.js +2 -2
- package/dist/{chunk-3TLL5OID.js → chunk-4JLB2USO.js} +2 -2
- package/dist/{chunk-YJLCBA7V.cjs → chunk-7MD7C6XQ.cjs} +87 -87
- package/dist/{chunk-YJLCBA7V.cjs.map → chunk-7MD7C6XQ.cjs.map} +1 -1
- package/dist/{chunk-MLREO6J3.cjs → chunk-JEYDXRWQ.cjs} +46 -46
- package/dist/{chunk-MLREO6J3.cjs.map → chunk-JEYDXRWQ.cjs.map} +1 -1
- package/dist/{chunk-O2UH7LZE.cjs → chunk-XGD3FSNC.cjs} +239 -239
- package/dist/chunk-XGD3FSNC.cjs.map +1 -0
- package/dist/{chunk-VWZB6BCY.js → chunk-Y3NW4VJE.js} +2 -2
- package/dist/{chunk-GTMJ4Y3S.js → chunk-YCSFS3GK.js} +244 -244
- package/dist/{chunk-GTMJ4Y3S.js.map → chunk-YCSFS3GK.js.map} +1 -1
- package/dist/vector/index.cjs +532 -532
- package/dist/vector/index.js +3 -3
- package/package.json +1 -1
- package/dist/chunk-O2UH7LZE.cjs.map +0 -1
- /package/dist/{chunk-3TLL5OID.js.map → chunk-4JLB2USO.js.map} +0 -0
- /package/dist/{chunk-VWZB6BCY.js.map → chunk-Y3NW4VJE.js.map} +0 -0
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
|
|
19
|
-
var
|
|
19
|
+
var _chunkXGD3FSNCcjs = require('./chunk-XGD3FSNC.cjs');
|
|
20
20
|
|
|
21
21
|
// src/canvas/pathops/planar.ts
|
|
22
22
|
var twin = (h) => h ^ 1;
|
|
@@ -65,11 +65,11 @@ function pinEnds(pts, a, b) {
|
|
|
65
65
|
return out;
|
|
66
66
|
}
|
|
67
67
|
function interiorPoint(path) {
|
|
68
|
-
const chains = Array.isArray(path) && path.length > 0 && Array.isArray(path[0]) && Array.isArray(_optionalChain([path, 'access', _2 => _2[0], 'access', _3 => _3[0], 'optionalAccess', _4 => _4[0]])) ? path :
|
|
68
|
+
const chains = Array.isArray(path) && path.length > 0 && Array.isArray(path[0]) && Array.isArray(_optionalChain([path, 'access', _2 => _2[0], 'access', _3 => _3[0], 'optionalAccess', _4 => _4[0]])) ? path : _chunkXGD3FSNCcjs.pathToContours.call(void 0, path).map((c) => _chunkXGD3FSNCcjs.closeContour.call(void 0, c, true));
|
|
69
69
|
const b = boundsOf(chains.flat());
|
|
70
70
|
if (!(b.maxX > b.minX) || !(b.maxY > b.minY)) return null;
|
|
71
71
|
const tol = Math.max(b.maxX - b.minX, b.maxY - b.minY) * 1e-3;
|
|
72
|
-
const rings = chains.filter((c) => c.length).map((c) =>
|
|
72
|
+
const rings = chains.filter((c) => c.length).map((c) => _chunkXGD3FSNCcjs.flattenChain.call(void 0, c, tol));
|
|
73
73
|
let best = null;
|
|
74
74
|
for (const f of [0.5, 0.25, 0.75, 0.125, 0.375, 0.625, 0.875, 0.0625, 0.9375]) {
|
|
75
75
|
const y = b.minY + (b.maxY - b.minY) * (f + 61803e-7);
|
|
@@ -86,7 +86,7 @@ function interiorPoint(path) {
|
|
|
86
86
|
const width = xs[i + 1] - xs[i];
|
|
87
87
|
if (!(width > (_nullishCoalesce(_optionalChain([best, 'optionalAccess', _5 => _5.width]), () => ( 0))))) continue;
|
|
88
88
|
const m = [(xs[i] + xs[i + 1]) / 2, y];
|
|
89
|
-
if (
|
|
89
|
+
if (_chunkXGD3FSNCcjs.windingNumber.call(void 0, chains, m) !== 0) best = { width, p: m };
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
92
|
return _nullishCoalesce(_optionalChain([best, 'optionalAccess', _6 => _6.p]), () => ( null));
|
|
@@ -99,7 +99,7 @@ var PlanarMap = (_class = class _PlanarMap {
|
|
|
99
99
|
this.eps = eps;
|
|
100
100
|
this.inputCount = inputCount;
|
|
101
101
|
this.fills = inputs.map((input) => {
|
|
102
|
-
const chains = input.fills === false ? [] :
|
|
102
|
+
const chains = input.fills === false ? [] : _chunkXGD3FSNCcjs.pathToContours.call(void 0, input.path).filter((c) => c.closed).map((c) => _chunkXGD3FSNCcjs.closeContour.call(void 0, c));
|
|
103
103
|
return { chains, fillRule: _nullishCoalesce(input.fillRule, () => ( "nonzero")), bounds: boundsOf(chains.flat()) };
|
|
104
104
|
});
|
|
105
105
|
const nv = vertices.length;
|
|
@@ -110,7 +110,7 @@ var PlanarMap = (_class = class _PlanarMap {
|
|
|
110
110
|
if (list.length === 0) return;
|
|
111
111
|
const at = vertices[v];
|
|
112
112
|
let r = Infinity;
|
|
113
|
-
for (const h of list) r = Math.min(r,
|
|
113
|
+
for (const h of list) r = Math.min(r, _chunkXGD3FSNCcjs.dist.call(void 0, at, vertices[this.origin(twin(h))]));
|
|
114
114
|
r *= 0.5;
|
|
115
115
|
const keyed = list.map((h) => ({ h, angle: this.leavingAngle(h, at, r) }));
|
|
116
116
|
keyed.sort((a, b) => a.angle - b.angle);
|
|
@@ -148,12 +148,12 @@ var PlanarMap = (_class = class _PlanarMap {
|
|
|
148
148
|
* not settle) or have no edges.
|
|
149
149
|
*/
|
|
150
150
|
static build(inputs, options = {}) {
|
|
151
|
-
const chains = inputs.map((input) =>
|
|
151
|
+
const chains = inputs.map((input) => _chunkXGD3FSNCcjs.pathToContours.call(void 0, input.path).map((c) => _chunkXGD3FSNCcjs.closeContour.call(void 0, c)).filter((c) => c.length));
|
|
152
152
|
const count = chains.reduce((n, cs) => n + cs.reduce((m, c) => m + c.length, 0), 0);
|
|
153
153
|
if (count === 0 || count > (_nullishCoalesce(options.maxSegments, () => ( 4096)))) return null;
|
|
154
154
|
let split;
|
|
155
155
|
try {
|
|
156
|
-
split =
|
|
156
|
+
split = _chunkXGD3FSNCcjs.planarSplit.call(void 0, chains, options);
|
|
157
157
|
} catch (e2) {
|
|
158
158
|
return null;
|
|
159
159
|
}
|
|
@@ -181,7 +181,7 @@ var PlanarMap = (_class = class _PlanarMap {
|
|
|
181
181
|
/** Direction (angle) in which half-edge `h`, leaving `at`, first gets `r` away from it. */
|
|
182
182
|
leavingAngle(h, at, r) {
|
|
183
183
|
const pts = this.halfPts(h);
|
|
184
|
-
const d = (t2) =>
|
|
184
|
+
const d = (t2) => _chunkXGD3FSNCcjs.dist.call(void 0, _chunkXGD3FSNCcjs.segmentPoint.call(void 0, pts, t2), at);
|
|
185
185
|
let lo = 0;
|
|
186
186
|
let hi = 1;
|
|
187
187
|
const steps = pts.length === 2 ? 1 : 16;
|
|
@@ -197,9 +197,9 @@ var PlanarMap = (_class = class _PlanarMap {
|
|
|
197
197
|
if (d(m) >= r) hi = m;
|
|
198
198
|
else lo = m;
|
|
199
199
|
}
|
|
200
|
-
const p =
|
|
201
|
-
if (
|
|
202
|
-
const t =
|
|
200
|
+
const p = _chunkXGD3FSNCcjs.segmentPoint.call(void 0, pts, hi);
|
|
201
|
+
if (_chunkXGD3FSNCcjs.dist.call(void 0, p, at) > 0) return Math.atan2(p[1] - at[1], p[0] - at[0]);
|
|
202
|
+
const t = _chunkXGD3FSNCcjs.segmentTangent.call(void 0, pts, 0);
|
|
203
203
|
return Math.atan2(t[1], t[0]);
|
|
204
204
|
}
|
|
205
205
|
/** Segments of a run of half-edges (a loop unless `closed` is false), pieces of one input segment joined again. */
|
|
@@ -230,7 +230,7 @@ var PlanarMap = (_class = class _PlanarMap {
|
|
|
230
230
|
const a = this.vertices[this.origin(first.h)];
|
|
231
231
|
const b = this.vertices[this.origin(twin(last.h))];
|
|
232
232
|
const seg = this.sources[first.src];
|
|
233
|
-
out.push(seg.length === 2 ? [a, b] : pinEnds(
|
|
233
|
+
out.push(seg.length === 2 ? [a, b] : pinEnds(_chunkXGD3FSNCcjs.subSegment.call(void 0, seg, first.from, last.to), a, b));
|
|
234
234
|
}
|
|
235
235
|
i = j;
|
|
236
236
|
}
|
|
@@ -255,9 +255,9 @@ var PlanarMap = (_class = class _PlanarMap {
|
|
|
255
255
|
const cycle = withoutSpurs(walk);
|
|
256
256
|
if (!cycle.length) continue;
|
|
257
257
|
const segments = this.cycleSegments(cycle);
|
|
258
|
-
const area =
|
|
258
|
+
const area = _chunkXGD3FSNCcjs.contourSignedArea.call(void 0, segments);
|
|
259
259
|
let perimeter = 0;
|
|
260
|
-
for (const s of segments) perimeter += s.length === 2 ?
|
|
260
|
+
for (const s of segments) perimeter += s.length === 2 ? _chunkXGD3FSNCcjs.dist.call(void 0, s[0], s[1]) : _chunkXGD3FSNCcjs.segmentLength.call(void 0, s, 0, 1, 1e-6);
|
|
261
261
|
if (!(perimeter > 0)) continue;
|
|
262
262
|
const entry = { halves: cycle, segments, area, bounds: boundsOf(segments) };
|
|
263
263
|
if (area > 0 && 2 * area / perimeter >= sliver) faces.push(entry);
|
|
@@ -272,7 +272,7 @@ var PlanarMap = (_class = class _PlanarMap {
|
|
|
272
272
|
faces.forEach((face, i) => {
|
|
273
273
|
if (this.component[this.origin(face.halves[0])] === own || !inBounds(face.bounds, p)) return;
|
|
274
274
|
if (best >= 0 && faces[best].area <= face.area) return;
|
|
275
|
-
if (
|
|
275
|
+
if (_chunkXGD3FSNCcjs.windingNumber.call(void 0, [face.segments], p) !== 0) best = i;
|
|
276
276
|
});
|
|
277
277
|
if (best >= 0) faceHoles[best].push(k);
|
|
278
278
|
});
|
|
@@ -295,7 +295,7 @@ var PlanarMap = (_class = class _PlanarMap {
|
|
|
295
295
|
return faces.map((f, i) => {
|
|
296
296
|
const chains = this.faceChains(i);
|
|
297
297
|
const area = f.area + faceHoles[i].reduce((sum, k) => sum + holes[k].area, 0);
|
|
298
|
-
return { path:
|
|
298
|
+
return { path: _chunkXGD3FSNCcjs.contoursToPath.call(void 0, chains.map((segments) => ({ segments, closed: true }))), area, bounds: f.bounds };
|
|
299
299
|
});
|
|
300
300
|
}
|
|
301
301
|
/** The inputs whose fill covers face `i`, ascending (empty for an area only outlines enclose). */
|
|
@@ -308,7 +308,7 @@ var PlanarMap = (_class = class _PlanarMap {
|
|
|
308
308
|
if (p) {
|
|
309
309
|
this.fills.forEach((fill, k) => {
|
|
310
310
|
if (!fill.chains.length || !inBounds(fill.bounds, p)) return;
|
|
311
|
-
const w =
|
|
311
|
+
const w = _chunkXGD3FSNCcjs.windingNumber.call(void 0, fill.chains, p);
|
|
312
312
|
if (fill.fillRule === "evenodd" ? (w & 1) === 1 : w !== 0) out.push(k);
|
|
313
313
|
});
|
|
314
314
|
}
|
|
@@ -325,7 +325,7 @@ var PlanarMap = (_class = class _PlanarMap {
|
|
|
325
325
|
let best = -1;
|
|
326
326
|
faces.forEach((face, i) => {
|
|
327
327
|
if (!inBounds(face.bounds, p) || best >= 0 && faces[best].area <= face.area) return;
|
|
328
|
-
if (
|
|
328
|
+
if (_chunkXGD3FSNCcjs.windingNumber.call(void 0, this.faceChains(i), p) !== 0) best = i;
|
|
329
329
|
});
|
|
330
330
|
return best;
|
|
331
331
|
}
|
|
@@ -370,7 +370,7 @@ var PlanarMap = (_class = class _PlanarMap {
|
|
|
370
370
|
if (!ok || h !== start) continue;
|
|
371
371
|
contours.push({ segments: this.cycleSegments(cycle), closed: true });
|
|
372
372
|
}
|
|
373
|
-
return
|
|
373
|
+
return _chunkXGD3FSNCcjs.contoursToPath.call(void 0, contours);
|
|
374
374
|
}
|
|
375
375
|
/**
|
|
376
376
|
* The edges joined into runs between junctions: vertices where other than two edges meet, or
|
|
@@ -429,8 +429,8 @@ var PlanarMap = (_class = class _PlanarMap {
|
|
|
429
429
|
const ay = this.vertices[e.a][1];
|
|
430
430
|
const by = this.vertices[e.b][1];
|
|
431
431
|
if (ay > p[1] === by > p[1]) return;
|
|
432
|
-
const t =
|
|
433
|
-
const x =
|
|
432
|
+
const t = _chunkXGD3FSNCcjs.solveMonotone.call(void 0, e.pts, 1, p[1]);
|
|
433
|
+
const x = _chunkXGD3FSNCcjs.segmentPoint.call(void 0, e.pts, t)[0];
|
|
434
434
|
if (x > p[0]) hits.push({ x, e: i });
|
|
435
435
|
});
|
|
436
436
|
hits.sort((a, b) => a.x - b.x);
|
|
@@ -450,12 +450,12 @@ var PlanarMap = (_class = class _PlanarMap {
|
|
|
450
450
|
const cycle = withoutSpurs(walk);
|
|
451
451
|
if (!cycle.length) continue;
|
|
452
452
|
const segments = this.cycleSegments(cycle);
|
|
453
|
-
if (!(
|
|
453
|
+
if (!(_chunkXGD3FSNCcjs.contourSignedArea.call(void 0, segments) > 0) || _chunkXGD3FSNCcjs.windingNumber.call(void 0, [segments], p) === 0) continue;
|
|
454
454
|
const face = faceOf[cycle[0]];
|
|
455
455
|
if (face >= 0 && faces[face].halves.includes(cycle[0])) {
|
|
456
|
-
return
|
|
456
|
+
return _chunkXGD3FSNCcjs.contoursToPath.call(void 0, this.faceChains(face).map((s) => ({ segments: s, closed: true })));
|
|
457
457
|
}
|
|
458
|
-
return
|
|
458
|
+
return _chunkXGD3FSNCcjs.contoursToPath.call(void 0, [{ segments, closed: true }]);
|
|
459
459
|
}
|
|
460
460
|
return null;
|
|
461
461
|
}
|
|
@@ -483,7 +483,7 @@ function closeGaps(vertices, edges, gap) {
|
|
|
483
483
|
const pv = vertices[v];
|
|
484
484
|
if (pv[0] > pu[0] + gap) break;
|
|
485
485
|
if (v === u || joined.has(v) || linked.has(`${Math.min(u, v)},${Math.max(u, v)}`)) continue;
|
|
486
|
-
const d =
|
|
486
|
+
const d = _chunkXGD3FSNCcjs.dist.call(void 0, pu, pv);
|
|
487
487
|
if (d <= gap && d < bestD) {
|
|
488
488
|
best = v;
|
|
489
489
|
bestD = d;
|
|
@@ -498,17 +498,17 @@ function closeGaps(vertices, edges, gap) {
|
|
|
498
498
|
}
|
|
499
499
|
}
|
|
500
500
|
function contourEnclosesArea(contour) {
|
|
501
|
-
const segs =
|
|
501
|
+
const segs = _chunkXGD3FSNCcjs.closeContour.call(void 0, contour, true);
|
|
502
502
|
if (!segs.length) return false;
|
|
503
503
|
const b = boundsOf(segs);
|
|
504
504
|
const w = b.maxX - b.minX;
|
|
505
505
|
const h = b.maxY - b.minY;
|
|
506
|
-
return Math.abs(
|
|
506
|
+
return Math.abs(_chunkXGD3FSNCcjs.contourSignedArea.call(void 0, segs)) > 1e-9 * (w * w + h * h);
|
|
507
507
|
}
|
|
508
508
|
function nearestU(segs, p) {
|
|
509
509
|
let best = null;
|
|
510
510
|
segs.forEach((seg, k) => {
|
|
511
|
-
const n =
|
|
511
|
+
const n = _chunkXGD3FSNCcjs.segmentNearest.call(void 0, seg, p);
|
|
512
512
|
if (!best || n.distance < best.d) best = { u: k + n.t, d: n.distance };
|
|
513
513
|
});
|
|
514
514
|
return best;
|
|
@@ -522,7 +522,7 @@ function span(segs, u0, u1) {
|
|
|
522
522
|
for (let k = first; k < last; k++) {
|
|
523
523
|
const t0 = Math.min(1, Math.max(0, u0 - k));
|
|
524
524
|
const t1 = Math.min(1, Math.max(0, u1 - k));
|
|
525
|
-
if (t1 - t0 > 1e-12) out.push(
|
|
525
|
+
if (t1 - t0 > 1e-12) out.push(_chunkXGD3FSNCcjs.subSegment.call(void 0, segs[k % n], t0, t1));
|
|
526
526
|
}
|
|
527
527
|
return out;
|
|
528
528
|
}
|
|
@@ -530,7 +530,7 @@ function snapEnds(segs, to, tol) {
|
|
|
530
530
|
if (!segs.length) return segs;
|
|
531
531
|
const out = segs.map((s) => [...s]);
|
|
532
532
|
const move = (seg, end, handle) => {
|
|
533
|
-
const q = to.find((t) =>
|
|
533
|
+
const q = to.find((t) => _chunkXGD3FSNCcjs.dist.call(void 0, t, seg[end]) <= tol);
|
|
534
534
|
if (!q) return;
|
|
535
535
|
const d = [q[0] - seg[end][0], q[1] - seg[end][1]];
|
|
536
536
|
seg[end] = q;
|
|
@@ -548,31 +548,31 @@ function cutOutPiece(path, piece, fillCloses, tol) {
|
|
|
548
548
|
let longest = -1;
|
|
549
549
|
let perimeter = 0;
|
|
550
550
|
for (const seg of segs) {
|
|
551
|
-
const len2 =
|
|
551
|
+
const len2 = _chunkXGD3FSNCcjs.segmentLength.call(void 0, seg);
|
|
552
552
|
perimeter += len2;
|
|
553
553
|
if (len2 > longest) {
|
|
554
554
|
longest = len2;
|
|
555
|
-
mid =
|
|
555
|
+
mid = _chunkXGD3FSNCcjs.segmentPoint.call(void 0, seg, 0.5);
|
|
556
556
|
}
|
|
557
557
|
}
|
|
558
558
|
if (!mid || perimeter <= tol) return null;
|
|
559
559
|
const a = segs[0][0];
|
|
560
560
|
const lastSeg = segs[segs.length - 1];
|
|
561
561
|
const b = lastSeg[lastSeg.length - 1];
|
|
562
|
-
const whole = !!piece.closed ||
|
|
563
|
-
const contours =
|
|
562
|
+
const whole = !!piece.closed || _chunkXGD3FSNCcjs.dist.call(void 0, a, b) <= tol;
|
|
563
|
+
const contours = _chunkXGD3FSNCcjs.pathToContours.call(void 0, path);
|
|
564
564
|
let found = null;
|
|
565
565
|
contours.forEach((c, index2) => {
|
|
566
566
|
if (!c.segments.length) return;
|
|
567
567
|
const closed2 = c.closed || fillCloses && contourEnclosesArea(c);
|
|
568
|
-
const ring2 =
|
|
568
|
+
const ring2 = _chunkXGD3FSNCcjs.closeContour.call(void 0, c, closed2);
|
|
569
569
|
const n = nearestU(ring2, mid);
|
|
570
570
|
if (n && n.d <= tol && (!found || n.d < found.d)) found = { index: index2, ring: ring2, closed: closed2, um: n.u, d: n.d };
|
|
571
571
|
});
|
|
572
572
|
if (!found) return null;
|
|
573
573
|
const { index, ring, closed, um } = found;
|
|
574
574
|
const len = ring.length;
|
|
575
|
-
const real =
|
|
575
|
+
const real = _chunkXGD3FSNCcjs.closeContour.call(void 0, contours[index]).length;
|
|
576
576
|
const at = (p) => {
|
|
577
577
|
const n = nearestU(ring, p);
|
|
578
578
|
return n && n.d <= tol ? n.u : null;
|
|
@@ -603,21 +603,21 @@ function cutOutPiece(path, piece, fillCloses, tol) {
|
|
|
603
603
|
if (run.length) out.push({ segments: snapEnds(run, [a, b], tol), closed: false });
|
|
604
604
|
}
|
|
605
605
|
out.push(...contours.slice(index + 1));
|
|
606
|
-
return
|
|
606
|
+
return _chunkXGD3FSNCcjs.contoursToPath.call(void 0, out);
|
|
607
607
|
}
|
|
608
608
|
|
|
609
609
|
// src/canvas/pathops/hatch.ts
|
|
610
610
|
function hatchPath(path, options = {}) {
|
|
611
611
|
const out = [];
|
|
612
|
-
const b =
|
|
612
|
+
const b = _chunkXGD3FSNCcjs.bezierPathBounds.call(void 0, path);
|
|
613
613
|
if (!b || b.maxX - b.minX <= 0 || b.maxY - b.minY <= 0) return out;
|
|
614
614
|
const want = Math.max(_nullishCoalesce(options.gap, () => ( 4)), 1e-3);
|
|
615
615
|
const s = Math.SQRT1_2;
|
|
616
616
|
const rot = (p) => [(p[0] + p[1]) * s, (p[1] - p[0]) * s];
|
|
617
617
|
const unrot = (x, y) => ({ x: (x - y) * s, y: (x + y) * s });
|
|
618
618
|
const edges = [];
|
|
619
|
-
for (const contour of
|
|
620
|
-
const pts =
|
|
619
|
+
for (const contour of _chunkXGD3FSNCcjs.pathToContours.call(void 0, path)) {
|
|
620
|
+
const pts = _chunkXGD3FSNCcjs.flattenChain.call(void 0, _chunkXGD3FSNCcjs.closeContour.call(void 0, contour, true), want * 0.1).map(rot);
|
|
621
621
|
for (let i = 0; i < pts.length; i++) {
|
|
622
622
|
const p = pts[i];
|
|
623
623
|
const q = pts[(i + 1) % pts.length];
|
|
@@ -658,7 +658,7 @@ function pathfinder(op, shapes, options = {}) {
|
|
|
658
658
|
options
|
|
659
659
|
);
|
|
660
660
|
if (!map) return { pieces: [], engine: "curve", error: "could not map the outlines" };
|
|
661
|
-
const pieces = map.chains().map((c) => ({ path:
|
|
661
|
+
const pieces = map.chains().map((c) => ({ path: _chunkXGD3FSNCcjs.contoursToPath.call(void 0, [{ segments: c.segments, closed: c.closed }]), source: c.source, open: !c.closed }));
|
|
662
662
|
return { pieces, engine: "curve" };
|
|
663
663
|
}
|
|
664
664
|
if (op === "divide") {
|
|
@@ -672,7 +672,7 @@ function pathfinder(op, shapes, options = {}) {
|
|
|
672
672
|
});
|
|
673
673
|
return { pieces, engine: "curve" };
|
|
674
674
|
}
|
|
675
|
-
const result =
|
|
675
|
+
const result = _chunkXGD3FSNCcjs.dividePaths.call(void 0, operands, options);
|
|
676
676
|
return { ...report(result), pieces: result.pieces.map((p) => ({ path: p.path, source: top(p.operands) })) };
|
|
677
677
|
}
|
|
678
678
|
const index = shapes.flatMap((s, i) => s.line ? [] : [i]);
|
|
@@ -680,7 +680,7 @@ function pathfinder(op, shapes, options = {}) {
|
|
|
680
680
|
if (m === 0) return { pieces: [], engine: "curve" };
|
|
681
681
|
const ops = index.map((i) => operands[i]);
|
|
682
682
|
const key = (k) => _nullishCoalesce(shapes[index[k]].key, () => ( index[k]));
|
|
683
|
-
const select = (selectors) =>
|
|
683
|
+
const select = (selectors) => _chunkXGD3FSNCcjs.pathBooleanSelect.call(void 0, ops, selectors, options);
|
|
684
684
|
const joined = (parts) => parts.flat();
|
|
685
685
|
switch (op) {
|
|
686
686
|
case "trim": {
|
|
@@ -722,7 +722,7 @@ function report(r) {
|
|
|
722
722
|
return { engine: r.engine, ...r.fallbackReason ? { fallbackReason: r.fallbackReason } : {}, ...r.error ? { error: r.error } : {} };
|
|
723
723
|
}
|
|
724
724
|
function closeAll(path) {
|
|
725
|
-
return
|
|
725
|
+
return _chunkXGD3FSNCcjs.contoursToPath.call(void 0, _chunkXGD3FSNCcjs.pathToContours.call(void 0, path).map((c) => ({ segments: c.segments, closed: true })));
|
|
726
726
|
}
|
|
727
727
|
|
|
728
728
|
|
|
@@ -734,4 +734,4 @@ function closeAll(path) {
|
|
|
734
734
|
|
|
735
735
|
|
|
736
736
|
exports.interiorPoint = interiorPoint; exports.PlanarMap = PlanarMap; exports.contourEnclosesArea = contourEnclosesArea; exports.cutOutPiece = cutOutPiece; exports.hatchPath = hatchPath; exports.PATHFINDER_OPERATIONS = PATHFINDER_OPERATIONS; exports.pathfinder = pathfinder;
|
|
737
|
-
//# sourceMappingURL=chunk-
|
|
737
|
+
//# sourceMappingURL=chunk-JEYDXRWQ.cjs.map
|