Closed Bug 1659492 Opened 4 years ago Closed 2 years ago

Implement true smooth zooming on pdf.js

Categories

(Firefox :: PDF Viewer, enhancement, P1)

enhancement

Tracking

()

RESOLVED FIXED
110 Branch
Tracking Status
firefox110 --- fixed

People

(Reporter: kats, Assigned: calixte)

References

(Blocks 1 open bug)

Details

(Whiteboard: [pdfjs-zoom])

Attachments

(1 file)

Some types of inputs (e.g. doing a pinch-gesture on a touchscreen, a macOS trackpad, or high-precision windows/linux trackpad) should do a "smooth" zoom on pdf.js. Currently (as of bug 1643508) touchscreen pinches will do nothing, and the trackpad pinches will do a "stepwise" zoom, where the zoom factor goes up/down by 1.1x every so often.

This bug tracks implementing a "smooth" zoom where the zoom of the document tracks the pinch much more closely.

For someone implementing this, pdf.js already supports doing a CSS zoom where the canvas is scaled by using a CSS transforms first, then doing a full re-draw. We could reuse that by first using CSS zoom, then when the pinch zoom is done, re-draw.

Can you point me to the APIs that one would use to do this? I was trying to figure out the various setScale-related functions in base_viewer.js but it would probably be easier if you can say which ones would be appropriate here.

I think the only other significant change would be ensuring that the UI thingy that shows the current scale factor is updated appropriately, which I imagine shouldn't be too hard.

Priority: -- → P3
Whiteboard: [pdfjs-zoom]

I have a neuro issue where zooming animations reliably give me migraines and motion sickness, and smooth animations such as smooth scrolling, ease in-out, etc. also reliably give me migraines and motion sickness.

Since it's hard to avoid accidental zooming, I fear the combination will make me vomit onto the keyboard.

You know about the about:config pref apz.allow_zooming to disable normal pinch zooming?

Not pdf-specific, but there are a lot of sites which either zoom on mouseover, or zoom if users scroll, or zoom if users input data.

In pdf.js, we should be able to check the system's "prefers reduced motion" setting, and zoom in fixed increments (e.g. go from 100% directly to 120% rather than smoothly changing the zoom level from one to the other) in that case.

Another option would be to check general.smoothscroll, which has a front-end under about:preferences.

Assignee: nobody → cdenizet
Blocks: 1803753
Status: NEW → ASSIGNED
Priority: P3 → P1
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Depends on: 1807983
Resolution: --- → FIXED
Target Milestone: --- → 110 Branch

My understanding is that this bug was tracking making pinch-zooming smooth with both touchscreens and touchpads:

(In reply to Kartikaya Gupta (email:kats@mozilla.staktrace.com) from comment #0)

Some types of inputs (e.g. doing a pinch-gesture on a touchscreen, a macOS trackpad, or high-precision windows/linux trackpad) should do a "smooth" zoom on pdf.js. Currently (as of bug 1643508) touchscreen pinches will do nothing, and the trackpad pinches will do a "stepwise" zoom, where the zoom factor goes up/down by 1.1x every so often.

This bug tracks implementing a "smooth" zoom where the zoom of the document tracks the pinch much more closely.

Touchscreen zooming works nicely now, but touchpad pinch-zooming (tested on Linux Wayland) is still stepwise (zooms in 10% increments).

Calixte, should we reopen this?

Flags: needinfo?(cdenizet)

Yep you're right we must fix the pinch-to-zoom on a trackpad to be complete.

Status: RESOLVED → REOPENED
Flags: needinfo?(cdenizet)
Resolution: FIXED → ---

For me on macOS 2023-01-09 nightly using the trackpad to zoom on a PDF zooms the entire content area, including the PDF toolbar component. That's not what I would expect (and not what I intended when I filed this bug). But I don't know, maybe that's the intended behaviour now?

:kats, I filed a bug about that:
https://bugzilla.mozilla.org/show_bug.cgi?id=1809080.
It should be fixed in nightly this week.

Status: REOPENED → RESOLVED
Closed: 2 years ago2 years ago
Resolution: --- → FIXED

(In reply to Calixte Denizet (:calixte) from comment #11)

Yep you're right we must fix the pinch-to-zoom on a trackpad to be complete.

Thanks! Confirmed to be working well on Linux Wayland as well now.

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: