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() { getVisiblePages: function pdfViewGetVisiblePages() {
if (!this.isPresentationMode) { return this.getVisibleElements(this.container, this.pages,
return this.getVisibleElements(this.container, this.pages, true); !this.isPresentationMode);
} 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};
}
}, },
getVisibleThumbs: function pdfViewGetVisibleThumbs() { getVisibleThumbs: function pdfViewGetVisibleThumbs() {
@ -1780,14 +1772,13 @@ var PageView = function pageView(container, id, scale,
}; };
this.scrollIntoView = function pageViewScrollIntoView(dest) { this.scrollIntoView = function pageViewScrollIntoView(dest) {
if (PDFView.isPresentationMode) { // Avoid breaking presentation mode.
dest = null;
}
if (!dest) { if (!dest) {
scrollIntoView(div); scrollIntoView(div);
return; return;
} }
if (PDFView.isPresentationMode) { // Avoid breaking presentation mode.
PDFView.page = id;
return;
}
var x = 0, y = 0; var x = 0, y = 0;
var width = 0, height = 0, widthScale, heightScale; var width = 0, height = 0, widthScale, heightScale;
@ -2423,11 +2414,9 @@ function updateViewarea() {
currentId = visiblePages[0].id; currentId = visiblePages[0].id;
} }
if (!PDFView.isPresentationMode) { updateViewarea.inProgress = true; // used in "set page"
updateViewarea.inProgress = true; // used in "set page" PDFView.page = currentId;
PDFView.page = currentId; updateViewarea.inProgress = false;
updateViewarea.inProgress = false;
}
var currentScale = PDFView.currentScale; var currentScale = PDFView.currentScale;
var currentScaleValue = PDFView.currentScaleValue; var currentScaleValue = PDFView.currentScaleValue;