29 lines
562 B
TypeScript
29 lines
562 B
TypeScript
import type { AppState, EditorState } from "./state";
|
|
import { initialToolState } from "./tools";
|
|
|
|
export const initialEditorState: EditorState = {
|
|
viewport: {
|
|
center: { x: 0, y: 0 },
|
|
zoom: 1,
|
|
rotation: 0,
|
|
size: { w: 0, h: 0 },
|
|
},
|
|
selection: {
|
|
layerIds: [],
|
|
},
|
|
tools: initialToolState,
|
|
};
|
|
|
|
export function createInitialAppState(name = "Untitled"): AppState {
|
|
return {
|
|
document: {
|
|
id: crypto.randomUUID(),
|
|
name,
|
|
version: 1,
|
|
artboards: [],
|
|
assets: [],
|
|
},
|
|
editor: initialEditorState,
|
|
};
|
|
}
|