Reduce the amount scaled when using mouse-wheel zooming in Chromium-browsers (issue 16325)
So I have found that rather than messing with the delta values, the simplest way to solve the problem would be to find a clean way to detect if the browser was Chromium or not. I found that chromium browsers have a property called windows.chrome which on console logging, looks something like this: { app: { isInstalled: false, InstallState: { DISABLED: disabled, INSTALLED: installed, NOT_INSTALLED: not_installed }, RunningState: { CANNOT_RUN: cannot_run, READY_TO_RUN: ready_to_run, RUNNING: running } }, appPinningPrivate: {} } Whereas in firefox, logging that property returns undefined. I had searched to see if there were ways that the window.chrome property could be faked (since the navigator.userAgent could be faked) but I couldnt find anything regarding that. Whats more, Edge, Opera, Brave and Chrome all support this property as per https://stackoverflow.com/a/13348618 So the current fix just adds the windows.chrome check to the if condition at line 2762. I had tested this functionality myself on all these browsers and they work as intended in both desktop and mobile versions. Update: Added PDFJSDev checks to ensure no unnecessary code ends up in the built-in Firefox PDF Viewer
This commit is contained in:
parent
0bbadce066
commit
89a1615cd1
@ -2760,6 +2760,9 @@ function webViewerWheel(evt) {
|
||||
|
||||
let ticks = 0;
|
||||
if (
|
||||
(typeof PDFJSDev !== "undefined" &&
|
||||
PDFJSDev.test("GENERIC || CHROME") &&
|
||||
window.chrome) ||
|
||||
deltaMode === WheelEvent.DOM_DELTA_LINE ||
|
||||
deltaMode === WheelEvent.DOM_DELTA_PAGE
|
||||
) {
|
||||
|
Loading…
Reference in New Issue
Block a user