'use client'; import { useTransformStore } from '@/store/transform-store'; import { useLayerStore } from '@/store/layer-store'; import { useHistoryStore } from '@/store/history-store'; import { useToolStore } from '@/store/tool-store'; import { TransformCommand } from '@/core/commands/transform-command'; import { Move, RotateCw, Maximize2, Check, X, Lock, Unlock } from 'lucide-react'; import { cn } from '@/lib/utils'; export function TransformPanel() { const { activeTransform, transformType, maintainAspectRatio, setTransformType, setMaintainAspectRatio, applyTransform, cancelTransform, } = useTransformStore(); const { activeLayerId, layers } = useLayerStore(); const { executeCommand } = useHistoryStore(); const { setActiveTool } = useToolStore(); const activeLayer = layers.find((l) => l.id === activeLayerId); const hasActiveLayer = !!activeLayer && !activeLayer.locked; const handleApply = () => { if (!activeTransform || !activeLayer) return; const command = TransformCommand.applyToLayer( activeLayer, activeTransform.currentState, activeTransform.originalBounds ); executeCommand(command); applyTransform(); }; const handleCancel = () => { cancelTransform(); }; const handleMoveTool = () => { setActiveTool('move'); }; const handleTransformTool = () => { setActiveTool('move'); // Will be updated to 'transform' when tool types are updated }; return (
• Click and drag to move the layer
• Arrow keys for precise movement
• Hold Shift for 10px increments
> )} {transformType === 'free-transform' && ( <>• Drag corners to scale
• Drag edges to scale in one direction
• Drag rotate handle to rotate
• Drag inside to move
• Hold Shift to constrain proportions
> )}Select an unlocked layer to transform