@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.d.mts +6 -3
- package/dist/index.d.ts +6 -3
- package/dist/index.js +15 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +15 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -185,7 +185,8 @@ declare class SetDeformerBindings implements EditCommand {
|
|
|
185
185
|
/**
|
|
186
186
|
* Reparent a deformer (matrix or warp) under a new parent, or promote it to
|
|
187
187
|
* root (`newParentId === undefined`). Calls {@link validateDeformerReparent}
|
|
188
|
-
* FIRST so invalid reparents (cycles, warp
|
|
188
|
+
* FIRST so invalid reparents (cycles, warp-under-warp, a pivot outside the new
|
|
189
|
+
* warp parent's grid, unknown id) throw before any
|
|
189
190
|
* capture or mutation — a throwing apply leaves the model and undo stack
|
|
190
191
|
* untouched.
|
|
191
192
|
*
|
|
@@ -1181,8 +1182,10 @@ declare function uvRectFor(placement: AtlasPlacement, page: {
|
|
|
1181
1182
|
/**
|
|
1182
1183
|
* Validate that reparenting `deformerId` under `newParentId` keeps the deformer
|
|
1183
1184
|
* hierarchy valid. Pass `newParentId === undefined` to move to root (always legal).
|
|
1184
|
-
* Checks: existence, self-reference, undeclared parent, kind constraint (warp
|
|
1185
|
-
*
|
|
1185
|
+
* Checks: existence, self-reference, undeclared parent, kind constraint (a warp
|
|
1186
|
+
* deformer cannot be the parent of another warp deformer), a matrix deformer's
|
|
1187
|
+
* pivot inside its new warp parent's rest grid, and cycle detection via the
|
|
1188
|
+
* proposed edge.
|
|
1186
1189
|
*/
|
|
1187
1190
|
declare function validateDeformerReparent(deformers: IkiDeformer[], deformerId: string, newParentId: string | undefined): void;
|
|
1188
1191
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -185,7 +185,8 @@ declare class SetDeformerBindings implements EditCommand {
|
|
|
185
185
|
/**
|
|
186
186
|
* Reparent a deformer (matrix or warp) under a new parent, or promote it to
|
|
187
187
|
* root (`newParentId === undefined`). Calls {@link validateDeformerReparent}
|
|
188
|
-
* FIRST so invalid reparents (cycles, warp
|
|
188
|
+
* FIRST so invalid reparents (cycles, warp-under-warp, a pivot outside the new
|
|
189
|
+
* warp parent's grid, unknown id) throw before any
|
|
189
190
|
* capture or mutation — a throwing apply leaves the model and undo stack
|
|
190
191
|
* untouched.
|
|
191
192
|
*
|
|
@@ -1181,8 +1182,10 @@ declare function uvRectFor(placement: AtlasPlacement, page: {
|
|
|
1181
1182
|
/**
|
|
1182
1183
|
* Validate that reparenting `deformerId` under `newParentId` keeps the deformer
|
|
1183
1184
|
* hierarchy valid. Pass `newParentId === undefined` to move to root (always legal).
|
|
1184
|
-
* Checks: existence, self-reference, undeclared parent, kind constraint (warp
|
|
1185
|
-
*
|
|
1185
|
+
* Checks: existence, self-reference, undeclared parent, kind constraint (a warp
|
|
1186
|
+
* deformer cannot be the parent of another warp deformer), a matrix deformer's
|
|
1187
|
+
* pivot inside its new warp parent's rest grid, and cycle detection via the
|
|
1188
|
+
* proposed edge.
|
|
1186
1189
|
*/
|
|
1187
1190
|
declare function validateDeformerReparent(deformers: IkiDeformer[], deformerId: string, newParentId: string | undefined): void;
|
|
1188
1191
|
/**
|
package/dist/index.js
CHANGED
|
@@ -520,11 +520,24 @@ function validateDeformerReparent(deformers2, deformerId, newParentId) {
|
|
|
520
520
|
`deformers."${deformerId}".parent "${newParentId}" is not a declared deformer`
|
|
521
521
|
);
|
|
522
522
|
}
|
|
523
|
-
if (kindOf(parent) === "warp") {
|
|
523
|
+
if (kindOf(parent) === "warp" && kindOf(target) === "warp") {
|
|
524
524
|
throw new Error(
|
|
525
|
-
`deformers."${deformerId}".parent "${newParentId}" must be a matrix deformer (warp deformers cannot be
|
|
525
|
+
`deformers."${deformerId}".parent "${newParentId}" must be a matrix deformer (warp deformers cannot be nested under a warp deformer)`
|
|
526
526
|
);
|
|
527
527
|
}
|
|
528
|
+
if (parent.kind === "warp" && target.kind !== "warp") {
|
|
529
|
+
const { pivot } = target;
|
|
530
|
+
const { cols, rows, points } = parent.grid;
|
|
531
|
+
const xMin = points[0];
|
|
532
|
+
const xMax = points[2 * cols];
|
|
533
|
+
const yMax = points[1];
|
|
534
|
+
const yMin = points[rows * (cols + 1) * 2 + 1];
|
|
535
|
+
if (pivot.x < xMin || pivot.x > xMax || pivot.y < yMin || pivot.y > yMax) {
|
|
536
|
+
throw new Error(
|
|
537
|
+
`deformers."${deformerId}".pivot (${pivot.x}, ${pivot.y}) lies outside its warp parent "${newParentId}" rest grid x ${xMin}..${xMax}, y ${yMin}..${yMax}`
|
|
538
|
+
);
|
|
539
|
+
}
|
|
540
|
+
}
|
|
528
541
|
const parentOf = /* @__PURE__ */ new Map();
|
|
529
542
|
for (const d of deformers2) {
|
|
530
543
|
if (d.parent !== void 0) parentOf.set(d.id, d.parent);
|