diff --git a/web/app.js b/web/app.js index fd42d2bfa..e1a04c4a8 100644 --- a/web/app.js +++ b/web/app.js @@ -437,14 +437,9 @@ let PDFViewerApplication = { this.pdfViewer.currentScaleValue = newScale; }, - zoomReset(ignoreDuplicate = false) { + zoomReset() { if (this.pdfViewer.isInPresentationMode) { return; - } else if (ignoreDuplicate && - this.pdfViewer.currentScaleValue === DEFAULT_SCALE_VALUE) { - // Avoid attempting to needlessly reset the zoom level *twice* in a row, - // when using the `Ctrl + 0` keyboard shortcut in `MOZCENTRAL` builds. - return; } this.pdfViewer.currentScaleValue = DEFAULT_SCALE_VALUE; }, @@ -1965,8 +1960,8 @@ function webViewerZoomIn() { function webViewerZoomOut() { PDFViewerApplication.zoomOut(); } -function webViewerZoomReset(evt) { - PDFViewerApplication.zoomReset(evt && evt.ignoreDuplicate); +function webViewerZoomReset() { + PDFViewerApplication.zoomReset(); } function webViewerPageNumberChanged(evt) { let pdfViewer = PDFViewerApplication.pdfViewer; diff --git a/web/firefoxcom.js b/web/firefoxcom.js index 22e044801..9aaea80ba 100644 --- a/web/firefoxcom.js +++ b/web/firefoxcom.js @@ -16,6 +16,7 @@ import '../extensions/firefox/tools/l10n'; import { createObjectURL, PDFDataRangeTransport, shadow, URL } from 'pdfjs-lib'; import { BasePreferences } from './preferences'; +import { DEFAULT_SCALE_VALUE } from './ui_utils'; import { PDFViewerApplication } from './app'; if (typeof PDFJSDev === 'undefined' || @@ -176,9 +177,7 @@ class MozL10n { return; } if (type === 'findbarclose') { - PDFViewerApplication.eventBus.dispatch('findbarclose', { - source: window, - }); + PDFViewerApplication.eventBus.dispatch(type, { source: window, }); return; } PDFViewerApplication.eventBus.dispatch('find', { @@ -208,10 +207,13 @@ class MozL10n { if (!PDFViewerApplication.initialized) { return; } - PDFViewerApplication.eventBus.dispatch(type, { - source: window, - ignoreDuplicate: (type === 'zoomreset' ? true : undefined), - }); + // Avoid attempting to needlessly reset the zoom level *twice* in a row, + // when using the `Ctrl + 0` keyboard shortcut. + if (type === 'zoomreset' && // eslint-disable-next-line max-len + PDFViewerApplication.pdfViewer.currentScaleValue === DEFAULT_SCALE_VALUE) { + return; + } + PDFViewerApplication.eventBus.dispatch(type, { source: window, }); }; for (const event of events) {