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.
This commit is contained in:
Jonas Jenwald 2019-07-23 17:36:45 +02:00
parent 1f287ec486
commit 1eed5b7235

View File

@ -2093,17 +2093,15 @@ function setZoomDisabledTimeout() {
} }
function webViewerWheel(evt) { function webViewerWheel(evt) {
let pdfViewer = PDFViewerApplication.pdfViewer; const { pdfViewer, supportedMouseWheelZoomModifierKeys, } =
PDFViewerApplication;
if (pdfViewer.isInPresentationMode) { if (pdfViewer.isInPresentationMode) {
return; return;
} }
if (evt.ctrlKey || evt.metaKey) { if ((evt.ctrlKey && supportedMouseWheelZoomModifierKeys.ctrlKey) ||
let support = PDFViewerApplication.supportedMouseWheelZoomModifierKeys; (evt.metaKey && supportedMouseWheelZoomModifierKeys.metaKey)) {
if ((evt.ctrlKey && !support.ctrlKey) ||
(evt.metaKey && !support.metaKey)) {
return;
}
// Only zoom the pages, not the entire viewer. // Only zoom the pages, not the entire viewer.
evt.preventDefault(); evt.preventDefault();
// NOTE: this check must be placed *after* preventDefault. // NOTE: this check must be placed *after* preventDefault.