From 1eed5b7235e6393f26c5c11d2fe4d16117fb083d Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Tue, 23 Jul 2019 17:36:45 +0200 Subject: [PATCH] Ensure that setting the `zoomDisabledTimeout` isn't skipped, regardless of the supported zoom keys, when handling mouse wheel events (PR 7097 follow-up) *Possible follow-up:* It probably wouldn't hurt to try and shorten the `supportedMouseWheelZoomModifierKeys` name a bit, but I'm not attempting that here since it'd also require updating `PdfStreamConverter.jsm` in mozilla-central in order to be consistent. --- web/app.js | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/web/app.js b/web/app.js index a40e27db6..d4a9aeba8 100644 --- a/web/app.js +++ b/web/app.js @@ -2093,17 +2093,15 @@ function setZoomDisabledTimeout() { } function webViewerWheel(evt) { - let pdfViewer = PDFViewerApplication.pdfViewer; + const { pdfViewer, supportedMouseWheelZoomModifierKeys, } = + PDFViewerApplication; + if (pdfViewer.isInPresentationMode) { return; } - if (evt.ctrlKey || evt.metaKey) { - let support = PDFViewerApplication.supportedMouseWheelZoomModifierKeys; - if ((evt.ctrlKey && !support.ctrlKey) || - (evt.metaKey && !support.metaKey)) { - return; - } + if ((evt.ctrlKey && supportedMouseWheelZoomModifierKeys.ctrlKey) || + (evt.metaKey && supportedMouseWheelZoomModifierKeys.metaKey)) { // Only zoom the pages, not the entire viewer. evt.preventDefault(); // NOTE: this check must be placed *after* preventDefault.