- Introduced `getLayerMask` utility to streamline layer mask retrieval. - Updated layer rendering logic to incorporate layer masks and opacity adjustments. - Added functionality to prevent dropping a group into its descendants. - Enhanced image texture rendering to support opacity parameters across various rendering functions. - Implemented group layer bounds application for better scaling and positioning. - Added tests to ensure correct behavior when handling layer masks and group layers. - Created new types for asset generation provenance to track generated assets more effectively.
39 lines
819 B
TypeScript
39 lines
819 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,
|
|
generation: {
|
|
candidates: [],
|
|
selectedCandidateId: undefined,
|
|
compareMode: "result",
|
|
},
|
|
transformSession: undefined,
|
|
maskEdit: undefined,
|
|
brushPreview: undefined,
|
|
brushStrokePreview: undefined,
|
|
};
|
|
|
|
export function createInitialAppState(name = "Untitled"): AppState {
|
|
return {
|
|
document: {
|
|
id: crypto.randomUUID(),
|
|
name,
|
|
version: 1,
|
|
artboards: [],
|
|
assets: [],
|
|
},
|
|
editor: initialEditorState,
|
|
history: { past: [], future: [] },
|
|
};
|
|
}
|