@ikijs/editor 0.15.0 → 0.16.1
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/dist/index.d.mts +9 -5
- package/dist/index.d.ts +9 -5
- package/dist/index.js +21 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +21 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -447,11 +447,24 @@ function validateDeformerReparent(deformers2, deformerId, newParentId) {
|
|
|
447
447
|
`deformers."${deformerId}".parent "${newParentId}" is not a declared deformer`
|
|
448
448
|
);
|
|
449
449
|
}
|
|
450
|
-
if (kindOf(parent) === "warp") {
|
|
450
|
+
if (kindOf(parent) === "warp" && kindOf(target) === "warp") {
|
|
451
451
|
throw new Error(
|
|
452
|
-
`deformers."${deformerId}".parent "${newParentId}" must be a matrix deformer (warp deformers cannot be
|
|
452
|
+
`deformers."${deformerId}".parent "${newParentId}" must be a matrix deformer (warp deformers cannot be nested under a warp deformer)`
|
|
453
453
|
);
|
|
454
454
|
}
|
|
455
|
+
if (parent.kind === "warp" && target.kind !== "warp") {
|
|
456
|
+
const { pivot } = target;
|
|
457
|
+
const { cols, rows, points } = parent.grid;
|
|
458
|
+
const xMin = points[0];
|
|
459
|
+
const xMax = points[2 * cols];
|
|
460
|
+
const yMax = points[1];
|
|
461
|
+
const yMin = points[rows * (cols + 1) * 2 + 1];
|
|
462
|
+
if (pivot.x < xMin || pivot.x > xMax || pivot.y < yMin || pivot.y > yMax) {
|
|
463
|
+
throw new Error(
|
|
464
|
+
`deformers."${deformerId}".pivot (${pivot.x}, ${pivot.y}) lies outside its warp parent "${newParentId}" rest grid x ${xMin}..${xMax}, y ${yMin}..${yMax}`
|
|
465
|
+
);
|
|
466
|
+
}
|
|
467
|
+
}
|
|
455
468
|
const parentOf = /* @__PURE__ */ new Map();
|
|
456
469
|
for (const d of deformers2) {
|
|
457
470
|
if (d.parent !== void 0) parentOf.set(d.id, d.parent);
|
|
@@ -635,6 +648,12 @@ var CaptureGridKeyform = class {
|
|
|
635
648
|
prevKeyforms;
|
|
636
649
|
apply(doc) {
|
|
637
650
|
const deformer = doc.findWarpDeformer(this.deformerId);
|
|
651
|
+
const count = deformer.warps?.length ?? 0;
|
|
652
|
+
if (count > 1) {
|
|
653
|
+
throw new Error(
|
|
654
|
+
`deformers."${this.deformerId}".warps: ${count} grid warps \u2014 capture targets a deformer with exactly one grid warp (which entry to write into is ambiguous)`
|
|
655
|
+
);
|
|
656
|
+
}
|
|
638
657
|
const warp = deformer.warps?.[0];
|
|
639
658
|
if (!warp) {
|
|
640
659
|
throw new Error(
|