Skip to content

Add pinch-to-zoom and wheel zoom support#434

Merged
mosch merged 4 commits intomainfrom
feat/pinch-to-zoom
Apr 1, 2026
Merged

Add pinch-to-zoom and wheel zoom support#434
mosch merged 4 commits intomainfrom
feat/pinch-to-zoom

Conversation

@mosch
Copy link
Copy Markdown
Owner

@mosch mosch commented Mar 31, 2026

Summary

  • Adds touch pinch-to-zoom for mobile devices (two-finger gesture scales the image proportionally)
  • Adds wheel/trackpad zoom for desktop (Mac trackpad pinch gestures and mouse scroll wheel both zoom via onRequestScaleChange)
  • Handles edge case where a second finger is added mid-drag, seamlessly transitioning from pan to pinch

Closes #368

Test plan

  • Verify pinch-to-zoom works on a mobile/touch device
  • Verify Mac trackpad pinch gesture zooms the image
  • Verify mouse scroll wheel zooms the image when hovering over the canvas
  • Verify single-finger drag still works for panning
  • Verify all existing tests pass (pnpm test — 130 tests passing)

Support zooming via touch pinch gestures (mobile) and trackpad/mouse
wheel (desktop) through the existing onRequestScaleChange callback.

Closes #368
@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages bot commented Mar 31, 2026

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
react-avatar-editor e1cf3f9 Commit Preview URL

Branch Preview URL
Mar 31 2026, 07:04 AM

mosch added 3 commits March 31, 2026 08:54
Wheel/trackpad zoom is now disabled by default and gated behind the
enableWheelZoom prop (default: false). Pinch-to-zoom with two fingers
remains always enabled. Adds tests for both pinch and wheel zoom.
Remove jsdom-based unit tests for pinch/wheel zoom. Add Playwright
screenshot tests that verify zoom visually: wheel scroll up/down,
trackpad pinch (ctrlKey+wheel), and two-finger touch pinch via CDP.
@mosch mosch merged commit 4a478ce into main Apr 1, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pinch to zoom

1 participant