Merge pull request #4851 from orionhealth/4792-addprefhashparam

Added more preferences for the available hash parameters.
This commit is contained in:
Yury Delendik 2014-06-02 12:50:42 -05:00
commit c7c1639e1e
4 changed files with 42 additions and 11 deletions

View File

@ -122,6 +122,13 @@ PDFJS.disableCreateObjectURL = (PDFJS.disableCreateObjectURL === undefined ?
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:

View File

@ -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
};

View File

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

View File

@ -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) {