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