[Pkg-javascript-commits] [pdf.js] 02/72: Update thumbnail style only when sidebar is visible
David Prévot
taffit at moszumanska.debian.org
Wed Mar 18 20:15:54 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository pdf.js.
commit 047d61ed1fbf7744eae3b2113228dfa2ca90283c
Author: fkaelberer <o_0_o at gmx.de>
Date: Tue Jan 27 21:08:36 2015 +0100
Update thumbnail style only when sidebar is visible
---
web/pdf_thumbnail_viewer.js | 4 +++-
web/viewer.js | 8 +++++++-
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/web/pdf_thumbnail_viewer.js b/web/pdf_thumbnail_viewer.js
index 170fa19..5c407ad 100644
--- a/web/pdf_thumbnail_viewer.js
+++ b/web/pdf_thumbnail_viewer.js
@@ -76,7 +76,9 @@ var PDFThumbnailViewer = (function PDFThumbnailViewerClosure() {
selected.classList.remove('selected');
}
var thumbnail = document.getElementById('thumbnailContainer' + page);
- thumbnail.classList.add('selected');
+ if (thumbnail) {
+ thumbnail.classList.add('selected');
+ }
var visibleThumbs = this._getVisibleThumbs();
var numVisibleThumbs = visibleThumbs.views.length;
diff --git a/web/viewer.js b/web/viewer.js
index d47962d..5b954cf 100644
--- a/web/viewer.js
+++ b/web/viewer.js
@@ -1574,6 +1574,10 @@ function webViewerInitialized() {
outerContainer.classList.toggle('sidebarOpen');
PDFViewerApplication.sidebarOpen =
outerContainer.classList.contains('sidebarOpen');
+ if (PDFViewerApplication.sidebarOpen) {
+ PDFViewerApplication.pdfThumbnailViewer.
+ scrollThumbnailIntoView(PDFViewerApplication.page);
+ }
PDFViewerApplication.forceRendering();
});
@@ -1920,7 +1924,9 @@ window.addEventListener('pagechange', function pagechange(evt) {
var page = evt.pageNumber;
if (evt.previousPageNumber !== page) {
document.getElementById('pageNumber').value = page;
- PDFViewerApplication.pdfThumbnailViewer.scrollThumbnailIntoView(page);
+ if (PDFViewerApplication.sidebarOpen) {
+ PDFViewerApplication.pdfThumbnailViewer.scrollThumbnailIntoView(page);
+ }
}
var numPages = PDFViewerApplication.pagesCount;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/pdf.js.git
More information about the Pkg-javascript-commits
mailing list