feat(core): add raster layer type

This commit is contained in:
syntaxbullet
2026-07-03 17:34:02 +02:00
parent c946fb4c93
commit 665f4a5340
10 changed files with 66 additions and 5 deletions

View File

@@ -5,6 +5,7 @@ import {
documentAddAssetCommand,
documentAddGroupLayerCommand,
documentAddImageLayerCommand,
documentAddRasterLayerCommand,
documentGroupLayersCommand,
documentMoveLayerCommand,
documentRemoveArtboardCommand,
@@ -77,6 +78,32 @@ describe("document commands", () => {
expect(next.document.artboards[0]?.layers.map((layer) => layer.id)).toEqual(["l1"]);
});
test("adds raster layers to artboards", () => {
const state = documentAddArtboardCommand.execute(
{ state: createInitialAppState("Test") },
{ id: "a1", name: "Artboard 1", bounds: { x: 0, y: 0, w: 320, h: 240 } },
);
const next = documentAddRasterLayerCommand.execute(
{ state },
{
artboardId: "a1",
layer: {
id: "r1",
type: "raster",
name: "Raster",
visible: true,
locked: false,
opacity: 1,
assetId: "asset-1",
transform: { position: { x: 10, y: 20 }, scale: { x: 1, y: 1 }, rotation: 0 },
},
},
);
expect(next.document.artboards[0]?.layers.map((layer) => layer.id)).toEqual(["r1"]);
});
test("adds group layers", () => {
const state = documentAddArtboardCommand.execute(
{ state: createInitialAppState("Test") },