初始化提交

This commit is contained in:
2025-09-14 02:05:42 +08:00
parent 1a3730454e
commit 9f94e92eaf
19 changed files with 385 additions and 322 deletions

View File

@@ -3,41 +3,41 @@ import { devtools } from 'zustand/middleware';
import { Project, Generation, Edit, SegmentationMask, BrushStroke } from '../types';
interface AppState {
// Current project
// 当前项目
currentProject: Project | null;
// Canvas state
// 画布状态
canvasImage: string | null;
canvasZoom: number;
canvasPan: { x: number; y: number };
// Upload state
// 上传状态
uploadedImages: string[];
editReferenceImages: string[];
// Brush strokes for painting masks
// 用于绘制遮罩的画笔描边
brushStrokes: BrushStroke[];
brushSize: number;
showMasks: boolean;
// Generation state
// 生成状态
isGenerating: boolean;
currentPrompt: string;
temperature: number;
seed: number | null;
// History and variants
// 历史记录和变体
selectedGenerationId: string | null;
selectedEditId: string | null;
showHistory: boolean;
// Panel visibility
// 面板可见性
showPromptPanel: boolean;
// UI state
// UI状态
selectedTool: 'generate' | 'edit' | 'mask';
// Actions
// 操作
setCurrentProject: (project: Project | null) => void;
setCanvasImage: (url: string | null) => void;
setCanvasZoom: (zoom: number) => void;
@@ -75,7 +75,7 @@ interface AppState {
export const useAppStore = create<AppState>()(
devtools(
(set, get) => ({
// Initial state
// 初始状态
currentProject: null,
canvasImage: null,
canvasZoom: 1,
@@ -101,7 +101,7 @@ export const useAppStore = create<AppState>()(
selectedTool: 'generate',
// Actions
// 操作
setCurrentProject: (project) => set({ currentProject: project }),
setCanvasImage: (url) => set({ canvasImage: url }),
setCanvasZoom: (zoom) => set({ canvasZoom: zoom }),