@ikijs/editor 0.15.0 → 0.16.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/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 parents)`
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);