Skip to content

feat(viewer): add zoom controls to processing pdf viewer#63

Merged
grossir merged 6 commits into
mainfrom
57-add-zoom-controls-to-the-pdf-viewer
May 20, 2026
Merged

feat(viewer): add zoom controls to processing pdf viewer#63
grossir merged 6 commits into
mainfrom
57-add-zoom-controls-to-the-pdf-viewer

Conversation

@quevon24
Copy link
Copy Markdown
Member

@quevon24 quevon24 commented May 8, 2026

Summary

Closes #57.

Adds a zoom toolbar (−, %, +, Reset) to the processing PDF viewer (scan_process.html, used in steps 1, 2, and 3). Range 0.5x – 3x, step 0.1. Step 1 persists its zoom level independently from steps 2/3, since reviewing page numbers and reviewing opinions benefit from different zooms.

How it works

The toolbar lives at the top-left of the viewer panel and stays visible when you scroll, even horizontally at high zoom. Each PDF page is scaled visually as a whole, so detection boxes, redactions, and image overlays all stay aligned with the page automatically. Drawing a new redaction or detection, and dragging or resizing existing ones, works the same at any zoom level.

pdf.js rasterizes each page once into a canvas at a fixed resolution, so simply CSS-scaling that bitmap to a higher zoom looks really blurry above the original render scale (the same effect as zooming into a JPEG). To avoid this, when the zoom level changes the viewer re-rasterizes visible pages at the new resolution so text stays sharp. Pages outside the viewport are dropped and re-rendered fresh when scrolled back into view, which keeps memory bounded at high zoom on long documents. Rapid zoom clicks are debounced and any in-flight render is cancelled when zoom changes again, the same pattern pdf.js's own demo viewer uses.

The page header (PDF p.n + action buttons) also got a small layout tweak: at narrow widths (low zoom or small monitors) the buttons wrap below the page identifier instead of overflowing the page width.

@quevon24 quevon24 linked an issue May 8, 2026 that may be closed by this pull request
@quevon24 quevon24 marked this pull request as ready for review May 8, 2026 22:09
@quevon24 quevon24 requested a review from grossir May 8, 2026 22:10
@quevon24 quevon24 moved this to PRs to Review in Sprint (Case Law) May 8, 2026
Copy link
Copy Markdown
Contributor

@grossir grossir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@grossir grossir merged commit 22011fc into main May 20, 2026
7 checks passed
@github-project-automation github-project-automation Bot moved this from PRs to Review to Done in Sprint (Case Law) May 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Add zoom controls to the pdf viewer

2 participants