[Pkg-javascript-commits] [pdf.js] 90/207: Prevent rendering unnecessary pages when the HOME/END keys are pressed

David Prévot taffit at moszumanska.debian.org
Mon Jul 28 15:36:34 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository pdf.js.

commit 5ac4dd95939084582e81bb1eb84dbc9a7b805c7a
Author: Jonas Jenwald <jonas.jenwald at gmail.com>
Date:   Sat Jun 14 14:11:42 2014 +0200

    Prevent rendering unnecessary pages when the HOME/END keys are pressed
    
    Currently (at least in Firefox) when the HOME/END keys are pressed, this will trigger unnecessary rendering of pages that lay between the current page and the first/last page. Avoid this by going straight to the first/last page instead.
---
 web/viewer.js | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/web/viewer.js b/web/viewer.js
index 15eedcb..2e56a91 100644
--- a/web/viewer.js
+++ b/web/viewer.js
@@ -2347,13 +2347,14 @@ window.addEventListener('keydown', function keydown(evt) {
         break;
 
       case 36: // home
-        if (PresentationMode.active) {
+        if (PresentationMode.active || PDFView.page > 1) {
           PDFView.page = 1;
           handled = true;
         }
         break;
       case 35: // end
-        if (PresentationMode.active) {
+        if (PresentationMode.active ||
+            PDFView.page < PDFView.pdfDocument.numPages) {
           PDFView.page = PDFView.pdfDocument.numPages;
           handled = true;
         }

-- 
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