@pixerate/editor 0.35.0 → 0.37.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 +17 -0
- package/dist/canvas/index.cjs +25 -25
- package/dist/canvas/index.d.cts +3 -217
- package/dist/canvas/index.d.ts +3 -217
- package/dist/canvas/index.js +1 -1
- package/dist/{chunk-BGNPT5PE.cjs → chunk-GVB7ZPLZ.cjs} +24 -3
- package/dist/chunk-GVB7ZPLZ.cjs.map +1 -0
- package/dist/{chunk-EGPIVUEF.js → chunk-HPEKB352.js} +23 -2
- package/dist/chunk-HPEKB352.js.map +1 -0
- package/dist/{bezier-D8bsO-L0.d.cts → stroke-CWjFKal4.d.cts} +215 -1
- package/dist/{bezier-BvqVmWMg.d.ts → stroke-ysgaPpAo.d.ts} +215 -1
- package/dist/vector/index.cjs +2262 -388
- package/dist/vector/index.cjs.map +1 -1
- package/dist/vector/index.d.cts +704 -25
- package/dist/vector/index.d.ts +704 -25
- package/dist/vector/index.js +2107 -233
- package/dist/vector/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-BGNPT5PE.cjs.map +0 -1
- package/dist/chunk-EGPIVUEF.js.map +0 -1
|
@@ -275,6 +275,25 @@ function buildOverlay(inputs, options) {
|
|
|
275
275
|
const edges = [...byKey.values()].filter((e) => e.mult.some((m) => m !== 0));
|
|
276
276
|
const right = [];
|
|
277
277
|
const left = [];
|
|
278
|
+
const bandCount = Math.max(1, Math.min(4096, Math.ceil(Math.sqrt(edges.length))));
|
|
279
|
+
const bandIndex = (horizontal) => {
|
|
280
|
+
const lo = (e) => horizontal ? Math.min(-e.a.x, -e.b.x) : Math.min(e.a.y, e.b.y);
|
|
281
|
+
const hi = (e) => horizontal ? Math.max(-e.a.x, -e.b.x) : Math.max(e.a.y, e.b.y);
|
|
282
|
+
let min = Infinity;
|
|
283
|
+
let max = -Infinity;
|
|
284
|
+
for (const e of edges) {
|
|
285
|
+
min = Math.min(min, lo(e));
|
|
286
|
+
max = Math.max(max, hi(e));
|
|
287
|
+
}
|
|
288
|
+
const size = max > min ? (max - min) / bandCount : 1;
|
|
289
|
+
const band = (v) => Math.min(bandCount - 1, Math.max(0, Math.floor((v - min) / size)));
|
|
290
|
+
const bands = Array.from({ length: bandCount }, () => []);
|
|
291
|
+
edges.forEach((e, j) => {
|
|
292
|
+
for (let k = band(lo(e)); k <= band(hi(e)); k++) bands[k].push(j);
|
|
293
|
+
});
|
|
294
|
+
return (v) => bands[band(v)];
|
|
295
|
+
};
|
|
296
|
+
const bandsFor = /* @__PURE__ */ new Map();
|
|
278
297
|
for (let i = 0; i < edges.length; i++) {
|
|
279
298
|
const edge = edges[i];
|
|
280
299
|
const horizontal = Math.abs(edge.b.y - edge.a.y) < Math.abs(edge.b.x - edge.a.x);
|
|
@@ -287,7 +306,8 @@ function buildOverlay(inputs, options) {
|
|
|
287
306
|
const mx = (ax + bx) / 2;
|
|
288
307
|
const my = (ay + by) / 2;
|
|
289
308
|
const winding = new Array(count).fill(0);
|
|
290
|
-
|
|
309
|
+
if (!bandsFor.has(horizontal)) bandsFor.set(horizontal, bandIndex(horizontal));
|
|
310
|
+
for (const j of bandsFor.get(horizontal)(my)) {
|
|
291
311
|
if (j === i) continue;
|
|
292
312
|
const other = edges[j];
|
|
293
313
|
const oax = tx(other.a);
|
|
@@ -3776,6 +3796,7 @@ export {
|
|
|
3776
3796
|
windingNumber,
|
|
3777
3797
|
pointInBezierPath,
|
|
3778
3798
|
distanceToBezierPath,
|
|
3799
|
+
flattenChain,
|
|
3779
3800
|
PathOpsError,
|
|
3780
3801
|
segmentIntersections,
|
|
3781
3802
|
pathBoolean,
|
|
@@ -3791,4 +3812,4 @@ export {
|
|
|
3791
3812
|
outlineStroke,
|
|
3792
3813
|
offsetPath
|
|
3793
3814
|
};
|
|
3794
|
-
//# sourceMappingURL=chunk-
|
|
3815
|
+
//# sourceMappingURL=chunk-HPEKB352.js.map
|