Skip to content

Enable pinch zoom and panning in fullscreen mobile PDFs - #19

Merged
DebelToni merged 2 commits into
mainfrom
feat/mobile-pdf-gestures
Oct 30, 2026
Merged

DebelToni merged 2 commits into
mainfrom
feat/mobile-pdf-gestures

Conversation

@DebelToni

Copy link
Copy Markdown
Owner

Summary

  • Pinch to zoom around the touch midpoint in fullscreen PDF previews, within the existing 50–250% limits.
  • Keep native one-finger horizontal/vertical panning and browser page zoom unchanged.
  • Preview with existing canvases during the gesture, then render sharp pages and persist the resulting view on release.
  • Add regression coverage for anchoring, later pages, zoom limits, cancellation, fullscreen exit, and ordinary scrolling.

Verification

  • pnpm check passed (134 web tests, 157 server tests, build/lint/typecheck and script tests).
  • pnpm test:compiler passed with real Docker isolation.
  • Mobile Chromium at 390×844 with native CDP touch input: pinch preview, final sharp render, focal-point preservation, horizontal/vertical drag panning, and unchanged browser viewport scale passed. No production API or data was used.

Not deployed by this PR submission; existing owner review and CI gates remain in place.

@DebelToni DebelToni left a comment •

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Reviewed all three changed files at b0f7918 against current main e6b0484. Needs attention; not merging.

  1. [P1] Required test check fails on the new fullscreen-exit regression. Hosted CI run 41039988755 fails PdfViewer.test.tsx > commits the preview when leaving fullscreen during a pinch at line 121: expected the 200% preview to commit, but the rendered DOM remains at 100% with a 200px page. Preserve the assertion, fix the fullscreen-exit failure and obtain passing exact-head CI. The hosted log establishes the failed assertion; I have not independently established repeatability or the precise root cause.

  2. [P2] End/cancel a pinch when its touch pair changes (PdfViewer.tsx, start/end listeners). An active pinch survives a third touch because start simply returns. If an original finger then lifts, end sees two remaining touches and also returns; subsequent moves use a different pair against the old distance/anchor, causing a zoom jump. The shared touchcancel handler also returns whenever two touches remain rather than necessarily cancelling the active gesture. Track the active pair or end the gesture when extra fingers/pair changes occur, and make cancellation explicit. Add coverage for 2-to-3-to-2 touches with an original finger released and touchcancel with remaining touches.

The normal midpoint/page anchoring, clamp, deferred sharp render, one-finger scrolling and non-fullscreen behavior have dedicated tests; the implementation adds no network, permission, dependency, workflow or host-automation changes. No contributor code, tests or builds were executed on DGX. Real mobile-browser touch behavior remains a separate eventual deployment/device check; jsdom tests do not establish it.

@DebelToni

Copy link
Copy Markdown
Owner Author

Addressed both review findings in the new head:

  • Track the original touch identifiers. Adding a third finger or replacing either finger ends the active pinch; touchcancel unconditionally ends it even if two touches remain. Reordering the same two touch identifiers remains valid.
  • Preserve the fullscreen-exit 200% assertion and add a pre-exit 400px preview assertion. The helper now waits inside async act for initial document readiness, flushing React's rendering=false commit and touch-listener effect before sending gestures; the ready callback itself fires before that commit. No production fullscreen-exit behavior was weakened.
  • Four new invalid-pair/cancellation tests fail on the old implementation and pass with the fix; all 16 PDF viewer tests pass.

Verification: pnpm check, real-Docker pnpm test:compiler, and native-touch mobile Chromium pinch/focal-point/panning checks passed locally. Awaiting exact-head hosted CI and owner-manager re-review.

@DebelToni DebelToni left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Re-reviewed the complete three-file diff at 0cb8baa against current main e6b0484. Previous findings addressed; no remaining blocking findings.

The regression fixture now waits for React to commit render readiness/listener installation, and additionally proves the preview reached 400px before fullscreen exit. The original 200%/sharp-render exit assertions remain. Exact-head hosted CI now passes. Active touch identifiers are checked regardless of ordering, a third finger or replacement pair ends the gesture, and touchcancel unconditionally finishes it. New tests cover those cases and ignored post-cancellation moves.

Reviewed transient canvas resizing, page-relative midpoint anchoring as preceding pages grow, clamping, persisted view state, deferred sharp render, fullscreen-only listener scope/cleanup and native one-finger scroll delegation. No backend, network/credential, dependency, workflow, policy or host-automation changes. Hosted test/analyze and CodeQL passed for this exact head. No contributor code, tests or builds executed on DGX. Physical iOS/Safari gesture behavior has not been independently exercised by this review; the hosted tests are DOM fixtures, not a device rendering claim.

@DebelToni
DebelToni merged commit 665ee47 into main Oct 30, 2026
3 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.

1 participant