feat(commands): add transparent artboard creation

This commit is contained in:
syntaxbullet
2026-07-03 09:52:00 +02:00
parent ca9e265614
commit f4ad35a7f8
5 changed files with 62 additions and 1 deletions

34
commands/document.ts Normal file
View File

@@ -0,0 +1,34 @@
import type { Rect } from "@core/geometry";
import type { ArtboardId } from "@core/id";
import type { Command } from "./command";
export type DocumentAddArtboardPayload = {
id: ArtboardId;
name: string;
bounds: Rect;
};
export const documentAddArtboardCommand: Command<DocumentAddArtboardPayload> = {
id: "document.addArtboard",
name: "Add artboard",
execute({ state }, payload) {
return {
...state,
document: {
...state.document,
artboards: [
...state.document.artboards,
{
id: payload.id,
name: payload.name,
bounds: payload.bounds,
backgroundColor: "transparent",
layers: [],
},
],
},
};
},
};
export const documentCommands = [documentAddArtboardCommand] satisfies Command<unknown>[];