Skip to content

Commit

Permalink
Fix automatic zoom under spread mode (mozilla#12699)
Browse files Browse the repository at this point in the history
  • Loading branch information
calixteman committed Dec 9, 2020
1 parent b194c82 commit 7012702
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 7012702

Please sign in to comment.