Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto zoom landscape documents (like slide presentations) to fit their height #5229

Merged
merged 2 commits into from
Sep 9, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions web/viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,9 @@ var PDFView = {
scale = Math.min(pageWidthScale, pageHeightScale);
break;
case 'auto':
scale = Math.min(MAX_AUTO_SCALE, pageWidthScale);
var isLandscape = (currentPage.width > currentPage.height);
var horizontalScale = isLandscape ? pageHeightScale : pageWidthScale;
scale = Math.min(MAX_AUTO_SCALE, horizontalScale);
break;
default:
console.error('pdfViewSetScale: \'' + value +
Expand Down Expand Up @@ -1211,7 +1213,7 @@ var PDFView = {
setInitialView: function pdfViewSetInitialView(storedHash, scale) {
// Reset the current scale, as otherwise the page's scale might not get
// updated if the zoom level stayed the same.
this.currentScale = 0;
this.currentScale = UNKNOWN_SCALE;
this.currentScaleValue = null;
// When opening a new file (when one is already loaded in the viewer):
// Reset 'currentPageNumber', since otherwise the page's scale will be wrong
Expand Down