Skip to content

feat(Viewer): add zoom and pan to image viewer#1756

Open
vladopol wants to merge 1 commit into
nextcloud:mainfrom
vladopol:feat/image-viewer-panzoom
Open

feat(Viewer): add zoom and pan to image viewer#1756
vladopol wants to merge 1 commit into
nextcloud:mainfrom
vladopol:feat/image-viewer-panzoom

Conversation

@vladopol

@vladopol vladopol commented Jun 8, 2026

Copy link
Copy Markdown

Summary

Adds zoom and pan support to the image viewer in Talk Desktop, addressing the long-standing macOS limitation where pinch-to-zoom had no effect and Cmd+/- zoomed the entire application UI instead of the image.

Installs panzoom (v9.4.4, 6 kB) — same library already used in spreed for screen share zoom (spreed#14028).

Changes in ViewerHandlerImages.vue:

  • Scroll wheel / trackpad pinch → zoom in/out (1× – 8×), centered on cursor
  • Drag to pan when zoomed in
  • Double-click to zoom in 3× at cursor position; double-click again to reset to 1×
  • Auto-centers image when zoom returns to 1× (smooth animation)
  • Panning blocked at minimum zoom to prevent accidental image shifts
  • Cursor feedback: zoom-in at 1×, grab / grabbing when zoomed

Test plan

  • Open an image in the viewer
  • Scroll wheel / trackpad pinch zooms image centered on cursor (not top-left corner)
  • Drag image while zoomed in — panning works, cursor shows grab/grabbing
  • Zoom back out to 1× — image smoothly returns to center
  • Double-click zooms in 3× at click point; double-click again resets
  • Open a second image — zoom/pan state resets
  • Verify no regression on video viewer (ViewerHandlerVideos.vue unchanged)

Closes #1535

@vladopol vladopol force-pushed the feat/image-viewer-panzoom branch from 6f33707 to e9e75ef Compare June 8, 2026 11:25
@nickvergessen

Copy link
Copy Markdown
Member

You need to sign-off your commits otherwise we can not merge them at all

Install panzoom library (9.4.4, 6 kB) and apply it to the image
viewer wrapper in ViewerHandlerImages.vue:

- Scroll wheel to zoom in/out (1× – 8×)
- Drag to pan when zoomed in
- Double-click to zoom in 3× at cursor, double-click again to reset
- Auto-center image when zoom returns to 1×
- Pan blocked at minimum zoom to prevent accidental shifts
- Cursor changes: zoom-in at 1×, grab/grabbing when zoomed

Fixes nextcloud#1535

Signed-off-by: Vladimir Poluliashenko <vladopol@gmail.com>
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.

macOS: Zoom on pictures

2 participants