Skip to content

Commit 52d8732

Browse files
committed
Move all PDFJS.xxx settings into display/global.
1 parent df7afcf commit 52d8732

File tree

17 files changed

+511
-383
lines changed

17 files changed

+511
-383
lines changed

make.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@ target.jsdoc = function() {
198198
var JSDOC_FILES = [
199199
'src/doc_helper.js',
200200
'src/display/api.js',
201+
'src/display/global.js',
201202
'src/shared/util.js',
202203
'src/core/annotation.js'
203204
];
@@ -521,9 +522,7 @@ target.bundle = function(args) {
521522

522523
var umd = require('./external/umdutils/verifier.js');
523524
var MAIN_SRC_FILES = [
524-
SRC_DIR + 'display/annotation_layer.js',
525-
SRC_DIR + 'display/text_layer.js',
526-
SRC_DIR + 'display/api.js'
525+
SRC_DIR + 'display/global.js'
527526
];
528527

529528
var WORKER_SRC_FILES = [
@@ -533,9 +532,8 @@ target.bundle = function(args) {
533532
var mainFileName = 'pdf.js';
534533
var workerFileName = 'pdf.worker.js';
535534

536-
// Extension does not need svg.js and network.js files.
535+
// Extension does not need network.js file.
537536
if (!defines.FIREFOX && !defines.MOZCENTRAL) {
538-
MAIN_SRC_FILES.push(SRC_DIR + 'display/svg.js');
539537
WORKER_SRC_FILES.push(SRC_DIR + 'core/network.js');
540538
}
541539

src/display/annotation_layer.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
* See the License for the specific language governing permissions and
1313
* limitations under the License.
1414
*/
15-
/* globals PDFJS */
1615

1716
'use strict';
1817

@@ -35,6 +34,7 @@ var addLinkAttributes = displayDOMUtils.addLinkAttributes;
3534
var getFilenameFromUrl = displayDOMUtils.getFilenameFromUrl;
3635
var warn = sharedUtil.warn;
3736
var CustomStyle = displayDOMUtils.CustomStyle;
37+
var getDefaultSetting = displayDOMUtils.getDefaultSetting;
3838

3939
/**
4040
* @typedef {Object} AnnotationElementParameters
@@ -107,6 +107,7 @@ var AnnotationElement = (function AnnotationElementClosure() {
107107
this.viewport = parameters.viewport;
108108
this.linkService = parameters.linkService;
109109
this.downloadManager = parameters.downloadManager;
110+
this.imageResourcesPath = parameters.imageResourcesPath;
110111

111112
if (isRenderable) {
112113
this.container = this._createContainer();
@@ -363,7 +364,7 @@ var TextAnnotationElement = (function TextAnnotationElementClosure() {
363364
var image = document.createElement('img');
364365
image.style.height = this.container.style.height;
365366
image.style.width = this.container.style.width;
366-
image.src = PDFJS.imageResourcesPath + 'annotation-' +
367+
image.src = this.imageResourcesPath + 'annotation-' +
367368
this.data.name.toLowerCase() + '.svg';
368369
image.alt = '[{{type}} Annotation]';
369370
image.dataset.l10nId = 'text_annotation_type';
@@ -838,6 +839,7 @@ var FileAttachmentAnnotationElement = (
838839
* @property {Array} annotations
839840
* @property {PDFPage} page
840841
* @property {IPDFLinkService} linkService
842+
* @property {string} imageResourcesPath
841843
*/
842844

843845
/**
@@ -868,7 +870,9 @@ var AnnotationLayer = (function AnnotationLayerClosure() {
868870
page: parameters.page,
869871
viewport: parameters.viewport,
870872
linkService: parameters.linkService,
871-
downloadManager: parameters.downloadManager
873+
downloadManager: parameters.downloadManager,
874+
imageResourcesPath: parameters.imageResourcesPath ||
875+
getDefaultSetting('imageResourcesPath')
872876
};
873877
var element = annotationElementFactory.create(properties);
874878
if (element.isRenderable) {
@@ -899,7 +903,5 @@ var AnnotationLayer = (function AnnotationLayerClosure() {
899903
};
900904
})();
901905

902-
PDFJS.AnnotationLayer = AnnotationLayer;
903-
904906
exports.AnnotationLayer = AnnotationLayer;
905907
}));

0 commit comments

Comments
 (0)