From 88432a0e3f46d5cf4a7b9e286fcf818ac47aa52b Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Wed, 28 Dec 2022 13:26:01 +0100 Subject: [PATCH] Improve name consistency in the viewer (PR 15812 follow-up) This tweaks a few name that originated in PR 15812, to improve overall consistency: - Use the `drawingDelay` parameter-name in all methods that accept a delay. - Use the `postponeDrawing` variable-name in all relevant methods. --- web/app.js | 4 ++-- web/pdf_page_view.js | 1 - web/pdf_viewer.js | 15 ++++++--------- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/web/app.js b/web/app.js index 60ce098b2..9851dc79d 100644 --- a/web/app.js +++ b/web/app.js @@ -656,7 +656,7 @@ const PDFViewerApplication = { return; } this.pdfViewer.increaseScale(steps, { - delay: AppOptions.get("defaultZoomDelay"), + drawingDelay: AppOptions.get("defaultZoomDelay"), }); }, @@ -665,7 +665,7 @@ const PDFViewerApplication = { return; } this.pdfViewer.decreaseScale(steps, { - delay: AppOptions.get("defaultZoomDelay"), + drawingDelay: AppOptions.get("defaultZoomDelay"), }); }, diff --git a/web/pdf_page_view.js b/web/pdf_page_view.js index f0f2b6f7b..082e332f8 100644 --- a/web/pdf_page_view.js +++ b/web/pdf_page_view.js @@ -599,7 +599,6 @@ class PDFPageView { isScalingRestricted = true; } } - const postponeDrawing = drawingDelay >= 0 && drawingDelay < 1000; if (this.canvas) { diff --git a/web/pdf_viewer.js b/web/pdf_viewer.js index 25caf7c15..fc54bc847 100644 --- a/web/pdf_viewer.js +++ b/web/pdf_viewer.js @@ -1083,7 +1083,7 @@ class PDFViewer { _setScaleUpdatePages( newScale, newValue, - { noScroll = false, preset = false, delay: drawingDelay = -1 } + { noScroll = false, preset = false, drawingDelay = -1 } ) { this._currentScaleValue = newValue.toString(); @@ -1103,16 +1103,13 @@ class PDFViewer { newScale * PixelsPerInch.PDF_TO_CSS_UNITS ); - const mustPostponeDrawing = drawingDelay >= 0 && drawingDelay < 1000; - const updateArgs = { + const postponeDrawing = drawingDelay >= 0 && drawingDelay < 1000; + this.refresh(true, { scale: newScale, - }; - if (mustPostponeDrawing) { - updateArgs.drawingDelay = drawingDelay; - } - this.refresh(true, updateArgs); + drawingDelay: postponeDrawing ? drawingDelay : -1, + }); - if (mustPostponeDrawing) { + if (postponeDrawing) { this.#scaleTimeoutId = setTimeout(() => { this.#scaleTimeoutId = null; this.refresh();