import type { AppStore } from "@editor/store"; import type { ImageDocument } from "@core/document"; import type { GenerationState, MaskViewMode, SelectionState, ViewportState } from "@editor/state"; import type { BrushSettings, ChromaKeySettings, GenerateSettings, MagicWandSettings, ToolId } from "@editor/tools"; import { BrushControls } from "./bottom-controls/BrushControls"; import { ChromaKeyControls } from "./bottom-controls/ChromaKeyControls"; import { MagicWandControls } from "./bottom-controls/MagicWandControls"; import { GenerateActionControls } from "./bottom-controls/GenerateActionControls"; import { PanControls } from "./bottom-controls/PanControls"; import { TransformControls } from "./bottom-controls/TransformControls"; import { ZoomControls } from "./bottom-controls/ZoomControls"; import type { Rect } from "@core/geometry"; import type { TransformTarget } from "@editor/transform"; export type BottomControlsAction = "pan" | "zoom"; export type BottomControlsIslandProps = { document: ImageDocument; selection: SelectionState; viewport: ViewportState; visible: boolean; action: BottomControlsAction; activeTool: ToolId; brushSettings: BrushSettings; generateSettings: GenerateSettings; generation: GenerationState; chromaKeySettings: ChromaKeySettings; magicWandSettings: MagicWandSettings; editingMask?: boolean; maskViewMode?: MaskViewMode; transformBounds?: Rect; transformTarget?: TransformTarget; brushHint?: string; dispatch: AppStore["dispatch"]; }; export function BottomControlsIsland({ document, selection, viewport, visible, action, activeTool, brushSettings, generateSettings, generation, chromaKeySettings, magicWandSettings, editingMask = false, maskViewMode = "composite", transformBounds, transformTarget, brushHint, dispatch }: BottomControlsIslandProps) { const zoomPercent = Math.round(viewport.zoom * 100); const x = Math.round(viewport.center.x); const y = Math.round(viewport.center.y); return (
{activeTool === "generate" ? ( ) : (activeTool === "brush" || activeTool === "eraser") && brushHint ? ( ) : activeTool === "brush" || activeTool === "eraser" ? ( ) : activeTool === "chromaKey" ? ( ) : activeTool === "magicWand" ? ( ) : transformBounds && transformTarget ? ( ) : action === "pan" ? ( ) : ( )}
); } function BrushHint({ tool, hint }: { tool: "brush" | "eraser"; hint: string }) { return (
{tool} {hint}
); }