Skip to content

Commit 1d12aed

Browse files
committed
Move all PDFJS.xxx settings into display/global.
1 parent 6c9f418 commit 1d12aed

File tree

17 files changed

+538
-403
lines changed

17 files changed

+538
-403
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
];
@@ -526,9 +527,7 @@ target.bundle = function(args) {
526527

527528
var umd = require('./external/umdutils/verifier.js');
528529
var MAIN_SRC_FILES = [
529-
SRC_DIR + 'display/annotation_layer.js',
530-
SRC_DIR + 'display/text_layer.js',
531-
SRC_DIR + 'display/api.js'
530+
SRC_DIR + 'display/global.js'
532531
];
533532

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

541-
// Extension does not need svg.js and network.js files.
540+
// Extension does not need network.js file.
542541
if (!defines.FIREFOX && !defines.MOZCENTRAL) {
543-
MAIN_SRC_FILES.push(SRC_DIR + 'display/svg.js');
544542
WORKER_SRC_FILES.push(SRC_DIR + 'core/network.js');
545543
}
546544

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)