Add zone resizing to graphical editor

Implemented comprehensive zone resizing functionality in the zone editor:

Features:
- Detects when mouse is near zone edges/corners (10px threshold)
- Supports all 8 resize handles: N, S, E, W, NE, NW, SE, SW
- Visual feedback with cyan highlight during resize
- Real-time dimension label updates while resizing
- Enforces minimum zone size (20x20 pixels)
- Constrains resizing to monitor boundaries
- Maintains zone data structure integrity during resize

Implementation details:
- Added state tracking: isResizingZone, resizingZoneIndex, resizeEdge, originalZoneBounds
- New method _findResizeEdge() for edge/corner detection
- Enhanced _onButtonPress() to prioritize resize over move
- Extended _onMotion() with resize delta calculations for all 8 directions
- Updated instruction label to include resize guidance
- Updated TODO.md to mark item #17 as completed

The zone editor now supports create, move, and resize operations with
clear visual feedback for each mode (green=normal, yellow=moving, cyan=resizing).

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-15 21:28:25 -07:00
parent 5cef19690a
commit 83a6a1ee8e
2 changed files with 213 additions and 13 deletions

12
TODO.md
View File

@@ -60,6 +60,18 @@
- [x] Maintain zone size while moving (only change position)
- [ ] Snap to grid or guides (future enhancement)
### 17. Resize Zones in Editor ✅ COMPLETED
**Priority: High**
- [x] Detect mouse near edges and corners of zones (10px threshold)
- [x] Allow dragging edges to resize zones horizontally or vertically
- [x] Allow dragging corners to resize zones diagonally
- [x] Visual feedback when zone is being resized (cyan highlight)
- [x] Show dimension label during resize with real-time updates
- [x] Enforce minimum zone size (20x20 pixels)
- [x] Constrain resize to monitor bounds
- [x] Update zone data structure in real-time during resize
- [x] Support all 8 resize handles (N, S, E, W, NE, NW, SE, SW)
## Code Quality & Robustness
### 6. Comprehensive Error Handling