Fix wrong page being displayed when entering/exiting Presentation mode with zoom set to 'page-fit'

This commit is contained in:
Jonas Jenwald 2014-02-10 13:43:26 +01:00
parent 4563f6cd58
commit d6ca563f46
2 changed files with 21 additions and 6 deletions

View File

@ -329,7 +329,12 @@ var PageView = function pageView(container, id, scale,
}; };
this.scrollIntoView = function pageViewScrollIntoView(dest) { this.scrollIntoView = function pageViewScrollIntoView(dest) {
if (PresentationMode.active) { // Avoid breaking presentation mode. if (PresentationMode.active) {
if (PDFView.page !== this.id) {
// Avoid breaking PDFView.getVisiblePages in presentation mode.
PDFView.page = this.id;
return;
}
dest = null; dest = null;
PDFView.setScale(PDFView.currentScaleValue, true, true); PDFView.setScale(PDFView.currentScaleValue, true, true);
} }

View File

@ -1321,8 +1321,16 @@ var PDFView = {
}, },
getVisiblePages: function pdfViewGetVisiblePages() { getVisiblePages: function pdfViewGetVisiblePages() {
return this.getVisibleElements(this.container, this.pages, if (!PresentationMode.active) {
!PresentationMode.active); return this.getVisibleElements(this.container, this.pages, true);
} else {
// The algorithm in getVisibleElements doesn't work in all browsers and
// configurations when presentation mode is active.
var visible = [];
var currentPage = this.pages[this.page - 1];
visible.push({ id: currentPage.id, view: currentPage });
return { first: currentPage, last: currentPage, views: visible };
}
}, },
getVisibleThumbs: function pdfViewGetVisibleThumbs() { getVisibleThumbs: function pdfViewGetVisibleThumbs() {
@ -1869,9 +1877,11 @@ function updateViewarea() {
currentId = visiblePages[0].id; currentId = visiblePages[0].id;
} }
updateViewarea.inProgress = true; // used in "set page" if (!PresentationMode.active) {
PDFView.page = currentId; updateViewarea.inProgress = true; // used in "set page"
updateViewarea.inProgress = false; PDFView.page = currentId;
updateViewarea.inProgress = false;
}
var currentScale = PDFView.currentScale; var currentScale = PDFView.currentScale;
var currentScaleValue = PDFView.currentScaleValue; var currentScaleValue = PDFView.currentScaleValue;