[Pkg-javascript-commits] [pdf.js] 32/141: Add enableWebGL to the preferences

David Prévot taffit at moszumanska.debian.org
Sat Apr 19 22:40:27 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 30ab87883547672788ca4fc80b14087d690616d4
Author: Yury Delendik <ydelendik at mozilla.com>
Date:   Thu Apr 3 12:20:53 2014 -0500

    Add enableWebGL to the preferences
---
 web/default_preferences.js |  3 ++-
 web/viewer.js              | 16 ++++++++++++++--
 2 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/web/default_preferences.js b/web/default_preferences.js
index 8ef7ad9..77b82cf 100644
--- a/web/default_preferences.js
+++ b/web/default_preferences.js
@@ -22,5 +22,6 @@ var DEFAULT_PREFERENCES = {
   showPreviousViewOnLoad: true,
   defaultZoomValue: '',
   ifAvailableShowOutlineOnLoad: false,
-  enableHandToolOnLoad: false
+  enableHandToolOnLoad: false,
+  enableWebGL: false
 };
diff --git a/web/viewer.js b/web/viewer.js
index 5b4d92c..32df033 100644
--- a/web/viewer.js
+++ b/web/viewer.js
@@ -216,10 +216,20 @@ var PDFView = {
       pageCountField: document.getElementById('pageCountField')
     });
 
-    this.initialized = true;
     container.addEventListener('scroll', function() {
       self.lastScroll = Date.now();
     }, false);
+
+    var initializedPromise = Promise.all([
+      Preferences.get('enableWebGL').then(function (value) {
+        PDFJS.disableWebGL = !value;
+      })
+      // TODO move more preferences and other async stuff here
+    ]);
+
+    return initializedPromise.then(function () {
+      PDFView.initialized = true;
+    });
   },
 
   getPage: function pdfViewGetPage(n) {
@@ -1652,8 +1662,10 @@ var DocumentOutlineView = function documentOutlineView(outline) {
 //#endif
 
 function webViewerLoad(evt) {
-  PDFView.initialize();
+  PDFView.initialize().then(webViewerInitialized);
+}
 
+function webViewerInitialized() {
 //#if (GENERIC || B2G)
   var params = PDFView.parseQueryString(document.location.search.substring(1));
   var file = 'file' in params ? params.file : DEFAULT_URL;

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