Skip to content

feat(Viewer): add rotate left/right to image viewer#1758

Open
vladopol wants to merge 2 commits into
nextcloud:mainfrom
vladopol:feat/image-viewer-rotate
Open

feat(Viewer): add rotate left/right to image viewer#1758
vladopol wants to merge 2 commits into
nextcloud:mainfrom
vladopol:feat/image-viewer-rotate

Conversation

@vladopol

@vladopol vladopol commented Jun 8, 2026

Copy link
Copy Markdown

Summary

Adds rotate left and rotate right controls to the image viewer actions menu, so users can correct the orientation of images received in Talk chats without leaving the app.

Changes:

  • ViewerHandlerImages.vue — rotation state; rotateLeft/rotateRight exposed via defineExpose; CSS transform: rotate() applied to <img> with a 0.3s transition; rotation resets when switching images
  • ViewerApp.vue — two NcActionButton entries wired to viewerRef.rotateLeft/Right; buttons are shown only for handlers that expose these methods, so video and other viewers are unaffected

Rotation uses unbounded angle increments (+90, +180, ...) so the CSS transition always animates in the correct direction regardless of how many times the button is pressed.

Depends on #1756 (zoom/pan).

Test plan

  • Open an image in the viewer — actions menu shows Rotate left, Rotate right, Open in browser
  • Rotate right repeatedly — image turns clockwise in 90° steps with smooth animation, direction never reverses
  • Rotate left repeatedly — same counter-clockwise
  • Mix left and right — always rotates in the correct direction
  • Switch to another image — rotation resets to 0°
  • Open a video in the viewer — rotate buttons are not shown
  • Zoom in, then rotate — both transforms apply independently

Fixes #1757

vladopol added 2 commits June 8, 2026 12:38
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>
Add rotate left (−90°) and rotate right (+90°) buttons to the image
viewer actions menu alongside the existing "Open in web browser" action.

- ViewerHandlerImages: rotation state with rotateLeft/rotateRight exposed
  via defineExpose; CSS transform applied to <img> with 0.3s transition;
  rotation resets to 0 when switching images
- ViewerApp: NcActionButton entries wired to viewerRef.rotateLeft/Right;
  buttons only appear for handlers that expose these methods (image viewer)

Rotation uses unbounded angle increments so CSS transition always
animates in the correct direction regardless of how many times the
button is pressed.

Fixes nextcloud#1757

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.

Image viewer: add rotate left/right buttons

1 participant