[Pkg-javascript-commits] [pdf.js] 03/207: Added more preference variables from the available hash parameters

David Prévot taffit at moszumanska.debian.org
Mon Jul 28 15:36:23 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 e6546642db150cde7b9de1d094703ad6f11300b1
Author: Mohammed Abu-alsaad <mohammed.abualsaad at orionhealth.com>
Date:   Fri May 30 10:44:41 2014 +1200

    Added more preference variables from the available hash parameters
---
 src/display/api.js         |  7 +++++++
 web/default_preferences.js | 12 +++++++++++-
 web/page_view.js           |  8 ++++----
 web/viewer.js              | 26 ++++++++++++++++++++------
 4 files changed, 42 insertions(+), 11 deletions(-)

diff --git a/src/display/api.js b/src/display/api.js
index 069c064..a7cf6bf 100644
--- a/src/display/api.js
+++ b/src/display/api.js
@@ -123,6 +123,13 @@ PDFJS.disableWebGL = (PDFJS.disableWebGL === undefined ?
                       true : PDFJS.disableWebGL);
 
 /**
+ * Enables CSS only zooming.
+ * @var {boolean}
+ */
+PDFJS.useOnlyCssZoom = (PDFJS.useOnlyCssZoom === undefined ?
+                        false : PDFJS.useOnlyCssZoom);
+
+/**
  * Controls the logging level.
  * The constants from PDFJS.VERBOSITY_LEVELS should be used:
  * - errors
diff --git a/web/default_preferences.js b/web/default_preferences.js
index bfd2321..51a1bcb 100644
--- a/web/default_preferences.js
+++ b/web/default_preferences.js
@@ -23,5 +23,15 @@ var DEFAULT_PREFERENCES = {
   defaultZoomValue: '',
   sidebarViewOnLoad: 0,
   enableHandToolOnLoad: false,
-  enableWebGL: false
+  enableWebGL: false,
+  disableRange: false,
+  disableAutoFetch: false,
+  disableFontFace: false,
+//#if B2G
+//disableTextLayer: true,
+//useOnlyCssZoom: true
+//#else
+  disableTextLayer: false,
+  useOnlyCssZoom: false
+//#endif
 };
diff --git a/web/page_view.js b/web/page_view.js
index 4ec9efd..47b18d7 100644
--- a/web/page_view.js
+++ b/web/page_view.js
@@ -17,7 +17,7 @@
 /* globals RenderingStates, PDFView, PDFHistory, PDFFindBar, PDFJS, mozL10n,
            CustomStyle, PresentationMode, scrollIntoView, SCROLLBAR_PADDING,
            CSS_UNITS, UNKNOWN_SCALE, DEFAULT_SCALE, getOutputScale,
-           TextLayerBuilder, cache, Stats, USE_ONLY_CSS_ZOOM */
+           TextLayerBuilder, cache, Stats */
 
 'use strict';
 
@@ -119,7 +119,7 @@ var PageView = function pageView(container, id, scale,
       rotation: totalRotation
     });
 
-    if (USE_ONLY_CSS_ZOOM && this.canvas) {
+    if (PDFJS.useOnlyCssZoom && this.canvas) {
       this.cssTransform(this.canvas);
       return;
     } else if (this.canvas && !this.zoomLayer) {
@@ -195,7 +195,7 @@ var PageView = function pageView(container, id, scale,
       CustomStyle.setProp('transformOrigin', textLayerDiv, '0% 0%');
     }
 
-    if (USE_ONLY_CSS_ZOOM && this.annotationLayer) {
+    if (PDFJS.useOnlyCssZoom && this.annotationLayer) {
       setupAnnotations(div, this.pdfPage, this.viewport);
     }
   };
@@ -492,7 +492,7 @@ var PageView = function pageView(container, id, scale,
     var ctx = canvas.getContext('2d');
     var outputScale = getOutputScale(ctx);
 
-    if (USE_ONLY_CSS_ZOOM) {
+    if (PDFJS.useOnlyCssZoom) {
       var actualSizeViewport = viewport.clone({ scale: CSS_UNITS });
       // Use a scale that will make the canvas be the original intended size
       // of the page.
diff --git a/web/viewer.js b/web/viewer.js
index 04129ca..12b38d1 100644
--- a/web/viewer.js
+++ b/web/viewer.js
@@ -39,11 +39,10 @@ var VIEW_HISTORY_MEMORY = 20;
 var SCALE_SELECT_CONTAINER_PADDING = 8;
 var SCALE_SELECT_PADDING = 22;
 var THUMBNAIL_SCROLL_MARGIN = -19;
-var USE_ONLY_CSS_ZOOM = false;
 var CLEANUP_TIMEOUT = 30000;
 var IGNORE_CURRENT_POSITION_ON_ZOOM = false;
 //#if B2G
-//USE_ONLY_CSS_ZOOM = true;
+//PDFJS.useOnlyCssZoom = true;
 //PDFJS.disableTextLayer = true;
 //#endif
 var RenderingStates = {
@@ -225,12 +224,27 @@ var PDFView = {
     var initializedPromise = Promise.all([
       Preferences.get('enableWebGL').then(function resolved(value) {
         PDFJS.disableWebGL = !value;
-      }, function rejected(reason) {}),
+      }),
       Preferences.get('sidebarViewOnLoad').then(function resolved(value) {
         self.preferenceSidebarViewOnLoad = value;
-      }, function rejected(reason) {})
+      }),
+      Preferences.get('disableTextLayer').then(function resolved(value) {
+        PDFJS.disableTextLayer = value;
+      }),
+      Preferences.get('disableRange').then(function resolved(value) {
+        PDFJS.disableRange = value;
+      }),
+      Preferences.get('disableAutoFetch').then(function resolved(value) {
+        PDFJS.disableAutoFetch = value;
+      }),
+      Preferences.get('disableFontFace').then(function resolved(value) {
+        PDFJS.disableFontFace = value;
+      }),
+      Preferences.get('useOnlyCssZoom').then(function resolved(value) {
+        PDFJS.useOnlyCssZoom = value;
+      })
       // TODO move more preferences and other async stuff here
-    ]);
+    ]).catch(function (reason) { });
 
     return initializedPromise.then(function () {
       PDFView.initialized = true;
@@ -1727,7 +1741,7 @@ function webViewerInitialized() {
   }
 
   if ('useOnlyCssZoom' in hashParams) {
-    USE_ONLY_CSS_ZOOM = (hashParams['useOnlyCssZoom'] === 'true');
+    PDFJS.useOnlyCssZoom = (hashParams['useOnlyCssZoom'] === 'true');
   }
 
   if ('verbosity' in hashParams) {

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