Move the hasEqualPageSizes
getter from PDFViewerApplication
and into PDFViewer
instead
Since the method needs to access properties that are directly available inside of `PDFViewer`, it seems simpler to just have it live there.
This commit is contained in:
parent
afb1cd7377
commit
49333ddd44
15
web/app.js
15
web/app.js
@ -977,7 +977,7 @@ let PDFViewerApplication = {
|
|||||||
!initialParams.hash) {
|
!initialParams.hash) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (this.hasEqualPageSizes) {
|
if (pdfViewer.hasEqualPageSizes) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.initialDestination = initialParams.destination;
|
this.initialDestination = initialParams.destination;
|
||||||
@ -1217,19 +1217,6 @@ let PDFViewerApplication = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// Whether all pages of the PDF have the same width and height.
|
|
||||||
get hasEqualPageSizes() {
|
|
||||||
let firstPage = this.pdfViewer.getPageView(0);
|
|
||||||
for (let i = 1, ii = this.pagesCount; i < ii; ++i) {
|
|
||||||
let pageView = this.pdfViewer.getPageView(i);
|
|
||||||
if (pageView.width !== firstPage.width ||
|
|
||||||
pageView.height !== firstPage.height) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
},
|
|
||||||
|
|
||||||
afterPrint: function pdfViewSetupAfterPrint() {
|
afterPrint: function pdfViewSetupAfterPrint() {
|
||||||
if (this.printService) {
|
if (this.printService) {
|
||||||
this.printService.destroy();
|
this.printService.destroy();
|
||||||
|
@ -914,6 +914,22 @@ var PDFViewer = (function pdfViewer() {
|
|||||||
this.findController = findController;
|
this.findController = findController;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @returns {boolean} Whether all pages of the PDF document have identical
|
||||||
|
* widths and heights.
|
||||||
|
*/
|
||||||
|
get hasEqualPageSizes() {
|
||||||
|
let firstPageView = this._pages[0];
|
||||||
|
for (let i = 1, ii = this._pages.length; i < ii; ++i) {
|
||||||
|
let pageView = this._pages[i];
|
||||||
|
if (pageView.width !== firstPageView.width ||
|
||||||
|
pageView.height !== firstPageView.height) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns sizes of the pages.
|
* Returns sizes of the pages.
|
||||||
* @returns {Array} Array of objects with width/height/rotation fields.
|
* @returns {Array} Array of objects with width/height/rotation fields.
|
||||||
|
Loading…
Reference in New Issue
Block a user