@pixerate/editor 0.33.0 → 0.34.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 +15 -0
- package/dist/{bezier-DJPYiVbA.d.ts → bezier-BvqVmWMg.d.ts} +1 -1
- package/dist/{bezier-6KPx3w7Z.d.cts → bezier-D8bsO-L0.d.cts} +1 -1
- package/dist/canvas/index.cjs +93 -91
- package/dist/canvas/index.cjs.map +1 -1
- package/dist/canvas/index.d.cts +51 -3
- package/dist/canvas/index.d.ts +51 -3
- package/dist/canvas/index.js +3 -1
- package/dist/canvas/index.js.map +1 -1
- package/dist/{chunk-GQTXV2EQ.js → chunk-RK6HUKDI.js} +20 -1
- package/dist/{chunk-GQTXV2EQ.js.map → chunk-RK6HUKDI.js.map} +1 -1
- package/dist/{chunk-M4XE4UMT.cjs → chunk-UG5DVXJK.cjs} +21 -2
- package/dist/chunk-UG5DVXJK.cjs.map +1 -0
- package/dist/vector/index.cjs +1029 -123
- package/dist/vector/index.cjs.map +1 -1
- package/dist/vector/index.d.cts +266 -4
- package/dist/vector/index.d.ts +266 -4
- package/dist/vector/index.js +939 -33
- package/dist/vector/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-M4XE4UMT.cjs.map +0 -1
|
@@ -2651,6 +2651,24 @@ function intersectSubdivided(P, p0, p1, Q, q0, q1, fullP, fullQ, ctx, out, depth
|
|
|
2651
2651
|
intersectSubdivided(P, p0, p1, qb, qm, q1, fullP, fullQ, ctx, out, depth + 1);
|
|
2652
2652
|
}
|
|
2653
2653
|
}
|
|
2654
|
+
function segmentIntersections(a, b, options = {}) {
|
|
2655
|
+
let size = 1;
|
|
2656
|
+
for (const [x, y] of [...a, ...b]) size = Math.max(size, Math.abs(x), Math.abs(y));
|
|
2657
|
+
const eps = options.epsilon ?? size * 1e-9;
|
|
2658
|
+
const found = [];
|
|
2659
|
+
const ctx = { eps, leaves: 0, budget: options.budget ?? 4096 };
|
|
2660
|
+
try {
|
|
2661
|
+
intersectSubdivided(a.slice(), 0, 1, b.slice(), 0, 1, a, b, ctx, found, 0);
|
|
2662
|
+
} catch (error) {
|
|
2663
|
+
if (!(error instanceof PathOpsError)) throw error;
|
|
2664
|
+
}
|
|
2665
|
+
const out = [];
|
|
2666
|
+
for (const ev of found.sort((x, y) => x.tp - y.tp)) {
|
|
2667
|
+
if (out.some((o) => dist2(o.point, ev.point) <= eps * 4)) continue;
|
|
2668
|
+
out.push({ ta: ev.tp, tb: ev.tq, point: ev.point });
|
|
2669
|
+
}
|
|
2670
|
+
return out;
|
|
2671
|
+
}
|
|
2654
2672
|
function nearestOn(piece, p, eps) {
|
|
2655
2673
|
if (p[0] < piece.minX - eps || p[0] > piece.maxX + eps || p[1] < piece.minY - eps || p[1] > piece.maxY + eps) return null;
|
|
2656
2674
|
return segmentNearest(piece.pts, p);
|
|
@@ -3321,6 +3339,7 @@ export {
|
|
|
3321
3339
|
distanceToBezierPath,
|
|
3322
3340
|
flattenChain,
|
|
3323
3341
|
PathOpsError,
|
|
3342
|
+
segmentIntersections,
|
|
3324
3343
|
pathBoolean,
|
|
3325
3344
|
unitePaths,
|
|
3326
3345
|
intersectPaths,
|
|
@@ -3332,4 +3351,4 @@ export {
|
|
|
3332
3351
|
pathBooleanRings,
|
|
3333
3352
|
nestedRingsToPath
|
|
3334
3353
|
};
|
|
3335
|
-
//# sourceMappingURL=chunk-
|
|
3354
|
+
//# sourceMappingURL=chunk-RK6HUKDI.js.map
|