feat(commands): add app state dispatcher foundation
This commit is contained in:
26
editor/initial-state.ts
Normal file
26
editor/initial-state.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import type { AppState, EditorState } from "./state";
|
||||
|
||||
export const initialEditorState: EditorState = {
|
||||
viewport: {
|
||||
center: { x: 0, y: 0 },
|
||||
zoom: 1,
|
||||
rotation: 0,
|
||||
size: { w: 0, h: 0 },
|
||||
},
|
||||
selection: {
|
||||
layerIds: [],
|
||||
},
|
||||
};
|
||||
|
||||
export function createInitialAppState(name = "Untitled"): AppState {
|
||||
return {
|
||||
document: {
|
||||
id: crypto.randomUUID(),
|
||||
name,
|
||||
version: 1,
|
||||
artboards: [],
|
||||
assets: [],
|
||||
},
|
||||
editor: initialEditorState,
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user