Simplify getVisiblePages() in presentation mode

This commit is contained in:
Jonas 2013-09-05 00:42:36 +02:00
parent c5bcd7a7ef
commit 433397f877

View File

@ -1276,16 +1276,8 @@ var PDFView = {
},
getVisiblePages: function pdfViewGetVisiblePages() {
if (!this.isPresentationMode) {
return this.getVisibleElements(this.container, this.pages, true);
} else {
// The algorithm in getVisibleElements is broken in presentation mode.
var visible = [], page = this.page;
var currentPage = this.pages[page - 1];
visible.push({ id: currentPage.id, view: currentPage });
return { first: currentPage, last: currentPage, views: visible};
}
return this.getVisibleElements(this.container, this.pages,
!this.isPresentationMode);
},
getVisibleThumbs: function pdfViewGetVisibleThumbs() {
@ -1780,14 +1772,13 @@ var PageView = function pageView(container, id, scale,
};
this.scrollIntoView = function pageViewScrollIntoView(dest) {
if (PDFView.isPresentationMode) { // Avoid breaking presentation mode.
dest = null;
}
if (!dest) {
scrollIntoView(div);
return;
}
if (PDFView.isPresentationMode) { // Avoid breaking presentation mode.
PDFView.page = id;
return;
}
var x = 0, y = 0;
var width = 0, height = 0, widthScale, heightScale;
@ -2423,11 +2414,9 @@ function updateViewarea() {
currentId = visiblePages[0].id;
}
if (!PDFView.isPresentationMode) {
updateViewarea.inProgress = true; // used in "set page"
PDFView.page = currentId;
updateViewarea.inProgress = false;
}
var currentScale = PDFView.currentScale;
var currentScaleValue = PDFView.currentScaleValue;