Conversation
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 <noreply@anthropic.com>
Changes: Frontend (UI): - Add opacity sliders (0.0-1.0, step 0.1) to Overlays tab for text color and background color - Add opacity slider to State Icons tab for global background color - Add opacity sliders to state-icon-manager.js for individual state rule icon and text colors - Update panel.js to save/load opacity values in getFormData() and populateForm() - Add event listeners for opacity sliders to update value displays - Style opacity sliders to match existing UI Backend (Python): - Add opacity constants: CONF_OVERLAY_COLOR_OPACITY, CONF_OVERLAY_BACKGROUND_OPACITY, CONF_STATE_ICON_BACKGROUND_OPACITY - Update _hex_to_rgba() to accept optional opacity parameter that multiplies with alpha channel - Update _draw_text() to apply overlay color and background opacity values - Update _draw_multicolor_text() to apply state icon background opacity - Update _draw_state_icon() to extract icon_opacity and text_opacity from state rules - Pass opacity values through parts list to _draw_multicolor_text() for rendering This allows users to configure transparency for: - Overlay text color (datetime, custom text) - Overlay background - State icon global background - State icon rule-specific icon color - State icon rule-specific text color All opacity values default to 1.0 (fully opaque) for backward compatibility. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Changes: - Remove overlay_color_opacity slider from Overlays tab in panel.html - Remove icon_opacity and text_opacity sliders from State Icons modal - Remove text opacity event listeners and form handling from panel.js - Remove CONF_OVERLAY_COLOR_OPACITY constant from const.py - Remove text/icon opacity handling from image_processor.py - Text and icon colors are now always fully opaque (opacity = 1.0) - Background opacity controls remain fully functional This simplifies the UI by removing non-functional text opacity controls while preserving the working background opacity feature for both overlay backgrounds and state icon backgrounds. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR improves the image cropping user experience with a new dual-image interface that makes it easier to adjust crop settings interactively.
New Dual-Image Cropping System
Problems Fixed:
New Features:
Technical Implementation:
sourceImageDatato store original image for canvas renderingupdateCropPreview()anddrawCropPreview()for live crop preview using HTML5 canvasupdateCropVisibility()to toggle between dual-image (crop tab) and single-image (other tabs) modesBackground Opacity Controls
Added opacity controls for background colors to allow semi-transparent overlays:
Files Modified
Frontend:
panel.html: New dual-image crop layout structure and opacity controlspanel.js: Crop preview logic, interaction handlers, and opacity handlingstate-icon-manager.js: Updated for new crop systemstyles.css: Crop section and canvas preview stylingBackend:
image_processor.py: Background opacity support with RGBA conversionconst.py: Added background opacity configuration constants🤖 Generated with Claude Code
Co-Authored-By: Claude noreply@anthropic.com