Fix mobile touch controls and improve zoom buttons in social media cropper#216
Fix mobile touch controls and improve zoom buttons in social media cropper#216
Conversation
…opper - Add "Move Image" / "Move Crop" toggle buttons so users can explicitly switch between dragging the image and dragging the crop rectangle (fixes the main mobile usability issue where you couldn't switch modes) - Disable Cropper.js built-in touch zoom (zoomOnTouch: false) and wheel zoom, replacing with a custom pinch-zoom handler that only activates on two-finger gestures, so single-touch drag works reliably for moving - Implement press-and-hold continuous zoom on the +/- buttons with acceleration (fires once on tap, then repeats faster on sustained hold) - Restyle zoom buttons as larger circular targets (52px / 56px on mobile) with proper touch-action, tap-highlight suppression, and press feedback - Move zoom percentage display between the +/- buttons for cleaner layout https://claude.ai/code/session_01MX16BTUy8XLs8kUYqmXBUh
|
Claude finished @simonw's task —— View job Code Review: Mobile Touch Controls and Zoom Button ImprovementsI've completed a comprehensive review of the mobile touch controls improvements in ✅ Code Quality and Best PracticesStrengths:
Areas for improvement:
|
Deploying tools with
|
| Latest commit: |
8399617
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://b30f7d57.tools-b1q.pages.dev |
| Branch Preview URL: | https://claude-fix-mobile-touch-crop.tools-b1q.pages.dev |
… jump - Sample pixels along all four image edges on load; if they're uniform (average per-channel deviation < 30), default the background color picker to that color. Reset to white if edges aren't uniform. - Track whether the user has manually interacted with the color picker (via input/change events). If they have, never override their choice on subsequent image loads. - Fix zoom +/- buttons jumping on first click: read the actual zoom ratio from Cropper.js canvas data in the ready callback instead of assuming 1.0, which was wrong when Cropper.js scales the image to fit the container. Same fix applied to the Reset button. https://claude.ai/code/session_01MX16BTUy8XLs8kUYqmXBUh
|
Claude finished @simonw's task —— View job Code Review: Mobile Touch Controls and Zoom Button ImprovementsI've completed a comprehensive review of the mobile touch controls improvements in ✅ Code Quality and Best PracticesStrengths:
Areas for improvement:
|
…ents The crop box overlay (.cropper-crop-box) sits above the image drag layer in Cropper.js's DOM, so touches inside the crop area always hit the crop box first regardless of dragMode. On mobile the crop box fills most of the viewport, making it impossible to drag the image. Fix: toggle pointer-events on the crop box element. In "Move Image" mode, set pointer-events: none so touches pass through to the drag layer. In "Move Crop" mode, restore pointer-events: auto. Also apply this in the ready callback since the crop box element doesn't exist until Cropper.js initializes. https://claude.ai/code/session_01MX16BTUy8XLs8kUYqmXBUh
|
Claude finished @simonw's task —— View job Code Review: Mobile Touch Controls and Zoom Button ImprovementsI've completed a comprehensive review of the mobile touch controls improvements in ✅ Code Quality and Best PracticesStrengths:
Areas for improvement:
|
switch between dragging the image and dragging the crop rectangle
(fixes the main mobile usability issue where you couldn't switch modes)
zoom, replacing with a custom pinch-zoom handler that only activates
on two-finger gestures, so single-touch drag works reliably for moving
acceleration (fires once on tap, then repeats faster on sustained hold)
with proper touch-action, tap-highlight suppression, and press feedback
https://gisthost.github.io/?fb404682dba20707fd4ece594de015b2/index.html