Merge pull request #4851 from orionhealth/4792-addprefhashparam
Added more preferences for the available hash parameters.
This commit is contained in:
commit
c7c1639e1e
@ -122,6 +122,13 @@ PDFJS.disableCreateObjectURL = (PDFJS.disableCreateObjectURL === undefined ?
|
|||||||
PDFJS.disableWebGL = (PDFJS.disableWebGL === undefined ?
|
PDFJS.disableWebGL = (PDFJS.disableWebGL === undefined ?
|
||||||
true : PDFJS.disableWebGL);
|
true : PDFJS.disableWebGL);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables CSS only zooming.
|
||||||
|
* @var {boolean}
|
||||||
|
*/
|
||||||
|
PDFJS.useOnlyCssZoom = (PDFJS.useOnlyCssZoom === undefined ?
|
||||||
|
false : PDFJS.useOnlyCssZoom);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Controls the logging level.
|
* Controls the logging level.
|
||||||
* The constants from PDFJS.VERBOSITY_LEVELS should be used:
|
* The constants from PDFJS.VERBOSITY_LEVELS should be used:
|
||||||
|
@ -23,5 +23,15 @@ var DEFAULT_PREFERENCES = {
|
|||||||
defaultZoomValue: '',
|
defaultZoomValue: '',
|
||||||
sidebarViewOnLoad: 0,
|
sidebarViewOnLoad: 0,
|
||||||
enableHandToolOnLoad: false,
|
enableHandToolOnLoad: false,
|
||||||
enableWebGL: false
|
enableWebGL: false,
|
||||||
|
disableRange: false,
|
||||||
|
disableAutoFetch: false,
|
||||||
|
disableFontFace: false,
|
||||||
|
//#if B2G
|
||||||
|
//disableTextLayer: true,
|
||||||
|
//useOnlyCssZoom: true
|
||||||
|
//#else
|
||||||
|
disableTextLayer: false,
|
||||||
|
useOnlyCssZoom: false
|
||||||
|
//#endif
|
||||||
};
|
};
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
/* globals RenderingStates, PDFView, PDFHistory, PDFFindBar, PDFJS, mozL10n,
|
/* globals RenderingStates, PDFView, PDFHistory, PDFFindBar, PDFJS, mozL10n,
|
||||||
CustomStyle, PresentationMode, scrollIntoView, SCROLLBAR_PADDING,
|
CustomStyle, PresentationMode, scrollIntoView, SCROLLBAR_PADDING,
|
||||||
CSS_UNITS, UNKNOWN_SCALE, DEFAULT_SCALE, getOutputScale,
|
CSS_UNITS, UNKNOWN_SCALE, DEFAULT_SCALE, getOutputScale,
|
||||||
TextLayerBuilder, cache, Stats, USE_ONLY_CSS_ZOOM */
|
TextLayerBuilder, cache, Stats */
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
@ -119,7 +119,7 @@ var PageView = function pageView(container, id, scale,
|
|||||||
rotation: totalRotation
|
rotation: totalRotation
|
||||||
});
|
});
|
||||||
|
|
||||||
if (USE_ONLY_CSS_ZOOM && this.canvas) {
|
if (PDFJS.useOnlyCssZoom && this.canvas) {
|
||||||
this.cssTransform(this.canvas);
|
this.cssTransform(this.canvas);
|
||||||
return;
|
return;
|
||||||
} else if (this.canvas && !this.zoomLayer) {
|
} else if (this.canvas && !this.zoomLayer) {
|
||||||
@ -195,7 +195,7 @@ var PageView = function pageView(container, id, scale,
|
|||||||
CustomStyle.setProp('transformOrigin', textLayerDiv, '0% 0%');
|
CustomStyle.setProp('transformOrigin', textLayerDiv, '0% 0%');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (USE_ONLY_CSS_ZOOM && this.annotationLayer) {
|
if (PDFJS.useOnlyCssZoom && this.annotationLayer) {
|
||||||
setupAnnotations(div, this.pdfPage, this.viewport);
|
setupAnnotations(div, this.pdfPage, this.viewport);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -492,7 +492,7 @@ var PageView = function pageView(container, id, scale,
|
|||||||
var ctx = canvas.getContext('2d');
|
var ctx = canvas.getContext('2d');
|
||||||
var outputScale = getOutputScale(ctx);
|
var outputScale = getOutputScale(ctx);
|
||||||
|
|
||||||
if (USE_ONLY_CSS_ZOOM) {
|
if (PDFJS.useOnlyCssZoom) {
|
||||||
var actualSizeViewport = viewport.clone({ scale: CSS_UNITS });
|
var actualSizeViewport = viewport.clone({ scale: CSS_UNITS });
|
||||||
// Use a scale that will make the canvas be the original intended size
|
// Use a scale that will make the canvas be the original intended size
|
||||||
// of the page.
|
// of the page.
|
||||||
|
@ -39,11 +39,10 @@ var VIEW_HISTORY_MEMORY = 20;
|
|||||||
var SCALE_SELECT_CONTAINER_PADDING = 8;
|
var SCALE_SELECT_CONTAINER_PADDING = 8;
|
||||||
var SCALE_SELECT_PADDING = 22;
|
var SCALE_SELECT_PADDING = 22;
|
||||||
var THUMBNAIL_SCROLL_MARGIN = -19;
|
var THUMBNAIL_SCROLL_MARGIN = -19;
|
||||||
var USE_ONLY_CSS_ZOOM = false;
|
|
||||||
var CLEANUP_TIMEOUT = 30000;
|
var CLEANUP_TIMEOUT = 30000;
|
||||||
var IGNORE_CURRENT_POSITION_ON_ZOOM = false;
|
var IGNORE_CURRENT_POSITION_ON_ZOOM = false;
|
||||||
//#if B2G
|
//#if B2G
|
||||||
//USE_ONLY_CSS_ZOOM = true;
|
//PDFJS.useOnlyCssZoom = true;
|
||||||
//PDFJS.disableTextLayer = true;
|
//PDFJS.disableTextLayer = true;
|
||||||
//#endif
|
//#endif
|
||||||
var RenderingStates = {
|
var RenderingStates = {
|
||||||
@ -225,12 +224,27 @@ var PDFView = {
|
|||||||
var initializedPromise = Promise.all([
|
var initializedPromise = Promise.all([
|
||||||
Preferences.get('enableWebGL').then(function resolved(value) {
|
Preferences.get('enableWebGL').then(function resolved(value) {
|
||||||
PDFJS.disableWebGL = !value;
|
PDFJS.disableWebGL = !value;
|
||||||
}, function rejected(reason) {}),
|
}),
|
||||||
Preferences.get('sidebarViewOnLoad').then(function resolved(value) {
|
Preferences.get('sidebarViewOnLoad').then(function resolved(value) {
|
||||||
self.preferenceSidebarViewOnLoad = 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
|
// TODO move more preferences and other async stuff here
|
||||||
]);
|
]).catch(function (reason) { });
|
||||||
|
|
||||||
return initializedPromise.then(function () {
|
return initializedPromise.then(function () {
|
||||||
PDFView.initialized = true;
|
PDFView.initialized = true;
|
||||||
@ -1727,7 +1741,7 @@ function webViewerInitialized() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ('useOnlyCssZoom' in hashParams) {
|
if ('useOnlyCssZoom' in hashParams) {
|
||||||
USE_ONLY_CSS_ZOOM = (hashParams['useOnlyCssZoom'] === 'true');
|
PDFJS.useOnlyCssZoom = (hashParams['useOnlyCssZoom'] === 'true');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ('verbosity' in hashParams) {
|
if ('verbosity' in hashParams) {
|
||||||
|
Loading…
Reference in New Issue
Block a user