feat(commands): add transparent artboard creation
This commit is contained in:
34
commands/document.ts
Normal file
34
commands/document.ts
Normal 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>[];
|
||||
Reference in New Issue
Block a user