Merge pull request #5229 from cpeterso/cpeterso/auto-fit-landscape
Auto zoom landscape documents (like slide presentations) to fit their height
This commit is contained in:
commit
15059ea603
@ -359,7 +359,9 @@ var PDFView = {
|
|||||||
scale = Math.min(pageWidthScale, pageHeightScale);
|
scale = Math.min(pageWidthScale, pageHeightScale);
|
||||||
break;
|
break;
|
||||||
case 'auto':
|
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;
|
break;
|
||||||
default:
|
default:
|
||||||
console.error('pdfViewSetScale: \'' + value +
|
console.error('pdfViewSetScale: \'' + value +
|
||||||
@ -1211,7 +1213,7 @@ var PDFView = {
|
|||||||
setInitialView: function pdfViewSetInitialView(storedHash, scale) {
|
setInitialView: function pdfViewSetInitialView(storedHash, scale) {
|
||||||
// Reset the current scale, as otherwise the page's scale might not get
|
// Reset the current scale, as otherwise the page's scale might not get
|
||||||
// updated if the zoom level stayed the same.
|
// updated if the zoom level stayed the same.
|
||||||
this.currentScale = 0;
|
this.currentScale = UNKNOWN_SCALE;
|
||||||
this.currentScaleValue = null;
|
this.currentScaleValue = null;
|
||||||
// When opening a new file (when one is already loaded in the viewer):
|
// When opening a new file (when one is already loaded in the viewer):
|
||||||
// Reset 'currentPageNumber', since otherwise the page's scale will be wrong
|
// Reset 'currentPageNumber', since otherwise the page's scale will be wrong
|
||||||
|
Loading…
x
Reference in New Issue
Block a user