From f063ceeb0d3aa3a8a0293a4cb5579247fc059d8f Mon Sep 17 00:00:00 2001 From: Calixte Denizet Date: Sun, 6 Dec 2020 20:59:10 +0100 Subject: [PATCH] Fix automatic zoom under spread mode (#12699) --- web/base_viewer.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/web/base_viewer.js b/web/base_viewer.js index 3b9b78ca40e1ad..060cf331f79bdc 100644 --- a/web/base_viewer.js +++ b/web/base_viewer.js @@ -735,6 +735,11 @@ class BaseViewer { if (!currentPage) { return; } + const factor = + this.spreadMode === SpreadMode.NONE || this._isScrollModeHorizontal + ? 1 + : 2; + const noPadding = this.isInPresentationMode || this.removePageBorders; let hPadding = noPadding ? 0 : SCROLLBAR_PADDING; let vPadding = noPadding ? 0 : VERTICAL_PADDING; @@ -743,8 +748,9 @@ class BaseViewer { [hPadding, vPadding] = [vPadding, hPadding]; // Swap the padding values. } const pageWidthScale = - ((this.container.clientWidth - hPadding) / currentPage.width) * - currentPage.scale; + (((this.container.clientWidth - hPadding) / currentPage.width) * + currentPage.scale) / + factor; const pageHeightScale = ((this.container.clientHeight - vPadding) / currentPage.height) * currentPage.scale;