feat(phase-13): implement crop tool with visual guides and handles

Add comprehensive crop tool with visual guides, resize handles, and Apply/Cancel UI.

Features:
- Interactive crop area selection with drag-to-create
- 8 resize handles (corners and edges) for precise cropping
- Visual overlay with dimmed areas outside crop region
- Rule of thirds grid overlay for composition guidance
- Drag crop area to reposition
- Apply/Cancel buttons in tool options
- White border and handles for clear visibility

Changes:
- Created tools/crop-tool.ts with CropTool class
- Added crop tool to lib/tool-loader.ts
- Added Crop icon and button to tool palette with 'C' shortcut
- Added crop tool options UI in components/editor/tool-options.tsx
- Exported CropTool from tools/index.ts

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-11-21 19:54:05 +01:00
parent 8f595ac6c4
commit 841d6ca0a5
5 changed files with 411 additions and 1 deletions

View File

@@ -52,6 +52,9 @@ export function ToolOptions() {
// Gradient tool
const isGradientTool = activeTool === 'gradient';
// Crop tool
const isCropTool = activeTool === 'crop';
// Shape tool
const isShapeTool = activeTool === 'shape';
@@ -62,7 +65,7 @@ export function ToolOptions() {
const isTextTool = activeTool === 'text';
// Don't show options bar if no options available
if (!isDrawingTool && !isFillTool && !isGradientTool && !isShapeTool && !isSelectionTool && !isTextTool) {
if (!isDrawingTool && !isFillTool && !isGradientTool && !isCropTool && !isShapeTool && !isSelectionTool && !isTextTool) {
return null;
}
@@ -205,6 +208,29 @@ export function ToolOptions() {
</>
)}
{/* Crop Tool Options */}
{isCropTool && (
<>
<div className="flex items-center gap-4">
<div className="text-sm text-muted-foreground">
Drag to define crop area. Click and drag handles to resize.
</div>
<button
className="px-4 py-1.5 text-sm bg-green-600 hover:bg-green-700 text-white rounded-md transition-colors"
title="Apply crop (Enter)"
>
Apply
</button>
<button
className="px-4 py-1.5 text-sm bg-red-600 hover:bg-red-700 text-white rounded-md transition-colors"
title="Cancel crop (Esc)"
>
Cancel
</button>
</div>
</>
)}
{/* Gradient Tool Options */}
{isGradientTool && (
<>