pdfjs-dist 2.0.489 → 2.2.228
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of pdfjs-dist might be problematic. Click here for more details.
- package/CODE_OF_CONDUCT.md +15 -0
- package/bower.json +1 -1
- package/build/pdf.js +18515 -11402
- package/build/pdf.js.map +1 -1
- package/build/pdf.min.js +1 -1
- package/build/pdf.worker.js +48266 -37137
- package/build/pdf.worker.js.map +1 -1
- package/build/pdf.worker.min.js +1 -1
- package/external/url/url-lib.js +627 -0
- package/image_decoders/pdf.image_decoders.js +11350 -0
- package/image_decoders/pdf.image_decoders.js.map +1 -0
- package/image_decoders/pdf.image_decoders.min.js +1 -0
- package/lib/core/annotation.js +587 -242
- package/lib/core/arithmetic_decoder.js +275 -245
- package/lib/core/bidi.js +65 -6
- package/lib/core/ccitt.js +173 -18
- package/lib/core/ccitt_stream.js +15 -6
- package/lib/core/cff_parser.js +433 -61
- package/lib/core/charsets.js +5 -4
- package/lib/core/chunked_stream.js +400 -152
- package/lib/core/cmap.js +326 -87
- package/lib/core/colorspace.js +874 -594
- package/lib/core/core_utils.js +147 -0
- package/lib/core/crypto.js +290 -45
- package/lib/core/document.js +560 -268
- package/lib/core/encodings.js +19 -10
- package/lib/core/evaluator.js +1005 -360
- package/lib/core/font_renderer.js +331 -97
- package/lib/core/fonts.js +812 -195
- package/lib/core/function.js +284 -71
- package/lib/core/glyphlist.js +4 -3
- package/lib/core/image.js +169 -62
- package/lib/core/image_utils.js +111 -0
- package/lib/core/jbig2.js +479 -66
- package/lib/core/jbig2_stream.js +19 -8
- package/lib/core/jpeg_stream.js +38 -13
- package/lib/core/jpg.js +253 -29
- package/lib/core/jpx.js +396 -6
- package/lib/core/jpx_stream.js +18 -6
- package/lib/core/metrics.js +15 -15
- package/lib/core/murmurhash3.js +56 -34
- package/lib/core/obj.js +1354 -488
- package/lib/core/operator_list.js +144 -31
- package/lib/core/parser.js +539 -191
- package/lib/core/pattern.js +148 -14
- package/lib/core/pdf_manager.js +323 -133
- package/lib/core/primitives.js +111 -24
- package/lib/core/ps_parser.js +134 -45
- package/lib/core/standard_fonts.js +17 -17
- package/lib/core/stream.js +313 -34
- package/lib/core/type1_parser.js +143 -13
- package/lib/core/unicode.js +32 -5
- package/lib/core/worker.js +217 -190
- package/lib/core/worker_stream.js +277 -0
- package/lib/display/annotation_layer.js +450 -133
- package/lib/display/api.js +1597 -784
- package/lib/display/api_compatibility.js +11 -13
- package/lib/display/canvas.js +360 -44
- package/lib/display/content_disposition.js +83 -32
- package/lib/display/display_utils.js +747 -0
- package/lib/display/fetch_stream.js +221 -90
- package/lib/display/font_loader.js +468 -236
- package/lib/display/metadata.js +38 -16
- package/lib/display/network.js +635 -428
- package/lib/display/network_utils.js +32 -19
- package/lib/display/node_stream.js +367 -175
- package/lib/display/pattern_helper.js +81 -31
- package/lib/display/svg.js +1235 -519
- package/lib/display/text_layer.js +153 -29
- package/lib/display/transport_stream.js +345 -94
- package/lib/display/webgl.js +64 -18
- package/lib/display/worker_options.js +5 -4
- package/lib/display/xml_parser.js +166 -53
- package/lib/examples/node/domstubs.js +60 -4
- package/lib/pdf.js +36 -14
- package/lib/pdf.worker.js +5 -3
- package/lib/shared/compatibility.js +158 -564
- package/lib/shared/global_scope.js +2 -2
- package/lib/shared/is_node.js +4 -4
- package/lib/shared/message_handler.js +521 -0
- package/lib/shared/streams_polyfill.js +21 -17
- package/lib/shared/url_polyfill.js +56 -0
- package/lib/shared/util.js +243 -710
- package/lib/test/unit/annotation_spec.js +870 -401
- package/lib/test/unit/api_spec.js +657 -345
- package/lib/test/unit/bidi_spec.js +7 -7
- package/lib/test/unit/cff_parser_spec.js +54 -11
- package/lib/test/unit/clitests_helper.js +10 -8
- package/lib/test/unit/cmap_spec.js +95 -41
- package/lib/test/unit/colorspace_spec.js +115 -63
- package/lib/test/unit/core_utils_spec.js +191 -0
- package/lib/test/unit/crypto_spec.js +17 -5
- package/lib/test/unit/custom_spec.js +43 -55
- package/lib/test/unit/display_svg_spec.js +34 -18
- package/lib/test/unit/display_utils_spec.js +273 -0
- package/lib/test/unit/document_spec.js +8 -13
- package/lib/test/unit/encodings_spec.js +25 -45
- package/lib/test/unit/evaluator_spec.js +38 -15
- package/lib/test/unit/fetch_stream_spec.js +109 -0
- package/lib/test/unit/function_spec.js +17 -5
- package/lib/test/unit/jasmine-boot.js +33 -20
- package/lib/test/unit/{util_stream_spec.js → message_handler_spec.js} +41 -69
- package/lib/test/unit/metadata_spec.js +71 -11
- package/lib/test/unit/murmurhash3_spec.js +3 -3
- package/lib/test/unit/network_spec.js +19 -54
- package/lib/test/unit/network_utils_spec.js +91 -14
- package/lib/test/unit/node_stream_spec.js +56 -32
- package/lib/test/unit/parser_spec.js +162 -71
- package/lib/test/unit/pdf_find_controller_spec.js +230 -0
- package/lib/test/unit/pdf_find_utils_spec.js +63 -0
- package/lib/test/unit/pdf_history_spec.js +21 -9
- package/lib/test/unit/primitives_spec.js +53 -20
- package/lib/test/unit/stream_spec.js +12 -4
- package/lib/test/unit/test_utils.js +273 -56
- package/lib/test/unit/testreporter.js +21 -3
- package/lib/test/unit/type1_parser_spec.js +8 -6
- package/lib/test/unit/ui_utils_spec.js +454 -16
- package/lib/test/unit/unicode_spec.js +18 -15
- package/lib/test/unit/util_spec.js +87 -128
- package/lib/web/annotation_layer_builder.js +39 -22
- package/lib/web/app.js +1290 -588
- package/lib/web/app_options.js +100 -62
- package/lib/web/base_viewer.js +511 -182
- package/lib/web/chromecom.js +261 -117
- package/lib/web/debugger.js +166 -22
- package/lib/web/download_manager.js +32 -13
- package/lib/web/firefox_print_service.js +20 -10
- package/lib/web/firefoxcom.js +315 -80
- package/lib/web/genericcom.js +89 -30
- package/lib/web/genericl10n.js +142 -30
- package/lib/web/grab_to_pan.js +28 -4
- package/lib/web/interfaces.js +170 -47
- package/lib/web/overlay_manager.js +235 -85
- package/lib/web/password_prompt.js +22 -14
- package/lib/web/pdf_attachment_viewer.js +38 -18
- package/lib/web/pdf_cursor_tools.js +39 -16
- package/lib/web/pdf_document_properties.js +255 -136
- package/lib/web/pdf_find_bar.js +84 -40
- package/lib/web/pdf_find_controller.js +495 -184
- package/lib/web/pdf_find_utils.js +111 -0
- package/lib/web/pdf_history.js +190 -53
- package/lib/web/pdf_link_service.js +138 -77
- package/lib/web/pdf_outline_viewer.js +122 -46
- package/lib/web/pdf_page_view.js +191 -67
- package/lib/web/pdf_presentation_mode.js +99 -34
- package/lib/web/pdf_print_service.js +61 -13
- package/lib/web/pdf_rendering_queue.js +28 -9
- package/lib/web/pdf_sidebar.js +141 -81
- package/lib/web/pdf_sidebar_resizer.js +42 -16
- package/lib/web/pdf_single_page_viewer.js +74 -66
- package/lib/web/pdf_thumbnail_view.js +104 -33
- package/lib/web/pdf_thumbnail_viewer.js +66 -26
- package/lib/web/pdf_viewer.component.js +112 -32
- package/lib/web/pdf_viewer.js +91 -52
- package/lib/web/preferences.js +284 -89
- package/lib/web/secondary_toolbar.js +165 -40
- package/lib/web/text_layer_builder.js +134 -59
- package/lib/web/toolbar.js +78 -43
- package/lib/web/ui_utils.js +462 -136
- package/lib/web/view_history.js +215 -67
- package/lib/web/viewer_compatibility.js +4 -13
- package/package.json +5 -4
- package/web/pdf_viewer.css +79 -11
- package/web/pdf_viewer.js +6107 -3748
- package/web/pdf_viewer.js.map +1 -1
- package/lib/display/dom_utils.js +0 -309
- package/lib/test/unit/dom_utils_spec.js +0 -89
- package/lib/test/unit/fonts_spec.js +0 -81
- package/lib/web/dom_events.js +0 -137
@@ -2,7 +2,7 @@
|
|
2
2
|
* @licstart The following is the entire license notice for the
|
3
3
|
* Javascript code in this page
|
4
4
|
*
|
5
|
-
* Copyright
|
5
|
+
* Copyright 2019 Mozilla Foundation
|
6
6
|
*
|
7
7
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
8
8
|
* you may not use this file except in compliance with the License.
|
@@ -19,81 +19,125 @@
|
|
19
19
|
* @licend The above is the entire license notice for the
|
20
20
|
* Javascript code in this page
|
21
21
|
*/
|
22
|
-
|
22
|
+
"use strict";
|
23
23
|
|
24
24
|
Object.defineProperty(exports, "__esModule", {
|
25
25
|
value: true
|
26
26
|
});
|
27
|
-
exports.AnnotationLayer =
|
27
|
+
exports.AnnotationLayer = void 0;
|
28
28
|
|
29
|
-
var
|
29
|
+
var _display_utils = require("./display_utils");
|
30
30
|
|
31
|
-
var
|
31
|
+
var _util = require("../shared/util");
|
32
32
|
|
33
|
-
var
|
33
|
+
function _get(target, property, receiver) { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(receiver); } return desc.value; }; } return _get(target, property, receiver || target); }
|
34
34
|
|
35
|
-
|
35
|
+
function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
|
36
36
|
|
37
|
-
function
|
37
|
+
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
38
38
|
|
39
|
-
function
|
39
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
40
|
+
|
41
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
42
|
+
|
43
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
44
|
+
|
45
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
46
|
+
|
47
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
40
48
|
|
41
49
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
42
50
|
|
43
|
-
var
|
51
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
52
|
+
|
53
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
54
|
+
|
55
|
+
var AnnotationElementFactory =
|
56
|
+
/*#__PURE__*/
|
57
|
+
function () {
|
44
58
|
function AnnotationElementFactory() {
|
45
59
|
_classCallCheck(this, AnnotationElementFactory);
|
46
60
|
}
|
47
61
|
|
48
62
|
_createClass(AnnotationElementFactory, null, [{
|
49
|
-
key:
|
63
|
+
key: "create",
|
50
64
|
value: function create(parameters) {
|
51
65
|
var subtype = parameters.data.annotationType;
|
66
|
+
|
52
67
|
switch (subtype) {
|
53
68
|
case _util.AnnotationType.LINK:
|
54
69
|
return new LinkAnnotationElement(parameters);
|
70
|
+
|
55
71
|
case _util.AnnotationType.TEXT:
|
56
72
|
return new TextAnnotationElement(parameters);
|
73
|
+
|
57
74
|
case _util.AnnotationType.WIDGET:
|
58
75
|
var fieldType = parameters.data.fieldType;
|
76
|
+
|
59
77
|
switch (fieldType) {
|
60
78
|
case 'Tx':
|
61
79
|
return new TextWidgetAnnotationElement(parameters);
|
80
|
+
|
62
81
|
case 'Btn':
|
63
82
|
if (parameters.data.radioButton) {
|
64
83
|
return new RadioButtonWidgetAnnotationElement(parameters);
|
65
84
|
} else if (parameters.data.checkBox) {
|
66
85
|
return new CheckboxWidgetAnnotationElement(parameters);
|
67
86
|
}
|
87
|
+
|
68
88
|
return new PushButtonWidgetAnnotationElement(parameters);
|
89
|
+
|
69
90
|
case 'Ch':
|
70
91
|
return new ChoiceWidgetAnnotationElement(parameters);
|
71
92
|
}
|
93
|
+
|
72
94
|
return new WidgetAnnotationElement(parameters);
|
95
|
+
|
73
96
|
case _util.AnnotationType.POPUP:
|
74
97
|
return new PopupAnnotationElement(parameters);
|
98
|
+
|
99
|
+
case _util.AnnotationType.FREETEXT:
|
100
|
+
return new FreeTextAnnotationElement(parameters);
|
101
|
+
|
75
102
|
case _util.AnnotationType.LINE:
|
76
103
|
return new LineAnnotationElement(parameters);
|
104
|
+
|
77
105
|
case _util.AnnotationType.SQUARE:
|
78
106
|
return new SquareAnnotationElement(parameters);
|
107
|
+
|
79
108
|
case _util.AnnotationType.CIRCLE:
|
80
109
|
return new CircleAnnotationElement(parameters);
|
110
|
+
|
81
111
|
case _util.AnnotationType.POLYLINE:
|
82
112
|
return new PolylineAnnotationElement(parameters);
|
113
|
+
|
114
|
+
case _util.AnnotationType.CARET:
|
115
|
+
return new CaretAnnotationElement(parameters);
|
116
|
+
|
117
|
+
case _util.AnnotationType.INK:
|
118
|
+
return new InkAnnotationElement(parameters);
|
119
|
+
|
83
120
|
case _util.AnnotationType.POLYGON:
|
84
121
|
return new PolygonAnnotationElement(parameters);
|
122
|
+
|
85
123
|
case _util.AnnotationType.HIGHLIGHT:
|
86
124
|
return new HighlightAnnotationElement(parameters);
|
125
|
+
|
87
126
|
case _util.AnnotationType.UNDERLINE:
|
88
127
|
return new UnderlineAnnotationElement(parameters);
|
128
|
+
|
89
129
|
case _util.AnnotationType.SQUIGGLY:
|
90
130
|
return new SquigglyAnnotationElement(parameters);
|
131
|
+
|
91
132
|
case _util.AnnotationType.STRIKEOUT:
|
92
133
|
return new StrikeOutAnnotationElement(parameters);
|
134
|
+
|
93
135
|
case _util.AnnotationType.STAMP:
|
94
136
|
return new StampAnnotationElement(parameters);
|
137
|
+
|
95
138
|
case _util.AnnotationType.FILEATTACHMENT:
|
96
139
|
return new FileAttachmentAnnotationElement(parameters);
|
140
|
+
|
97
141
|
default:
|
98
142
|
return new AnnotationElement(parameters);
|
99
143
|
}
|
@@ -103,7 +147,9 @@ var AnnotationElementFactory = function () {
|
|
103
147
|
return AnnotationElementFactory;
|
104
148
|
}();
|
105
149
|
|
106
|
-
var AnnotationElement =
|
150
|
+
var AnnotationElement =
|
151
|
+
/*#__PURE__*/
|
152
|
+
function () {
|
107
153
|
function AnnotationElement(parameters) {
|
108
154
|
var isRenderable = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
109
155
|
var ignoreBorder = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
@@ -120,16 +166,16 @@ var AnnotationElement = function () {
|
|
120
166
|
this.imageResourcesPath = parameters.imageResourcesPath;
|
121
167
|
this.renderInteractiveForms = parameters.renderInteractiveForms;
|
122
168
|
this.svgFactory = parameters.svgFactory;
|
169
|
+
|
123
170
|
if (isRenderable) {
|
124
171
|
this.container = this._createContainer(ignoreBorder);
|
125
172
|
}
|
126
173
|
}
|
127
174
|
|
128
175
|
_createClass(AnnotationElement, [{
|
129
|
-
key:
|
176
|
+
key: "_createContainer",
|
130
177
|
value: function _createContainer() {
|
131
178
|
var ignoreBorder = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
132
|
-
|
133
179
|
var data = this.data,
|
134
180
|
page = this.page,
|
135
181
|
viewport = this.viewport;
|
@@ -137,46 +183,60 @@ var AnnotationElement = function () {
|
|
137
183
|
var width = data.rect[2] - data.rect[0];
|
138
184
|
var height = data.rect[3] - data.rect[1];
|
139
185
|
container.setAttribute('data-annotation-id', data.id);
|
186
|
+
|
140
187
|
var rect = _util.Util.normalizeRect([data.rect[0], page.view[3] - data.rect[1] + page.view[1], data.rect[2], page.view[3] - data.rect[3] + page.view[1]]);
|
188
|
+
|
141
189
|
container.style.transform = 'matrix(' + viewport.transform.join(',') + ')';
|
142
190
|
container.style.transformOrigin = -rect[0] + 'px ' + -rect[1] + 'px';
|
191
|
+
|
143
192
|
if (!ignoreBorder && data.borderStyle.width > 0) {
|
144
193
|
container.style.borderWidth = data.borderStyle.width + 'px';
|
194
|
+
|
145
195
|
if (data.borderStyle.style !== _util.AnnotationBorderStyleType.UNDERLINE) {
|
146
196
|
width = width - 2 * data.borderStyle.width;
|
147
197
|
height = height - 2 * data.borderStyle.width;
|
148
198
|
}
|
199
|
+
|
149
200
|
var horizontalRadius = data.borderStyle.horizontalCornerRadius;
|
150
201
|
var verticalRadius = data.borderStyle.verticalCornerRadius;
|
202
|
+
|
151
203
|
if (horizontalRadius > 0 || verticalRadius > 0) {
|
152
204
|
var radius = horizontalRadius + 'px / ' + verticalRadius + 'px';
|
153
205
|
container.style.borderRadius = radius;
|
154
206
|
}
|
207
|
+
|
155
208
|
switch (data.borderStyle.style) {
|
156
209
|
case _util.AnnotationBorderStyleType.SOLID:
|
157
210
|
container.style.borderStyle = 'solid';
|
158
211
|
break;
|
212
|
+
|
159
213
|
case _util.AnnotationBorderStyleType.DASHED:
|
160
214
|
container.style.borderStyle = 'dashed';
|
161
215
|
break;
|
216
|
+
|
162
217
|
case _util.AnnotationBorderStyleType.BEVELED:
|
163
218
|
(0, _util.warn)('Unimplemented border style: beveled');
|
164
219
|
break;
|
220
|
+
|
165
221
|
case _util.AnnotationBorderStyleType.INSET:
|
166
222
|
(0, _util.warn)('Unimplemented border style: inset');
|
167
223
|
break;
|
224
|
+
|
168
225
|
case _util.AnnotationBorderStyleType.UNDERLINE:
|
169
226
|
container.style.borderBottomStyle = 'solid';
|
170
227
|
break;
|
228
|
+
|
171
229
|
default:
|
172
230
|
break;
|
173
231
|
}
|
232
|
+
|
174
233
|
if (data.color) {
|
175
234
|
container.style.borderColor = _util.Util.makeCssRgb(data.color[0] | 0, data.color[1] | 0, data.color[2] | 0);
|
176
235
|
} else {
|
177
236
|
container.style.borderWidth = 0;
|
178
237
|
}
|
179
238
|
}
|
239
|
+
|
180
240
|
container.style.left = rect[0] + 'px';
|
181
241
|
container.style.top = rect[1] + 'px';
|
182
242
|
container.style.width = width + 'px';
|
@@ -184,7 +244,7 @@ var AnnotationElement = function () {
|
|
184
244
|
return container;
|
185
245
|
}
|
186
246
|
}, {
|
187
|
-
key:
|
247
|
+
key: "_createPopup",
|
188
248
|
value: function _createPopup(container, trigger, data) {
|
189
249
|
if (!trigger) {
|
190
250
|
trigger = document.createElement('div');
|
@@ -192,11 +252,13 @@ var AnnotationElement = function () {
|
|
192
252
|
trigger.style.width = container.style.width;
|
193
253
|
container.appendChild(trigger);
|
194
254
|
}
|
255
|
+
|
195
256
|
var popupElement = new PopupElement({
|
196
257
|
container: container,
|
197
258
|
trigger: trigger,
|
198
259
|
color: data.color,
|
199
260
|
title: data.title,
|
261
|
+
modificationDate: data.modificationDate,
|
200
262
|
contents: data.contents,
|
201
263
|
hideWrapper: true
|
202
264
|
});
|
@@ -205,7 +267,7 @@ var AnnotationElement = function () {
|
|
205
267
|
container.appendChild(popup);
|
206
268
|
}
|
207
269
|
}, {
|
208
|
-
key:
|
270
|
+
key: "render",
|
209
271
|
value: function render() {
|
210
272
|
(0, _util.unreachable)('Abstract method `AnnotationElement.render` called');
|
211
273
|
}
|
@@ -214,29 +276,31 @@ var AnnotationElement = function () {
|
|
214
276
|
return AnnotationElement;
|
215
277
|
}();
|
216
278
|
|
217
|
-
var LinkAnnotationElement =
|
279
|
+
var LinkAnnotationElement =
|
280
|
+
/*#__PURE__*/
|
281
|
+
function (_AnnotationElement) {
|
218
282
|
_inherits(LinkAnnotationElement, _AnnotationElement);
|
219
283
|
|
220
284
|
function LinkAnnotationElement(parameters) {
|
221
285
|
_classCallCheck(this, LinkAnnotationElement);
|
222
286
|
|
223
287
|
var isRenderable = !!(parameters.data.url || parameters.data.dest || parameters.data.action);
|
224
|
-
return _possibleConstructorReturn(this, (LinkAnnotationElement
|
288
|
+
return _possibleConstructorReturn(this, _getPrototypeOf(LinkAnnotationElement).call(this, parameters, isRenderable));
|
225
289
|
}
|
226
290
|
|
227
291
|
_createClass(LinkAnnotationElement, [{
|
228
|
-
key:
|
292
|
+
key: "render",
|
229
293
|
value: function render() {
|
230
294
|
this.container.className = 'linkAnnotation';
|
231
295
|
var data = this.data,
|
232
296
|
linkService = this.linkService;
|
233
|
-
|
234
297
|
var link = document.createElement('a');
|
235
|
-
(0,
|
298
|
+
(0, _display_utils.addLinkAttributes)(link, {
|
236
299
|
url: data.url,
|
237
|
-
target: data.newWindow ?
|
300
|
+
target: data.newWindow ? _display_utils.LinkTarget.BLANK : linkService.externalLinkTarget,
|
238
301
|
rel: linkService.externalLinkRel
|
239
302
|
});
|
303
|
+
|
240
304
|
if (!data.url) {
|
241
305
|
if (data.action) {
|
242
306
|
this._bindNamedAction(link, data.action);
|
@@ -244,35 +308,42 @@ var LinkAnnotationElement = function (_AnnotationElement) {
|
|
244
308
|
this._bindLink(link, data.dest);
|
245
309
|
}
|
246
310
|
}
|
311
|
+
|
247
312
|
this.container.appendChild(link);
|
248
313
|
return this.container;
|
249
314
|
}
|
250
315
|
}, {
|
251
|
-
key:
|
316
|
+
key: "_bindLink",
|
252
317
|
value: function _bindLink(link, destination) {
|
253
|
-
var
|
318
|
+
var _this = this;
|
254
319
|
|
255
320
|
link.href = this.linkService.getDestinationHash(destination);
|
321
|
+
|
256
322
|
link.onclick = function () {
|
257
323
|
if (destination) {
|
258
|
-
|
324
|
+
_this.linkService.navigateTo(destination);
|
259
325
|
}
|
326
|
+
|
260
327
|
return false;
|
261
328
|
};
|
329
|
+
|
262
330
|
if (destination) {
|
263
331
|
link.className = 'internalLink';
|
264
332
|
}
|
265
333
|
}
|
266
334
|
}, {
|
267
|
-
key:
|
335
|
+
key: "_bindNamedAction",
|
268
336
|
value: function _bindNamedAction(link, action) {
|
269
|
-
var
|
337
|
+
var _this2 = this;
|
270
338
|
|
271
339
|
link.href = this.linkService.getAnchorUrl('');
|
340
|
+
|
272
341
|
link.onclick = function () {
|
273
|
-
|
342
|
+
_this2.linkService.executeNamedAction(action);
|
343
|
+
|
274
344
|
return false;
|
275
345
|
};
|
346
|
+
|
276
347
|
link.className = 'internalLink';
|
277
348
|
}
|
278
349
|
}]);
|
@@ -280,18 +351,20 @@ var LinkAnnotationElement = function (_AnnotationElement) {
|
|
280
351
|
return LinkAnnotationElement;
|
281
352
|
}(AnnotationElement);
|
282
353
|
|
283
|
-
var TextAnnotationElement =
|
354
|
+
var TextAnnotationElement =
|
355
|
+
/*#__PURE__*/
|
356
|
+
function (_AnnotationElement2) {
|
284
357
|
_inherits(TextAnnotationElement, _AnnotationElement2);
|
285
358
|
|
286
359
|
function TextAnnotationElement(parameters) {
|
287
360
|
_classCallCheck(this, TextAnnotationElement);
|
288
361
|
|
289
362
|
var isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents);
|
290
|
-
return _possibleConstructorReturn(this, (TextAnnotationElement
|
363
|
+
return _possibleConstructorReturn(this, _getPrototypeOf(TextAnnotationElement).call(this, parameters, isRenderable));
|
291
364
|
}
|
292
365
|
|
293
366
|
_createClass(TextAnnotationElement, [{
|
294
|
-
key:
|
367
|
+
key: "render",
|
295
368
|
value: function render() {
|
296
369
|
this.container.className = 'textAnnotation';
|
297
370
|
var image = document.createElement('img');
|
@@ -300,10 +373,14 @@ var TextAnnotationElement = function (_AnnotationElement2) {
|
|
300
373
|
image.src = this.imageResourcesPath + 'annotation-' + this.data.name.toLowerCase() + '.svg';
|
301
374
|
image.alt = '[{{type}} Annotation]';
|
302
375
|
image.dataset.l10nId = 'text_annotation_type';
|
303
|
-
image.dataset.l10nArgs = JSON.stringify({
|
376
|
+
image.dataset.l10nArgs = JSON.stringify({
|
377
|
+
type: this.data.name
|
378
|
+
});
|
379
|
+
|
304
380
|
if (!this.data.hasPopup) {
|
305
381
|
this._createPopup(this.container, image, this.data);
|
306
382
|
}
|
383
|
+
|
307
384
|
this.container.appendChild(image);
|
308
385
|
return this.container;
|
309
386
|
}
|
@@ -312,17 +389,19 @@ var TextAnnotationElement = function (_AnnotationElement2) {
|
|
312
389
|
return TextAnnotationElement;
|
313
390
|
}(AnnotationElement);
|
314
391
|
|
315
|
-
var WidgetAnnotationElement =
|
392
|
+
var WidgetAnnotationElement =
|
393
|
+
/*#__PURE__*/
|
394
|
+
function (_AnnotationElement3) {
|
316
395
|
_inherits(WidgetAnnotationElement, _AnnotationElement3);
|
317
396
|
|
318
397
|
function WidgetAnnotationElement() {
|
319
398
|
_classCallCheck(this, WidgetAnnotationElement);
|
320
399
|
|
321
|
-
return _possibleConstructorReturn(this, (WidgetAnnotationElement
|
400
|
+
return _possibleConstructorReturn(this, _getPrototypeOf(WidgetAnnotationElement).apply(this, arguments));
|
322
401
|
}
|
323
402
|
|
324
403
|
_createClass(WidgetAnnotationElement, [{
|
325
|
-
key:
|
404
|
+
key: "render",
|
326
405
|
value: function render() {
|
327
406
|
return this.container;
|
328
407
|
}
|
@@ -331,22 +410,25 @@ var WidgetAnnotationElement = function (_AnnotationElement3) {
|
|
331
410
|
return WidgetAnnotationElement;
|
332
411
|
}(AnnotationElement);
|
333
412
|
|
334
|
-
var TextWidgetAnnotationElement =
|
413
|
+
var TextWidgetAnnotationElement =
|
414
|
+
/*#__PURE__*/
|
415
|
+
function (_WidgetAnnotationElem) {
|
335
416
|
_inherits(TextWidgetAnnotationElement, _WidgetAnnotationElem);
|
336
417
|
|
337
418
|
function TextWidgetAnnotationElement(parameters) {
|
338
419
|
_classCallCheck(this, TextWidgetAnnotationElement);
|
339
420
|
|
340
421
|
var isRenderable = parameters.renderInteractiveForms || !parameters.data.hasAppearance && !!parameters.data.fieldValue;
|
341
|
-
return _possibleConstructorReturn(this, (TextWidgetAnnotationElement
|
422
|
+
return _possibleConstructorReturn(this, _getPrototypeOf(TextWidgetAnnotationElement).call(this, parameters, isRenderable));
|
342
423
|
}
|
343
424
|
|
344
425
|
_createClass(TextWidgetAnnotationElement, [{
|
345
|
-
key:
|
426
|
+
key: "render",
|
346
427
|
value: function render() {
|
347
428
|
var TEXT_ALIGNMENT = ['left', 'center', 'right'];
|
348
429
|
this.container.className = 'textWidgetAnnotation';
|
349
430
|
var element = null;
|
431
|
+
|
350
432
|
if (this.renderInteractiveForms) {
|
351
433
|
if (this.data.multiLine) {
|
352
434
|
element = document.createElement('textarea');
|
@@ -356,10 +438,13 @@ var TextWidgetAnnotationElement = function (_WidgetAnnotationElem) {
|
|
356
438
|
element.type = 'text';
|
357
439
|
element.setAttribute('value', this.data.fieldValue);
|
358
440
|
}
|
441
|
+
|
359
442
|
element.disabled = this.data.readOnly;
|
443
|
+
|
360
444
|
if (this.data.maxLen !== null) {
|
361
445
|
element.maxLength = this.data.maxLen;
|
362
446
|
}
|
447
|
+
|
363
448
|
if (this.data.comb) {
|
364
449
|
var fieldWidth = this.data.rect[2] - this.data.rect[0];
|
365
450
|
var combWidth = fieldWidth / this.data.maxLen;
|
@@ -372,26 +457,32 @@ var TextWidgetAnnotationElement = function (_WidgetAnnotationElem) {
|
|
372
457
|
element.style.verticalAlign = 'middle';
|
373
458
|
element.style.display = 'table-cell';
|
374
459
|
var font = null;
|
375
|
-
|
376
|
-
|
460
|
+
|
461
|
+
if (this.data.fontRefName && this.page.commonObjs.has(this.data.fontRefName)) {
|
462
|
+
font = this.page.commonObjs.get(this.data.fontRefName);
|
377
463
|
}
|
464
|
+
|
378
465
|
this._setTextStyle(element, font);
|
379
466
|
}
|
467
|
+
|
380
468
|
if (this.data.textAlignment !== null) {
|
381
469
|
element.style.textAlign = TEXT_ALIGNMENT[this.data.textAlignment];
|
382
470
|
}
|
471
|
+
|
383
472
|
this.container.appendChild(element);
|
384
473
|
return this.container;
|
385
474
|
}
|
386
475
|
}, {
|
387
|
-
key:
|
476
|
+
key: "_setTextStyle",
|
388
477
|
value: function _setTextStyle(element, font) {
|
389
478
|
var style = element.style;
|
390
479
|
style.fontSize = this.data.fontSize + 'px';
|
391
480
|
style.direction = this.data.fontDirection < 0 ? 'rtl' : 'ltr';
|
481
|
+
|
392
482
|
if (!font) {
|
393
483
|
return;
|
394
484
|
}
|
485
|
+
|
395
486
|
style.fontWeight = font.black ? font.bold ? '900' : 'bold' : font.bold ? 'bold' : 'normal';
|
396
487
|
style.fontStyle = font.italic ? 'italic' : 'normal';
|
397
488
|
var fontFamily = font.loadedName ? '"' + font.loadedName + '", ' : '';
|
@@ -403,25 +494,29 @@ var TextWidgetAnnotationElement = function (_WidgetAnnotationElem) {
|
|
403
494
|
return TextWidgetAnnotationElement;
|
404
495
|
}(WidgetAnnotationElement);
|
405
496
|
|
406
|
-
var CheckboxWidgetAnnotationElement =
|
497
|
+
var CheckboxWidgetAnnotationElement =
|
498
|
+
/*#__PURE__*/
|
499
|
+
function (_WidgetAnnotationElem2) {
|
407
500
|
_inherits(CheckboxWidgetAnnotationElement, _WidgetAnnotationElem2);
|
408
501
|
|
409
502
|
function CheckboxWidgetAnnotationElement(parameters) {
|
410
503
|
_classCallCheck(this, CheckboxWidgetAnnotationElement);
|
411
504
|
|
412
|
-
return _possibleConstructorReturn(this, (CheckboxWidgetAnnotationElement
|
505
|
+
return _possibleConstructorReturn(this, _getPrototypeOf(CheckboxWidgetAnnotationElement).call(this, parameters, parameters.renderInteractiveForms));
|
413
506
|
}
|
414
507
|
|
415
508
|
_createClass(CheckboxWidgetAnnotationElement, [{
|
416
|
-
key:
|
509
|
+
key: "render",
|
417
510
|
value: function render() {
|
418
511
|
this.container.className = 'buttonWidgetAnnotation checkBox';
|
419
512
|
var element = document.createElement('input');
|
420
513
|
element.disabled = this.data.readOnly;
|
421
514
|
element.type = 'checkbox';
|
515
|
+
|
422
516
|
if (this.data.fieldValue && this.data.fieldValue !== 'Off') {
|
423
517
|
element.setAttribute('checked', true);
|
424
518
|
}
|
519
|
+
|
425
520
|
this.container.appendChild(element);
|
426
521
|
return this.container;
|
427
522
|
}
|
@@ -430,26 +525,30 @@ var CheckboxWidgetAnnotationElement = function (_WidgetAnnotationElem2) {
|
|
430
525
|
return CheckboxWidgetAnnotationElement;
|
431
526
|
}(WidgetAnnotationElement);
|
432
527
|
|
433
|
-
var RadioButtonWidgetAnnotationElement =
|
528
|
+
var RadioButtonWidgetAnnotationElement =
|
529
|
+
/*#__PURE__*/
|
530
|
+
function (_WidgetAnnotationElem3) {
|
434
531
|
_inherits(RadioButtonWidgetAnnotationElement, _WidgetAnnotationElem3);
|
435
532
|
|
436
533
|
function RadioButtonWidgetAnnotationElement(parameters) {
|
437
534
|
_classCallCheck(this, RadioButtonWidgetAnnotationElement);
|
438
535
|
|
439
|
-
return _possibleConstructorReturn(this, (RadioButtonWidgetAnnotationElement
|
536
|
+
return _possibleConstructorReturn(this, _getPrototypeOf(RadioButtonWidgetAnnotationElement).call(this, parameters, parameters.renderInteractiveForms));
|
440
537
|
}
|
441
538
|
|
442
539
|
_createClass(RadioButtonWidgetAnnotationElement, [{
|
443
|
-
key:
|
540
|
+
key: "render",
|
444
541
|
value: function render() {
|
445
542
|
this.container.className = 'buttonWidgetAnnotation radioButton';
|
446
543
|
var element = document.createElement('input');
|
447
544
|
element.disabled = this.data.readOnly;
|
448
545
|
element.type = 'radio';
|
449
546
|
element.name = this.data.fieldName;
|
547
|
+
|
450
548
|
if (this.data.fieldValue === this.data.buttonValue) {
|
451
549
|
element.setAttribute('checked', true);
|
452
550
|
}
|
551
|
+
|
453
552
|
this.container.appendChild(element);
|
454
553
|
return this.container;
|
455
554
|
}
|
@@ -458,19 +557,22 @@ var RadioButtonWidgetAnnotationElement = function (_WidgetAnnotationElem3) {
|
|
458
557
|
return RadioButtonWidgetAnnotationElement;
|
459
558
|
}(WidgetAnnotationElement);
|
460
559
|
|
461
|
-
var PushButtonWidgetAnnotationElement =
|
560
|
+
var PushButtonWidgetAnnotationElement =
|
561
|
+
/*#__PURE__*/
|
562
|
+
function (_LinkAnnotationElemen) {
|
462
563
|
_inherits(PushButtonWidgetAnnotationElement, _LinkAnnotationElemen);
|
463
564
|
|
464
565
|
function PushButtonWidgetAnnotationElement() {
|
465
566
|
_classCallCheck(this, PushButtonWidgetAnnotationElement);
|
466
567
|
|
467
|
-
return _possibleConstructorReturn(this, (PushButtonWidgetAnnotationElement
|
568
|
+
return _possibleConstructorReturn(this, _getPrototypeOf(PushButtonWidgetAnnotationElement).apply(this, arguments));
|
468
569
|
}
|
469
570
|
|
470
571
|
_createClass(PushButtonWidgetAnnotationElement, [{
|
471
|
-
key:
|
572
|
+
key: "render",
|
472
573
|
value: function render() {
|
473
|
-
var container = _get(
|
574
|
+
var container = _get(_getPrototypeOf(PushButtonWidgetAnnotationElement.prototype), "render", this).call(this);
|
575
|
+
|
474
576
|
container.className = 'buttonWidgetAnnotation pushButton';
|
475
577
|
return container;
|
476
578
|
}
|
@@ -479,37 +581,45 @@ var PushButtonWidgetAnnotationElement = function (_LinkAnnotationElemen) {
|
|
479
581
|
return PushButtonWidgetAnnotationElement;
|
480
582
|
}(LinkAnnotationElement);
|
481
583
|
|
482
|
-
var ChoiceWidgetAnnotationElement =
|
584
|
+
var ChoiceWidgetAnnotationElement =
|
585
|
+
/*#__PURE__*/
|
586
|
+
function (_WidgetAnnotationElem4) {
|
483
587
|
_inherits(ChoiceWidgetAnnotationElement, _WidgetAnnotationElem4);
|
484
588
|
|
485
589
|
function ChoiceWidgetAnnotationElement(parameters) {
|
486
590
|
_classCallCheck(this, ChoiceWidgetAnnotationElement);
|
487
591
|
|
488
|
-
return _possibleConstructorReturn(this, (ChoiceWidgetAnnotationElement
|
592
|
+
return _possibleConstructorReturn(this, _getPrototypeOf(ChoiceWidgetAnnotationElement).call(this, parameters, parameters.renderInteractiveForms));
|
489
593
|
}
|
490
594
|
|
491
595
|
_createClass(ChoiceWidgetAnnotationElement, [{
|
492
|
-
key:
|
596
|
+
key: "render",
|
493
597
|
value: function render() {
|
494
598
|
this.container.className = 'choiceWidgetAnnotation';
|
495
599
|
var selectElement = document.createElement('select');
|
496
600
|
selectElement.disabled = this.data.readOnly;
|
601
|
+
|
497
602
|
if (!this.data.combo) {
|
498
603
|
selectElement.size = this.data.options.length;
|
604
|
+
|
499
605
|
if (this.data.multiSelect) {
|
500
606
|
selectElement.multiple = true;
|
501
607
|
}
|
502
608
|
}
|
609
|
+
|
503
610
|
for (var i = 0, ii = this.data.options.length; i < ii; i++) {
|
504
611
|
var option = this.data.options[i];
|
505
612
|
var optionElement = document.createElement('option');
|
506
613
|
optionElement.textContent = option.displayValue;
|
507
614
|
optionElement.value = option.exportValue;
|
615
|
+
|
508
616
|
if (this.data.fieldValue.includes(option.displayValue)) {
|
509
617
|
optionElement.setAttribute('selected', true);
|
510
618
|
}
|
619
|
+
|
511
620
|
selectElement.appendChild(optionElement);
|
512
621
|
}
|
622
|
+
|
513
623
|
this.container.appendChild(selectElement);
|
514
624
|
return this.container;
|
515
625
|
}
|
@@ -518,34 +628,41 @@ var ChoiceWidgetAnnotationElement = function (_WidgetAnnotationElem4) {
|
|
518
628
|
return ChoiceWidgetAnnotationElement;
|
519
629
|
}(WidgetAnnotationElement);
|
520
630
|
|
521
|
-
var PopupAnnotationElement =
|
631
|
+
var PopupAnnotationElement =
|
632
|
+
/*#__PURE__*/
|
633
|
+
function (_AnnotationElement4) {
|
522
634
|
_inherits(PopupAnnotationElement, _AnnotationElement4);
|
523
635
|
|
524
636
|
function PopupAnnotationElement(parameters) {
|
525
637
|
_classCallCheck(this, PopupAnnotationElement);
|
526
638
|
|
527
639
|
var isRenderable = !!(parameters.data.title || parameters.data.contents);
|
528
|
-
return _possibleConstructorReturn(this, (PopupAnnotationElement
|
640
|
+
return _possibleConstructorReturn(this, _getPrototypeOf(PopupAnnotationElement).call(this, parameters, isRenderable));
|
529
641
|
}
|
530
642
|
|
531
643
|
_createClass(PopupAnnotationElement, [{
|
532
|
-
key:
|
644
|
+
key: "render",
|
533
645
|
value: function render() {
|
534
|
-
var IGNORE_TYPES = ['Line', 'Square', 'Circle', 'PolyLine', 'Polygon'];
|
646
|
+
var IGNORE_TYPES = ['Line', 'Square', 'Circle', 'PolyLine', 'Polygon', 'Ink'];
|
535
647
|
this.container.className = 'popupAnnotation';
|
648
|
+
|
536
649
|
if (IGNORE_TYPES.includes(this.data.parentType)) {
|
537
650
|
return this.container;
|
538
651
|
}
|
652
|
+
|
539
653
|
var selector = '[data-annotation-id="' + this.data.parentId + '"]';
|
540
654
|
var parentElement = this.layer.querySelector(selector);
|
655
|
+
|
541
656
|
if (!parentElement) {
|
542
657
|
return this.container;
|
543
658
|
}
|
659
|
+
|
544
660
|
var popup = new PopupElement({
|
545
661
|
container: this.container,
|
546
662
|
trigger: parentElement,
|
547
663
|
color: this.data.color,
|
548
664
|
title: this.data.title,
|
665
|
+
modificationDate: this.data.modificationDate,
|
549
666
|
contents: this.data.contents
|
550
667
|
});
|
551
668
|
var parentLeft = parseFloat(parentElement.style.left);
|
@@ -560,7 +677,9 @@ var PopupAnnotationElement = function (_AnnotationElement4) {
|
|
560
677
|
return PopupAnnotationElement;
|
561
678
|
}(AnnotationElement);
|
562
679
|
|
563
|
-
var PopupElement =
|
680
|
+
var PopupElement =
|
681
|
+
/*#__PURE__*/
|
682
|
+
function () {
|
564
683
|
function PopupElement(parameters) {
|
565
684
|
_classCallCheck(this, PopupElement);
|
566
685
|
|
@@ -568,13 +687,14 @@ var PopupElement = function () {
|
|
568
687
|
this.trigger = parameters.trigger;
|
569
688
|
this.color = parameters.color;
|
570
689
|
this.title = parameters.title;
|
690
|
+
this.modificationDate = parameters.modificationDate;
|
571
691
|
this.contents = parameters.contents;
|
572
692
|
this.hideWrapper = parameters.hideWrapper || false;
|
573
693
|
this.pinned = false;
|
574
694
|
}
|
575
695
|
|
576
696
|
_createClass(PopupElement, [{
|
577
|
-
key:
|
697
|
+
key: "render",
|
578
698
|
value: function render() {
|
579
699
|
var BACKGROUND_ENLIGHT = 0.7;
|
580
700
|
var wrapper = document.createElement('div');
|
@@ -584,40 +704,60 @@ var PopupElement = function () {
|
|
584
704
|
var popup = document.createElement('div');
|
585
705
|
popup.className = 'popup';
|
586
706
|
var color = this.color;
|
707
|
+
|
587
708
|
if (color) {
|
588
709
|
var r = BACKGROUND_ENLIGHT * (255 - color[0]) + color[0];
|
589
710
|
var g = BACKGROUND_ENLIGHT * (255 - color[1]) + color[1];
|
590
711
|
var b = BACKGROUND_ENLIGHT * (255 - color[2]) + color[2];
|
591
712
|
popup.style.backgroundColor = _util.Util.makeCssRgb(r | 0, g | 0, b | 0);
|
592
713
|
}
|
593
|
-
|
714
|
+
|
594
715
|
var title = document.createElement('h1');
|
595
716
|
title.textContent = this.title;
|
717
|
+
popup.appendChild(title);
|
718
|
+
|
719
|
+
var dateObject = _display_utils.PDFDateString.toDateObject(this.modificationDate);
|
720
|
+
|
721
|
+
if (dateObject) {
|
722
|
+
var modificationDate = document.createElement('span');
|
723
|
+
modificationDate.textContent = '{{date}}, {{time}}';
|
724
|
+
modificationDate.dataset.l10nId = 'annotation_date_string';
|
725
|
+
modificationDate.dataset.l10nArgs = JSON.stringify({
|
726
|
+
date: dateObject.toLocaleDateString(),
|
727
|
+
time: dateObject.toLocaleTimeString()
|
728
|
+
});
|
729
|
+
popup.appendChild(modificationDate);
|
730
|
+
}
|
731
|
+
|
732
|
+
var contents = this._formatContents(this.contents);
|
733
|
+
|
734
|
+
popup.appendChild(contents);
|
596
735
|
this.trigger.addEventListener('click', this._toggle.bind(this));
|
597
736
|
this.trigger.addEventListener('mouseover', this._show.bind(this, false));
|
598
737
|
this.trigger.addEventListener('mouseout', this._hide.bind(this, false));
|
599
738
|
popup.addEventListener('click', this._hide.bind(this, true));
|
600
|
-
popup.appendChild(title);
|
601
|
-
popup.appendChild(contents);
|
602
739
|
wrapper.appendChild(popup);
|
603
740
|
return wrapper;
|
604
741
|
}
|
605
742
|
}, {
|
606
|
-
key:
|
743
|
+
key: "_formatContents",
|
607
744
|
value: function _formatContents(contents) {
|
608
745
|
var p = document.createElement('p');
|
609
746
|
var lines = contents.split(/(?:\r\n?|\n)/);
|
747
|
+
|
610
748
|
for (var i = 0, ii = lines.length; i < ii; ++i) {
|
611
749
|
var line = lines[i];
|
612
750
|
p.appendChild(document.createTextNode(line));
|
751
|
+
|
613
752
|
if (i < ii - 1) {
|
614
753
|
p.appendChild(document.createElement('br'));
|
615
754
|
}
|
616
755
|
}
|
756
|
+
|
617
757
|
return p;
|
618
758
|
}
|
619
759
|
}, {
|
620
|
-
key:
|
760
|
+
key: "_toggle",
|
621
761
|
value: function _toggle() {
|
622
762
|
if (this.pinned) {
|
623
763
|
this._hide(true);
|
@@ -626,26 +766,28 @@ var PopupElement = function () {
|
|
626
766
|
}
|
627
767
|
}
|
628
768
|
}, {
|
629
|
-
key:
|
769
|
+
key: "_show",
|
630
770
|
value: function _show() {
|
631
771
|
var pin = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
632
772
|
|
633
773
|
if (pin) {
|
634
774
|
this.pinned = true;
|
635
775
|
}
|
776
|
+
|
636
777
|
if (this.hideElement.hasAttribute('hidden')) {
|
637
778
|
this.hideElement.removeAttribute('hidden');
|
638
779
|
this.container.style.zIndex += 1;
|
639
780
|
}
|
640
781
|
}
|
641
782
|
}, {
|
642
|
-
key:
|
783
|
+
key: "_hide",
|
643
784
|
value: function _hide() {
|
644
785
|
var unpin = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
645
786
|
|
646
787
|
if (unpin) {
|
647
788
|
this.pinned = false;
|
648
789
|
}
|
790
|
+
|
649
791
|
if (!this.hideElement.hasAttribute('hidden') && !this.pinned) {
|
650
792
|
this.hideElement.setAttribute('hidden', true);
|
651
793
|
this.container.style.zIndex -= 1;
|
@@ -656,18 +798,48 @@ var PopupElement = function () {
|
|
656
798
|
return PopupElement;
|
657
799
|
}();
|
658
800
|
|
659
|
-
var
|
660
|
-
|
801
|
+
var FreeTextAnnotationElement =
|
802
|
+
/*#__PURE__*/
|
803
|
+
function (_AnnotationElement5) {
|
804
|
+
_inherits(FreeTextAnnotationElement, _AnnotationElement5);
|
805
|
+
|
806
|
+
function FreeTextAnnotationElement(parameters) {
|
807
|
+
_classCallCheck(this, FreeTextAnnotationElement);
|
808
|
+
|
809
|
+
var isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents);
|
810
|
+
return _possibleConstructorReturn(this, _getPrototypeOf(FreeTextAnnotationElement).call(this, parameters, isRenderable, true));
|
811
|
+
}
|
812
|
+
|
813
|
+
_createClass(FreeTextAnnotationElement, [{
|
814
|
+
key: "render",
|
815
|
+
value: function render() {
|
816
|
+
this.container.className = 'freeTextAnnotation';
|
817
|
+
|
818
|
+
if (!this.data.hasPopup) {
|
819
|
+
this._createPopup(this.container, null, this.data);
|
820
|
+
}
|
821
|
+
|
822
|
+
return this.container;
|
823
|
+
}
|
824
|
+
}]);
|
825
|
+
|
826
|
+
return FreeTextAnnotationElement;
|
827
|
+
}(AnnotationElement);
|
828
|
+
|
829
|
+
var LineAnnotationElement =
|
830
|
+
/*#__PURE__*/
|
831
|
+
function (_AnnotationElement6) {
|
832
|
+
_inherits(LineAnnotationElement, _AnnotationElement6);
|
661
833
|
|
662
834
|
function LineAnnotationElement(parameters) {
|
663
835
|
_classCallCheck(this, LineAnnotationElement);
|
664
836
|
|
665
837
|
var isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents);
|
666
|
-
return _possibleConstructorReturn(this, (LineAnnotationElement
|
838
|
+
return _possibleConstructorReturn(this, _getPrototypeOf(LineAnnotationElement).call(this, parameters, isRenderable, true));
|
667
839
|
}
|
668
840
|
|
669
841
|
_createClass(LineAnnotationElement, [{
|
670
|
-
key:
|
842
|
+
key: "render",
|
671
843
|
value: function render() {
|
672
844
|
this.container.className = 'lineAnnotation';
|
673
845
|
var data = this.data;
|
@@ -683,7 +855,9 @@ var LineAnnotationElement = function (_AnnotationElement5) {
|
|
683
855
|
line.setAttribute('stroke', 'transparent');
|
684
856
|
svg.appendChild(line);
|
685
857
|
this.container.append(svg);
|
858
|
+
|
686
859
|
this._createPopup(this.container, line, data);
|
860
|
+
|
687
861
|
return this.container;
|
688
862
|
}
|
689
863
|
}]);
|
@@ -691,18 +865,20 @@ var LineAnnotationElement = function (_AnnotationElement5) {
|
|
691
865
|
return LineAnnotationElement;
|
692
866
|
}(AnnotationElement);
|
693
867
|
|
694
|
-
var SquareAnnotationElement =
|
695
|
-
|
868
|
+
var SquareAnnotationElement =
|
869
|
+
/*#__PURE__*/
|
870
|
+
function (_AnnotationElement7) {
|
871
|
+
_inherits(SquareAnnotationElement, _AnnotationElement7);
|
696
872
|
|
697
873
|
function SquareAnnotationElement(parameters) {
|
698
874
|
_classCallCheck(this, SquareAnnotationElement);
|
699
875
|
|
700
876
|
var isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents);
|
701
|
-
return _possibleConstructorReturn(this, (SquareAnnotationElement
|
877
|
+
return _possibleConstructorReturn(this, _getPrototypeOf(SquareAnnotationElement).call(this, parameters, isRenderable, true));
|
702
878
|
}
|
703
879
|
|
704
880
|
_createClass(SquareAnnotationElement, [{
|
705
|
-
key:
|
881
|
+
key: "render",
|
706
882
|
value: function render() {
|
707
883
|
this.container.className = 'squareAnnotation';
|
708
884
|
var data = this.data;
|
@@ -720,7 +896,9 @@ var SquareAnnotationElement = function (_AnnotationElement6) {
|
|
720
896
|
square.setAttribute('fill', 'none');
|
721
897
|
svg.appendChild(square);
|
722
898
|
this.container.append(svg);
|
899
|
+
|
723
900
|
this._createPopup(this.container, square, data);
|
901
|
+
|
724
902
|
return this.container;
|
725
903
|
}
|
726
904
|
}]);
|
@@ -728,18 +906,20 @@ var SquareAnnotationElement = function (_AnnotationElement6) {
|
|
728
906
|
return SquareAnnotationElement;
|
729
907
|
}(AnnotationElement);
|
730
908
|
|
731
|
-
var CircleAnnotationElement =
|
732
|
-
|
909
|
+
var CircleAnnotationElement =
|
910
|
+
/*#__PURE__*/
|
911
|
+
function (_AnnotationElement8) {
|
912
|
+
_inherits(CircleAnnotationElement, _AnnotationElement8);
|
733
913
|
|
734
914
|
function CircleAnnotationElement(parameters) {
|
735
915
|
_classCallCheck(this, CircleAnnotationElement);
|
736
916
|
|
737
917
|
var isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents);
|
738
|
-
return _possibleConstructorReturn(this, (CircleAnnotationElement
|
918
|
+
return _possibleConstructorReturn(this, _getPrototypeOf(CircleAnnotationElement).call(this, parameters, isRenderable, true));
|
739
919
|
}
|
740
920
|
|
741
921
|
_createClass(CircleAnnotationElement, [{
|
742
|
-
key:
|
922
|
+
key: "render",
|
743
923
|
value: function render() {
|
744
924
|
this.container.className = 'circleAnnotation';
|
745
925
|
var data = this.data;
|
@@ -757,7 +937,9 @@ var CircleAnnotationElement = function (_AnnotationElement7) {
|
|
757
937
|
circle.setAttribute('fill', 'none');
|
758
938
|
svg.appendChild(circle);
|
759
939
|
this.container.append(svg);
|
940
|
+
|
760
941
|
this._createPopup(this.container, circle, data);
|
942
|
+
|
761
943
|
return this.container;
|
762
944
|
}
|
763
945
|
}]);
|
@@ -765,23 +947,25 @@ var CircleAnnotationElement = function (_AnnotationElement7) {
|
|
765
947
|
return CircleAnnotationElement;
|
766
948
|
}(AnnotationElement);
|
767
949
|
|
768
|
-
var PolylineAnnotationElement =
|
769
|
-
|
950
|
+
var PolylineAnnotationElement =
|
951
|
+
/*#__PURE__*/
|
952
|
+
function (_AnnotationElement9) {
|
953
|
+
_inherits(PolylineAnnotationElement, _AnnotationElement9);
|
770
954
|
|
771
955
|
function PolylineAnnotationElement(parameters) {
|
956
|
+
var _this3;
|
957
|
+
|
772
958
|
_classCallCheck(this, PolylineAnnotationElement);
|
773
959
|
|
774
960
|
var isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents);
|
775
|
-
|
776
|
-
|
777
|
-
|
778
|
-
|
779
|
-
_this15.svgElementName = 'svg:polyline';
|
780
|
-
return _this15;
|
961
|
+
_this3 = _possibleConstructorReturn(this, _getPrototypeOf(PolylineAnnotationElement).call(this, parameters, isRenderable, true));
|
962
|
+
_this3.containerClassName = 'polylineAnnotation';
|
963
|
+
_this3.svgElementName = 'svg:polyline';
|
964
|
+
return _this3;
|
781
965
|
}
|
782
966
|
|
783
967
|
_createClass(PolylineAnnotationElement, [{
|
784
|
-
key:
|
968
|
+
key: "render",
|
785
969
|
value: function render() {
|
786
970
|
this.container.className = this.containerClassName;
|
787
971
|
var data = this.data;
|
@@ -790,11 +974,13 @@ var PolylineAnnotationElement = function (_AnnotationElement8) {
|
|
790
974
|
var svg = this.svgFactory.create(width, height);
|
791
975
|
var vertices = data.vertices;
|
792
976
|
var points = [];
|
977
|
+
|
793
978
|
for (var i = 0, ii = vertices.length; i < ii; i++) {
|
794
979
|
var x = vertices[i].x - data.rect[0];
|
795
980
|
var y = data.rect[3] - vertices[i].y;
|
796
981
|
points.push(x + ',' + y);
|
797
982
|
}
|
983
|
+
|
798
984
|
points = points.join(' ');
|
799
985
|
var borderWidth = data.borderStyle.width;
|
800
986
|
var polyline = this.svgFactory.createElement(this.svgElementName);
|
@@ -804,7 +990,9 @@ var PolylineAnnotationElement = function (_AnnotationElement8) {
|
|
804
990
|
polyline.setAttribute('fill', 'none');
|
805
991
|
svg.appendChild(polyline);
|
806
992
|
this.container.append(svg);
|
993
|
+
|
807
994
|
this._createPopup(this.container, polyline, data);
|
995
|
+
|
808
996
|
return this.container;
|
809
997
|
}
|
810
998
|
}]);
|
@@ -812,39 +1000,132 @@ var PolylineAnnotationElement = function (_AnnotationElement8) {
|
|
812
1000
|
return PolylineAnnotationElement;
|
813
1001
|
}(AnnotationElement);
|
814
1002
|
|
815
|
-
var PolygonAnnotationElement =
|
1003
|
+
var PolygonAnnotationElement =
|
1004
|
+
/*#__PURE__*/
|
1005
|
+
function (_PolylineAnnotationEl) {
|
816
1006
|
_inherits(PolygonAnnotationElement, _PolylineAnnotationEl);
|
817
1007
|
|
818
1008
|
function PolygonAnnotationElement(parameters) {
|
819
|
-
|
1009
|
+
var _this4;
|
820
1010
|
|
821
|
-
|
1011
|
+
_classCallCheck(this, PolygonAnnotationElement);
|
822
1012
|
|
823
|
-
|
824
|
-
|
825
|
-
|
1013
|
+
_this4 = _possibleConstructorReturn(this, _getPrototypeOf(PolygonAnnotationElement).call(this, parameters));
|
1014
|
+
_this4.containerClassName = 'polygonAnnotation';
|
1015
|
+
_this4.svgElementName = 'svg:polygon';
|
1016
|
+
return _this4;
|
826
1017
|
}
|
827
1018
|
|
828
1019
|
return PolygonAnnotationElement;
|
829
1020
|
}(PolylineAnnotationElement);
|
830
1021
|
|
831
|
-
var
|
832
|
-
|
1022
|
+
var CaretAnnotationElement =
|
1023
|
+
/*#__PURE__*/
|
1024
|
+
function (_AnnotationElement10) {
|
1025
|
+
_inherits(CaretAnnotationElement, _AnnotationElement10);
|
1026
|
+
|
1027
|
+
function CaretAnnotationElement(parameters) {
|
1028
|
+
_classCallCheck(this, CaretAnnotationElement);
|
1029
|
+
|
1030
|
+
var isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents);
|
1031
|
+
return _possibleConstructorReturn(this, _getPrototypeOf(CaretAnnotationElement).call(this, parameters, isRenderable, true));
|
1032
|
+
}
|
1033
|
+
|
1034
|
+
_createClass(CaretAnnotationElement, [{
|
1035
|
+
key: "render",
|
1036
|
+
value: function render() {
|
1037
|
+
this.container.className = 'caretAnnotation';
|
1038
|
+
|
1039
|
+
if (!this.data.hasPopup) {
|
1040
|
+
this._createPopup(this.container, null, this.data);
|
1041
|
+
}
|
1042
|
+
|
1043
|
+
return this.container;
|
1044
|
+
}
|
1045
|
+
}]);
|
1046
|
+
|
1047
|
+
return CaretAnnotationElement;
|
1048
|
+
}(AnnotationElement);
|
1049
|
+
|
1050
|
+
var InkAnnotationElement =
|
1051
|
+
/*#__PURE__*/
|
1052
|
+
function (_AnnotationElement11) {
|
1053
|
+
_inherits(InkAnnotationElement, _AnnotationElement11);
|
1054
|
+
|
1055
|
+
function InkAnnotationElement(parameters) {
|
1056
|
+
var _this5;
|
1057
|
+
|
1058
|
+
_classCallCheck(this, InkAnnotationElement);
|
1059
|
+
|
1060
|
+
var isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents);
|
1061
|
+
_this5 = _possibleConstructorReturn(this, _getPrototypeOf(InkAnnotationElement).call(this, parameters, isRenderable, true));
|
1062
|
+
_this5.containerClassName = 'inkAnnotation';
|
1063
|
+
_this5.svgElementName = 'svg:polyline';
|
1064
|
+
return _this5;
|
1065
|
+
}
|
1066
|
+
|
1067
|
+
_createClass(InkAnnotationElement, [{
|
1068
|
+
key: "render",
|
1069
|
+
value: function render() {
|
1070
|
+
this.container.className = this.containerClassName;
|
1071
|
+
var data = this.data;
|
1072
|
+
var width = data.rect[2] - data.rect[0];
|
1073
|
+
var height = data.rect[3] - data.rect[1];
|
1074
|
+
var svg = this.svgFactory.create(width, height);
|
1075
|
+
var inkLists = data.inkLists;
|
1076
|
+
|
1077
|
+
for (var i = 0, ii = inkLists.length; i < ii; i++) {
|
1078
|
+
var inkList = inkLists[i];
|
1079
|
+
var points = [];
|
1080
|
+
|
1081
|
+
for (var j = 0, jj = inkList.length; j < jj; j++) {
|
1082
|
+
var x = inkList[j].x - data.rect[0];
|
1083
|
+
var y = data.rect[3] - inkList[j].y;
|
1084
|
+
points.push(x + ',' + y);
|
1085
|
+
}
|
1086
|
+
|
1087
|
+
points = points.join(' ');
|
1088
|
+
var borderWidth = data.borderStyle.width;
|
1089
|
+
var polyline = this.svgFactory.createElement(this.svgElementName);
|
1090
|
+
polyline.setAttribute('points', points);
|
1091
|
+
polyline.setAttribute('stroke-width', borderWidth);
|
1092
|
+
polyline.setAttribute('stroke', 'transparent');
|
1093
|
+
polyline.setAttribute('fill', 'none');
|
1094
|
+
|
1095
|
+
this._createPopup(this.container, polyline, data);
|
1096
|
+
|
1097
|
+
svg.appendChild(polyline);
|
1098
|
+
}
|
1099
|
+
|
1100
|
+
this.container.append(svg);
|
1101
|
+
return this.container;
|
1102
|
+
}
|
1103
|
+
}]);
|
1104
|
+
|
1105
|
+
return InkAnnotationElement;
|
1106
|
+
}(AnnotationElement);
|
1107
|
+
|
1108
|
+
var HighlightAnnotationElement =
|
1109
|
+
/*#__PURE__*/
|
1110
|
+
function (_AnnotationElement12) {
|
1111
|
+
_inherits(HighlightAnnotationElement, _AnnotationElement12);
|
833
1112
|
|
834
1113
|
function HighlightAnnotationElement(parameters) {
|
835
1114
|
_classCallCheck(this, HighlightAnnotationElement);
|
836
1115
|
|
837
1116
|
var isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents);
|
838
|
-
return _possibleConstructorReturn(this, (HighlightAnnotationElement
|
1117
|
+
return _possibleConstructorReturn(this, _getPrototypeOf(HighlightAnnotationElement).call(this, parameters, isRenderable, true));
|
839
1118
|
}
|
840
1119
|
|
841
1120
|
_createClass(HighlightAnnotationElement, [{
|
842
|
-
key:
|
1121
|
+
key: "render",
|
843
1122
|
value: function render() {
|
844
1123
|
this.container.className = 'highlightAnnotation';
|
1124
|
+
|
845
1125
|
if (!this.data.hasPopup) {
|
846
1126
|
this._createPopup(this.container, null, this.data);
|
847
1127
|
}
|
1128
|
+
|
848
1129
|
return this.container;
|
849
1130
|
}
|
850
1131
|
}]);
|
@@ -852,23 +1133,27 @@ var HighlightAnnotationElement = function (_AnnotationElement9) {
|
|
852
1133
|
return HighlightAnnotationElement;
|
853
1134
|
}(AnnotationElement);
|
854
1135
|
|
855
|
-
var UnderlineAnnotationElement =
|
856
|
-
|
1136
|
+
var UnderlineAnnotationElement =
|
1137
|
+
/*#__PURE__*/
|
1138
|
+
function (_AnnotationElement13) {
|
1139
|
+
_inherits(UnderlineAnnotationElement, _AnnotationElement13);
|
857
1140
|
|
858
1141
|
function UnderlineAnnotationElement(parameters) {
|
859
1142
|
_classCallCheck(this, UnderlineAnnotationElement);
|
860
1143
|
|
861
1144
|
var isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents);
|
862
|
-
return _possibleConstructorReturn(this, (UnderlineAnnotationElement
|
1145
|
+
return _possibleConstructorReturn(this, _getPrototypeOf(UnderlineAnnotationElement).call(this, parameters, isRenderable, true));
|
863
1146
|
}
|
864
1147
|
|
865
1148
|
_createClass(UnderlineAnnotationElement, [{
|
866
|
-
key:
|
1149
|
+
key: "render",
|
867
1150
|
value: function render() {
|
868
1151
|
this.container.className = 'underlineAnnotation';
|
1152
|
+
|
869
1153
|
if (!this.data.hasPopup) {
|
870
1154
|
this._createPopup(this.container, null, this.data);
|
871
1155
|
}
|
1156
|
+
|
872
1157
|
return this.container;
|
873
1158
|
}
|
874
1159
|
}]);
|
@@ -876,23 +1161,27 @@ var UnderlineAnnotationElement = function (_AnnotationElement10) {
|
|
876
1161
|
return UnderlineAnnotationElement;
|
877
1162
|
}(AnnotationElement);
|
878
1163
|
|
879
|
-
var SquigglyAnnotationElement =
|
880
|
-
|
1164
|
+
var SquigglyAnnotationElement =
|
1165
|
+
/*#__PURE__*/
|
1166
|
+
function (_AnnotationElement14) {
|
1167
|
+
_inherits(SquigglyAnnotationElement, _AnnotationElement14);
|
881
1168
|
|
882
1169
|
function SquigglyAnnotationElement(parameters) {
|
883
1170
|
_classCallCheck(this, SquigglyAnnotationElement);
|
884
1171
|
|
885
1172
|
var isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents);
|
886
|
-
return _possibleConstructorReturn(this, (SquigglyAnnotationElement
|
1173
|
+
return _possibleConstructorReturn(this, _getPrototypeOf(SquigglyAnnotationElement).call(this, parameters, isRenderable, true));
|
887
1174
|
}
|
888
1175
|
|
889
1176
|
_createClass(SquigglyAnnotationElement, [{
|
890
|
-
key:
|
1177
|
+
key: "render",
|
891
1178
|
value: function render() {
|
892
1179
|
this.container.className = 'squigglyAnnotation';
|
1180
|
+
|
893
1181
|
if (!this.data.hasPopup) {
|
894
1182
|
this._createPopup(this.container, null, this.data);
|
895
1183
|
}
|
1184
|
+
|
896
1185
|
return this.container;
|
897
1186
|
}
|
898
1187
|
}]);
|
@@ -900,23 +1189,27 @@ var SquigglyAnnotationElement = function (_AnnotationElement11) {
|
|
900
1189
|
return SquigglyAnnotationElement;
|
901
1190
|
}(AnnotationElement);
|
902
1191
|
|
903
|
-
var StrikeOutAnnotationElement =
|
904
|
-
|
1192
|
+
var StrikeOutAnnotationElement =
|
1193
|
+
/*#__PURE__*/
|
1194
|
+
function (_AnnotationElement15) {
|
1195
|
+
_inherits(StrikeOutAnnotationElement, _AnnotationElement15);
|
905
1196
|
|
906
1197
|
function StrikeOutAnnotationElement(parameters) {
|
907
1198
|
_classCallCheck(this, StrikeOutAnnotationElement);
|
908
1199
|
|
909
1200
|
var isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents);
|
910
|
-
return _possibleConstructorReturn(this, (StrikeOutAnnotationElement
|
1201
|
+
return _possibleConstructorReturn(this, _getPrototypeOf(StrikeOutAnnotationElement).call(this, parameters, isRenderable, true));
|
911
1202
|
}
|
912
1203
|
|
913
1204
|
_createClass(StrikeOutAnnotationElement, [{
|
914
|
-
key:
|
1205
|
+
key: "render",
|
915
1206
|
value: function render() {
|
916
1207
|
this.container.className = 'strikeoutAnnotation';
|
1208
|
+
|
917
1209
|
if (!this.data.hasPopup) {
|
918
1210
|
this._createPopup(this.container, null, this.data);
|
919
1211
|
}
|
1212
|
+
|
920
1213
|
return this.container;
|
921
1214
|
}
|
922
1215
|
}]);
|
@@ -924,23 +1217,27 @@ var StrikeOutAnnotationElement = function (_AnnotationElement12) {
|
|
924
1217
|
return StrikeOutAnnotationElement;
|
925
1218
|
}(AnnotationElement);
|
926
1219
|
|
927
|
-
var StampAnnotationElement =
|
928
|
-
|
1220
|
+
var StampAnnotationElement =
|
1221
|
+
/*#__PURE__*/
|
1222
|
+
function (_AnnotationElement16) {
|
1223
|
+
_inherits(StampAnnotationElement, _AnnotationElement16);
|
929
1224
|
|
930
1225
|
function StampAnnotationElement(parameters) {
|
931
1226
|
_classCallCheck(this, StampAnnotationElement);
|
932
1227
|
|
933
1228
|
var isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents);
|
934
|
-
return _possibleConstructorReturn(this, (StampAnnotationElement
|
1229
|
+
return _possibleConstructorReturn(this, _getPrototypeOf(StampAnnotationElement).call(this, parameters, isRenderable, true));
|
935
1230
|
}
|
936
1231
|
|
937
1232
|
_createClass(StampAnnotationElement, [{
|
938
|
-
key:
|
1233
|
+
key: "render",
|
939
1234
|
value: function render() {
|
940
1235
|
this.container.className = 'stampAnnotation';
|
1236
|
+
|
941
1237
|
if (!this.data.hasPopup) {
|
942
1238
|
this._createPopup(this.container, null, this.data);
|
943
1239
|
}
|
1240
|
+
|
944
1241
|
return this.container;
|
945
1242
|
}
|
946
1243
|
}]);
|
@@ -948,46 +1245,59 @@ var StampAnnotationElement = function (_AnnotationElement13) {
|
|
948
1245
|
return StampAnnotationElement;
|
949
1246
|
}(AnnotationElement);
|
950
1247
|
|
951
|
-
var FileAttachmentAnnotationElement =
|
952
|
-
|
1248
|
+
var FileAttachmentAnnotationElement =
|
1249
|
+
/*#__PURE__*/
|
1250
|
+
function (_AnnotationElement17) {
|
1251
|
+
_inherits(FileAttachmentAnnotationElement, _AnnotationElement17);
|
953
1252
|
|
954
1253
|
function FileAttachmentAnnotationElement(parameters) {
|
1254
|
+
var _this6;
|
1255
|
+
|
955
1256
|
_classCallCheck(this, FileAttachmentAnnotationElement);
|
956
1257
|
|
957
|
-
|
958
|
-
|
959
|
-
|
960
|
-
|
961
|
-
|
962
|
-
|
963
|
-
|
964
|
-
|
965
|
-
|
966
|
-
|
967
|
-
|
1258
|
+
_this6 = _possibleConstructorReturn(this, _getPrototypeOf(FileAttachmentAnnotationElement).call(this, parameters, true));
|
1259
|
+
var _this6$data$file = _this6.data.file,
|
1260
|
+
filename = _this6$data$file.filename,
|
1261
|
+
content = _this6$data$file.content;
|
1262
|
+
_this6.filename = (0, _display_utils.getFilenameFromUrl)(filename);
|
1263
|
+
_this6.content = content;
|
1264
|
+
|
1265
|
+
if (_this6.linkService.eventBus) {
|
1266
|
+
_this6.linkService.eventBus.dispatch('fileattachmentannotation', {
|
1267
|
+
source: _assertThisInitialized(_this6),
|
1268
|
+
id: (0, _util.stringToPDFString)(filename),
|
1269
|
+
filename: filename,
|
1270
|
+
content: content
|
1271
|
+
});
|
1272
|
+
}
|
1273
|
+
|
1274
|
+
return _this6;
|
968
1275
|
}
|
969
1276
|
|
970
1277
|
_createClass(FileAttachmentAnnotationElement, [{
|
971
|
-
key:
|
1278
|
+
key: "render",
|
972
1279
|
value: function render() {
|
973
1280
|
this.container.className = 'fileAttachmentAnnotation';
|
974
1281
|
var trigger = document.createElement('div');
|
975
1282
|
trigger.style.height = this.container.style.height;
|
976
1283
|
trigger.style.width = this.container.style.width;
|
977
1284
|
trigger.addEventListener('dblclick', this._download.bind(this));
|
1285
|
+
|
978
1286
|
if (!this.data.hasPopup && (this.data.title || this.data.contents)) {
|
979
1287
|
this._createPopup(this.container, trigger, this.data);
|
980
1288
|
}
|
1289
|
+
|
981
1290
|
this.container.appendChild(trigger);
|
982
1291
|
return this.container;
|
983
1292
|
}
|
984
1293
|
}, {
|
985
|
-
key:
|
1294
|
+
key: "_download",
|
986
1295
|
value: function _download() {
|
987
1296
|
if (!this.downloadManager) {
|
988
1297
|
(0, _util.warn)('Download cannot be started due to unavailable download manager');
|
989
1298
|
return;
|
990
1299
|
}
|
1300
|
+
|
991
1301
|
this.downloadManager.downloadData(this.content, this.filename, '');
|
992
1302
|
}
|
993
1303
|
}]);
|
@@ -995,19 +1305,23 @@ var FileAttachmentAnnotationElement = function (_AnnotationElement14) {
|
|
995
1305
|
return FileAttachmentAnnotationElement;
|
996
1306
|
}(AnnotationElement);
|
997
1307
|
|
998
|
-
var AnnotationLayer =
|
1308
|
+
var AnnotationLayer =
|
1309
|
+
/*#__PURE__*/
|
1310
|
+
function () {
|
999
1311
|
function AnnotationLayer() {
|
1000
1312
|
_classCallCheck(this, AnnotationLayer);
|
1001
1313
|
}
|
1002
1314
|
|
1003
1315
|
_createClass(AnnotationLayer, null, [{
|
1004
|
-
key:
|
1316
|
+
key: "render",
|
1005
1317
|
value: function render(parameters) {
|
1006
1318
|
for (var i = 0, ii = parameters.annotations.length; i < ii; i++) {
|
1007
1319
|
var data = parameters.annotations[i];
|
1320
|
+
|
1008
1321
|
if (!data) {
|
1009
1322
|
continue;
|
1010
1323
|
}
|
1324
|
+
|
1011
1325
|
var element = AnnotationElementFactory.create({
|
1012
1326
|
data: data,
|
1013
1327
|
layer: parameters.div,
|
@@ -1017,23 +1331,26 @@ var AnnotationLayer = function () {
|
|
1017
1331
|
downloadManager: parameters.downloadManager,
|
1018
1332
|
imageResourcesPath: parameters.imageResourcesPath || '',
|
1019
1333
|
renderInteractiveForms: parameters.renderInteractiveForms || false,
|
1020
|
-
svgFactory: new
|
1334
|
+
svgFactory: new _display_utils.DOMSVGFactory()
|
1021
1335
|
});
|
1336
|
+
|
1022
1337
|
if (element.isRenderable) {
|
1023
1338
|
parameters.div.appendChild(element.render());
|
1024
1339
|
}
|
1025
1340
|
}
|
1026
1341
|
}
|
1027
1342
|
}, {
|
1028
|
-
key:
|
1343
|
+
key: "update",
|
1029
1344
|
value: function update(parameters) {
|
1030
1345
|
for (var i = 0, ii = parameters.annotations.length; i < ii; i++) {
|
1031
1346
|
var data = parameters.annotations[i];
|
1032
1347
|
var element = parameters.div.querySelector('[data-annotation-id="' + data.id + '"]');
|
1348
|
+
|
1033
1349
|
if (element) {
|
1034
1350
|
element.style.transform = 'matrix(' + parameters.viewport.transform.join(',') + ')';
|
1035
1351
|
}
|
1036
1352
|
}
|
1353
|
+
|
1037
1354
|
parameters.div.removeAttribute('hidden');
|
1038
1355
|
}
|
1039
1356
|
}]);
|