[Pkg-javascript-commits] [pdf.js] 77/157: Simplify the code that resets the value of the `pageNumber` element in `PDFViewerApplication.setInitialView`

David Prévot taffit at moszumanska.debian.org
Tue Aug 11 06:46:39 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 2608757620d08a850123b8dab34afc209518dbcc
Author: Jonas Jenwald <jonas.jenwald at gmail.com>
Date:   Sat Jul 11 12:09:00 2015 +0200

    Simplify the code that resets the value of the `pageNumber` element in `PDFViewerApplication.setInitialView`
    
    After the creation of `PDFViewer`, its `_resetView` method takes care of resetting, among other things, the page number property. Hence we don't need to set `pdfViewer.currentPageNumber = 1;` here any more, and the comment is no longer accurate either.
---
 web/viewer.js | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/web/viewer.js b/web/viewer.js
index 976c9d3..5f5e0b1 100644
--- a/web/viewer.js
+++ b/web/viewer.js
@@ -954,11 +954,10 @@ var PDFViewerApplication = {
   setInitialView: function pdfViewSetInitialView(storedHash, scale) {
     this.isInitialViewSet = true;
 
-    // When opening a new file (when one is already loaded in the viewer):
-    // Reset 'currentPageNumber', since otherwise the page's scale will be wrong
-    // if 'currentPageNumber' is larger than the number of pages in the file.
+    // When opening a new file, when one is already loaded in the viewer,
+    // ensure that the 'pageNumber' element displays the correct value.
     document.getElementById('pageNumber').value =
-      this.pdfViewer.currentPageNumber = 1;
+      this.pdfViewer.currentPageNumber;
 
     if (this.initialDestination) {
       this.pdfLinkService.navigateTo(this.initialDestination);

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