import { FlipHorizontal2, FlipVertical2, Lock, Unlock } from "lucide-react"; import { useCallback } from "react"; import type { TransformToolApi } from "@/components/editor/tools/transform-tool"; import { cn } from "@/lib/utils"; // --------------------------------------------------------------------------- // TransformOptions -- X/Y/W/H/rotation inputs, aspect lock, flip buttons // --------------------------------------------------------------------------- function NumericInput({ id, label, value, onChange, min, max, step, }: { id: string; label: string; value: number; onChange: (v: number) => void; min?: number; max?: number; step?: number; }) { const handleChange = useCallback( (e: React.ChangeEvent) => { const v = Number(e.target.value); if (Number.isFinite(v)) onChange(v); }, [onChange], ); return (
); } export function TransformOptions({ api }: { api: TransformToolApi }) { const { values, lockedAspect, setLockedAspect, setValues, flipHorizontal, flipVertical } = api; return (
setValues({ x: v })} /> setValues({ y: v })} />
setValues({ width: v })} /> setValues({ height: v })} />
setValues({ rotation: v })} />
); }