[Pkg-javascript-commits] [pdf.js] 30/119: Move fetching of the |defaultZoomValue| preference value to |PDFViewerApplication.initialize|

David Prévot taffit at moszumanska.debian.org
Wed May 13 21:27:38 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 03497eabd5521280352780777db251066d787c45
Author: Jonas Jenwald <jonas.jenwald at gmail.com>
Date:   Tue Mar 31 15:33:21 2015 +0200

    Move fetching of the |defaultZoomValue| preference value to |PDFViewerApplication.initialize|
    
    For consistency, this preference should be placed amongst the others. The current position is purely for "historical" reasons, since it was one of the first preferences that was added to the code.
---
 web/viewer.js | 21 ++++++++-------------
 1 file changed, 8 insertions(+), 13 deletions(-)

diff --git a/web/viewer.js b/web/viewer.js
index 2f36426..fe3b226 100644
--- a/web/viewer.js
+++ b/web/viewer.js
@@ -111,6 +111,7 @@ var PDFViewerApplication = {
   preferenceSidebarViewOnLoad: SidebarView.NONE,
   preferencePdfBugEnabled: false,
   preferenceShowPreviousViewOnLoad: true,
+  preferenceDefaultZoomValue: '',
   isViewerEmbedded: (window.parent !== window),
   url: '',
 
@@ -235,6 +236,9 @@ var PDFViewerApplication = {
           window.history.replaceState(null, '');
         }
       }),
+      Preferences.get('defaultZoomValue').then(function resolved(value) {
+        self.preferenceDefaultZoomValue = value;
+      }),
       Preferences.get('disableTextLayer').then(function resolved(value) {
         if (PDFJS.disableTextLayer === true) {
           return;
@@ -259,7 +263,6 @@ var PDFViewerApplication = {
       Preferences.get('useOnlyCssZoom').then(function resolved(value) {
         PDFJS.useOnlyCssZoom = value;
       })
-
       // TODO move more preferences and other async stuff here
     ]).catch(function (reason) { });
 
@@ -885,29 +888,21 @@ var PDFViewerApplication = {
       }
     });
 
-    // Fetch the necessary preference values.
-    var defaultZoomValue;
-    var defaultZoomValuePromise =
-      Preferences.get('defaultZoomValue').then(function (prefValue) {
-        defaultZoomValue = prefValue;
-      });
-
     var storePromise = store.initializedPromise;
-    Promise.all([firstPagePromise, storePromise, defaultZoomValuePromise]).then(
-        function resolved() {
+    Promise.all([firstPagePromise, storePromise]).then(function resolved() {
       var storedHash = null;
       if (PDFViewerApplication.preferenceShowPreviousViewOnLoad &&
           store.get('exists', false)) {
         var pageNum = store.get('page', '1');
-        var zoom = defaultZoomValue ||
+        var zoom = self.preferenceDefaultZoomValue ||
                    store.get('zoom', self.pdfViewer.currentScale);
         var left = store.get('scrollLeft', '0');
         var top = store.get('scrollTop', '0');
 
         storedHash = 'page=' + pageNum + '&zoom=' + zoom + ',' +
                      left + ',' + top;
-      } else if (defaultZoomValue) {
-        storedHash = 'page=1&zoom=' + defaultZoomValue;
+      } else if (self.preferenceDefaultZoomValue) {
+        storedHash = 'page=1&zoom=' + self.preferenceDefaultZoomValue;
       }
       self.setInitialView(storedHash, scale);
 

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