- Enhanced cursor behavior for new tools: semantic select, mask lasso, and mask rectangle. - Updated mask edit state to include mask asset ID and kind. - Implemented inpaint region commands for adding, applying, and removing inpaint regions. - Introduced new operations for lasso and semantic selection tools. - Created UI components for candidate review and inpaint region management. - Added tests for inpaint region commands to ensure functionality. - Updated various components to support new inpaint features and improve user experience.
52 lines
1.0 KiB
TypeScript
52 lines
1.0 KiB
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,
|
|
generation: {
|
|
candidates: [],
|
|
selectedCandidateId: undefined,
|
|
compareMode: "result",
|
|
jobs: [],
|
|
resources: { status: "idle" },
|
|
},
|
|
commandPalette: {
|
|
open: false,
|
|
query: "",
|
|
selectedIndex: 0,
|
|
},
|
|
workspace: {
|
|
panel: "none",
|
|
},
|
|
transformSession: undefined,
|
|
maskEdit: undefined,
|
|
brushPreview: undefined,
|
|
brushStrokePreview: undefined,
|
|
maskShapeSession: undefined,
|
|
pointerSession: undefined,
|
|
};
|
|
|
|
export function createInitialAppState(name = "Untitled"): AppState {
|
|
return {
|
|
document: {
|
|
id: crypto.randomUUID(),
|
|
name,
|
|
version: 1,
|
|
artboards: [],
|
|
assets: [],
|
|
inpaintRegions: [],
|
|
},
|
|
editor: initialEditorState,
|
|
history: { past: [], future: [] },
|
|
};
|
|
}
|