feat: add crop and canvas resize workflows
This commit is contained in:
@@ -56,6 +56,13 @@ describe("transform targets", () => {
|
||||
expect(layer?.transform).toEqual({ position: { x: 30, y: 40 }, scale: { x: 2, y: 0.5 }, rotation: 0 });
|
||||
});
|
||||
|
||||
test("applies visible bounds to a cropped layer while retaining its source crop", () => {
|
||||
const cropped = { ...document, artboards: [{ ...document.artboards[0]!, layers: [{ ...document.artboards[0]!.layers[0]!, sourceRect: { x: 10, y: 5, w: 40, h: 20 } }] }] };
|
||||
const next = applyTransformTargetBounds(cropped, { type: "layer", id: "l1" }, { x: 100, y: 80, w: 200, h: 60 });
|
||||
expect(next.artboards[0]?.layers[0]).toMatchObject({ sourceRect: { x: 10, y: 5, w: 40, h: 20 }, transform: { position: { x: 50, y: 65 }, scale: { x: 5, y: 3 } } });
|
||||
expect(resolveTransformTargetBounds(next, { type: "layer", id: "l1" })).toEqual({ x: 100, y: 80, w: 200, h: 60 });
|
||||
});
|
||||
|
||||
test("keeps attached mask bounds in sync with transformed layers", () => {
|
||||
const maskedDocument: ImageDocument = {
|
||||
...document,
|
||||
|
||||
Reference in New Issue
Block a user