Skip to content

Commit

Permalink
Move all PDFJS.xxx settings into display/global.
Browse files Browse the repository at this point in the history
  • Loading branch information
yurydelendik committed Apr 7, 2016
1 parent 6c9f418 commit 1d12aed
Show file tree
Hide file tree
Showing 17 changed files with 538 additions and 403 deletions.
8 changes: 3 additions & 5 deletions make.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ target.jsdoc = function() {
var JSDOC_FILES = [
'src/doc_helper.js',
'src/display/api.js',
'src/display/global.js',
'src/shared/util.js',
'src/core/annotation.js'
];
Expand Down Expand Up @@ -526,9 +527,7 @@ target.bundle = function(args) {

var umd = require('./external/umdutils/verifier.js');
var MAIN_SRC_FILES = [
SRC_DIR + 'display/annotation_layer.js',
SRC_DIR + 'display/text_layer.js',
SRC_DIR + 'display/api.js'
SRC_DIR + 'display/global.js'
];

var WORKER_SRC_FILES = [
Expand All @@ -538,9 +537,8 @@ target.bundle = function(args) {
var mainFileName = 'pdf.js';
var workerFileName = 'pdf.worker.js';

// Extension does not need svg.js and network.js files.
// Extension does not need network.js file.
if (!defines.FIREFOX && !defines.MOZCENTRAL) {
MAIN_SRC_FILES.push(SRC_DIR + 'display/svg.js');
WORKER_SRC_FILES.push(SRC_DIR + 'core/network.js');
}

Expand Down
12 changes: 7 additions & 5 deletions src/display/annotation_layer.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* globals PDFJS */

'use strict';

Expand All @@ -35,6 +34,7 @@ var addLinkAttributes = displayDOMUtils.addLinkAttributes;
var getFilenameFromUrl = displayDOMUtils.getFilenameFromUrl;
var warn = sharedUtil.warn;
var CustomStyle = displayDOMUtils.CustomStyle;
var getDefaultSetting = displayDOMUtils.getDefaultSetting;

/**
* @typedef {Object} AnnotationElementParameters
Expand Down Expand Up @@ -107,6 +107,7 @@ var AnnotationElement = (function AnnotationElementClosure() {
this.viewport = parameters.viewport;
this.linkService = parameters.linkService;
this.downloadManager = parameters.downloadManager;
this.imageResourcesPath = parameters.imageResourcesPath;

if (isRenderable) {
this.container = this._createContainer();
Expand Down Expand Up @@ -363,7 +364,7 @@ var TextAnnotationElement = (function TextAnnotationElementClosure() {
var image = document.createElement('img');
image.style.height = this.container.style.height;
image.style.width = this.container.style.width;
image.src = PDFJS.imageResourcesPath + 'annotation-' +
image.src = this.imageResourcesPath + 'annotation-' +
this.data.name.toLowerCase() + '.svg';
image.alt = '[{{type}} Annotation]';
image.dataset.l10nId = 'text_annotation_type';
Expand Down Expand Up @@ -838,6 +839,7 @@ var FileAttachmentAnnotationElement = (
* @property {Array} annotations
* @property {PDFPage} page
* @property {IPDFLinkService} linkService
* @property {string} imageResourcesPath
*/

/**
Expand Down Expand Up @@ -868,7 +870,9 @@ var AnnotationLayer = (function AnnotationLayerClosure() {
page: parameters.page,
viewport: parameters.viewport,
linkService: parameters.linkService,
downloadManager: parameters.downloadManager
downloadManager: parameters.downloadManager,
imageResourcesPath: parameters.imageResourcesPath ||
getDefaultSetting('imageResourcesPath')
};
var element = annotationElementFactory.create(properties);
if (element.isRenderable) {
Expand Down Expand Up @@ -899,7 +903,5 @@ var AnnotationLayer = (function AnnotationLayerClosure() {
};
})();

PDFJS.AnnotationLayer = AnnotationLayer;

exports.AnnotationLayer = AnnotationLayer;
}));
Loading

0 comments on commit 1d12aed

Please sign in to comment.