refactor(transform): resolve target bounds

This commit is contained in:
syntaxbullet
2026-07-03 16:12:26 +02:00
parent ff5bb43382
commit a3b4a4a1b0
8 changed files with 151 additions and 39 deletions

View File

@@ -1,4 +1,5 @@
import type { Rect, Vec2D } from "@core/geometry";
import { applyTransformTargetBounds } from "@editor/transform-targets";
import type { TransformHandle, TransformTarget } from "@editor/transform";
import type { Command } from "./command";
import { commandIds } from "./ids";
@@ -45,19 +46,10 @@ export const transformUpdateCommand: Command<TransformUpdatePayload> = {
y: payload.point.y - session.startPoint.y,
});
if (session.target.type === "artboard") {
return {
...state,
document: {
...state.document,
artboards: state.document.artboards.map((artboard) =>
artboard.id === session.target.id ? { ...artboard, bounds: nextBounds } : artboard,
),
},
};
}
return state;
return {
...state,
document: applyTransformTargetBounds(state.document, session.target, nextBounds),
};
},
};