From 8eb7ae6f1a0d05120823f8aa6f30e0bc75bcf321 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 21 Oct 2025 17:12:00 +0000 Subject: [PATCH 1/4] Rework cropping system with dual-image interface for better UX MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit completely reworks the image cropping functionality to address several UX issues: **Problems Fixed:** - Users were confused when the preview showed a cropped image but the overlay referenced the original dimensions - Cropping was blocked after first crop, requiring reset to adjust - Users could only crop from one position without resetting - Input fields were disabled after cropping, preventing adjustments **New Dual-Image Cropping System:** - Top image: Source/original image with interactive crop overlay - Bottom image: Live preview of cropped result (auto-updating with 100ms debounce) - Users can now adjust cropping multiple times without resetting - All crop inputs remain enabled for continuous adjustments - Reset button always visible when crop is enabled for easy reset - No separate "Preview" button needed - updates happen automatically **Technical Changes:** - Added sourceImageData variable to store original image for canvas rendering - Created updateCropPreview() and drawCropPreview() for live crop preview - Updated updateCropVisibility() to toggle between dual-image and single-image modes - Removed blocking logic from updateCropInteractionState() - Updated all crop interaction functions to use source-image instead of preview-image - Added auto-update triggers in drag/resize mousemove handlers - Added CSS for crop section titles and canvas preview styling Files modified: - panel.html: New dual-image layout structure - panel.js: Crop preview logic and interaction updates - styles.css: Styling for new crop sections 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .../frontend/panel.html | 32 ++-- .../frontend/panel.js | 158 ++++++++++++------ .../frontend/styles.css | 26 ++- 3 files changed, 153 insertions(+), 63 deletions(-) diff --git a/custom_components/camera_snapshot_processor/frontend/panel.html b/custom_components/camera_snapshot_processor/frontend/panel.html index 0df96e6..007915b 100644 --- a/custom_components/camera_snapshot_processor/frontend/panel.html +++ b/custom_components/camera_snapshot_processor/frontend/panel.html @@ -304,20 +304,32 @@

Live Preview

Loading preview...

-
- Preview -