Skip to content

Commit

Permalink
Fix automatic zoom under spread mode (#12699)
Browse files Browse the repository at this point in the history
  • Loading branch information
calixteman committed Dec 6, 2020
1 parent d784af3 commit f063cee
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions web/base_viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down

0 comments on commit f063cee

Please sign in to comment.