[Pkg-javascript-commits] [pdf.js] 03/72: Update thumbnail images 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 d3022e1e70f82300529e5fd0a4e8459dcf953bb4
Author: fkaelberer <o_0_o at gmx.de>
Date: Tue Jan 27 21:13:34 2015 +0100
Update thumbnail images only when sidebar is visible
---
web/viewer.js | 29 ++++++++++++++++++++++++-----
1 file changed, 24 insertions(+), 5 deletions(-)
diff --git a/web/viewer.js b/web/viewer.js
index 5b954cf..022d573 100644
--- a/web/viewer.js
+++ b/web/viewer.js
@@ -1177,6 +1177,23 @@ var PDFViewerApplication = {
}
},
+ refreshThumbnailViewer: function pdfViewRefreshThumbnailViewer() {
+ var pdfViewer = this.pdfViewer;
+ var thumbnailViewer = this.pdfThumbnailViewer;
+
+ // set thumbnail images of rendered pages
+ var pagesCount = pdfViewer.pagesCount;
+ for (var pageIndex = 0; pageIndex < pagesCount; pageIndex++) {
+ var pageView = pdfViewer.getPageView(pageIndex);
+ if (pageView && pageView.renderingState === RenderingStates.FINISHED) {
+ var thumbnailView = thumbnailViewer.getThumbnail(pageIndex);
+ thumbnailView.setImage(pageView);
+ }
+ }
+
+ thumbnailViewer.scrollThumbnailIntoView(this.page);
+ },
+
switchSidebarView: function pdfViewSwitchSidebarView(view, openSidebar) {
if (openSidebar && !this.sidebarOpen) {
document.getElementById('sidebarToggle').click();
@@ -1575,8 +1592,7 @@ function webViewerInitialized() {
PDFViewerApplication.sidebarOpen =
outerContainer.classList.contains('sidebarOpen');
if (PDFViewerApplication.sidebarOpen) {
- PDFViewerApplication.pdfThumbnailViewer.
- scrollThumbnailIntoView(PDFViewerApplication.page);
+ PDFViewerApplication.refreshThumbnailViewer();
}
PDFViewerApplication.forceRendering();
});
@@ -1692,9 +1708,12 @@ document.addEventListener('pagerendered', function (e) {
var pageNumber = e.detail.pageNumber;
var pageIndex = pageNumber - 1;
var pageView = PDFViewerApplication.pdfViewer.getPageView(pageIndex);
- var thumbnailView = PDFViewerApplication.pdfThumbnailViewer.
- getThumbnail(pageIndex);
- thumbnailView.setImage(pageView);
+
+ if (PDFViewerApplication.sidebarOpen) {
+ var thumbnailView = PDFViewerApplication.pdfThumbnailViewer.
+ getThumbnail(pageIndex);
+ thumbnailView.setImage(pageView);
+ }
if (PDFJS.pdfBug && Stats.enabled && pageView.stats) {
Stats.add(pageNumber, pageView.stats);
--
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