@progress/kendo-pdfviewer-common 0.3.0-dev.202409251459 → 0.3.0-dev.202410100645

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.
Files changed (149) hide show
  1. package/dist/es/annotations/annotation-editor-layer-builder.js +139 -0
  2. package/dist/es/annotations/annotation-editor-layer.js +780 -0
  3. package/dist/es/annotations/annotation-editor-ui-manager.js +1690 -0
  4. package/dist/es/annotations/annotation-layer-builder.js +217 -0
  5. package/dist/es/annotations/annotation-layer.js +2793 -0
  6. package/dist/es/annotations/draw-layer-builder.js +65 -0
  7. package/dist/es/annotations/draw-layer.js +220 -0
  8. package/dist/es/annotations/editors/annotation-editor.js +1519 -0
  9. package/dist/es/annotations/editors/free-text-editor.js +783 -0
  10. package/dist/es/annotations/editors/highlight-editor.js +717 -0
  11. package/dist/es/annotations/editors/outliner.js +747 -0
  12. package/dist/es/annotations/helpers/annotation-storage.js +294 -0
  13. package/dist/es/annotations/helpers/color-manager.js +72 -0
  14. package/dist/es/annotations/helpers/command-manager.js +133 -0
  15. package/dist/es/annotations/helpers/id-manager.js +34 -0
  16. package/dist/es/annotations/helpers/image-manager.js +176 -0
  17. package/dist/es/annotations/helpers/text-accessibility-manager.js +212 -0
  18. package/dist/es/annotations/helpers/tools.js +19 -0
  19. package/dist/es/annotations/shared/display_utils.js +1024 -0
  20. package/dist/es/annotations/shared/event_utils.js +213 -0
  21. package/dist/es/annotations/shared/murmurhash3.js +126 -0
  22. package/dist/es/annotations/shared/scripting_utils.js +90 -0
  23. package/dist/es/annotations/shared/ui_utils.js +823 -0
  24. package/dist/es/annotations/shared/utils.js +909 -0
  25. package/dist/es/common/component.js +33 -0
  26. package/dist/es/common/core.js +91 -0
  27. package/dist/es/common/dom.js +11 -0
  28. package/dist/es/common/main.js +4 -0
  29. package/dist/es/common/math.js +1 -0
  30. package/dist/es/enums/PdfViewerInteractionMode.js +6 -0
  31. package/dist/es/links/link-service.js +505 -0
  32. package/dist/es/main.js +2 -0
  33. package/dist/es/scroller.js +29 -30
  34. package/dist/es/text/text-layer-builder.js +288 -0
  35. package/dist/es/utils.js +5 -5
  36. package/dist/es/widget/page.js +762 -0
  37. package/dist/es/widget/pdfviewer.js +1659 -0
  38. package/dist/es2015/annotations/annotation-editor-layer-builder.js +139 -0
  39. package/dist/es2015/annotations/annotation-editor-layer.js +780 -0
  40. package/dist/es2015/annotations/annotation-editor-ui-manager.js +1690 -0
  41. package/dist/es2015/annotations/annotation-layer-builder.js +217 -0
  42. package/dist/es2015/annotations/annotation-layer.js +2793 -0
  43. package/dist/es2015/annotations/draw-layer-builder.js +65 -0
  44. package/dist/es2015/annotations/draw-layer.js +220 -0
  45. package/dist/es2015/annotations/editors/annotation-editor.js +1519 -0
  46. package/dist/es2015/annotations/editors/free-text-editor.js +783 -0
  47. package/dist/es2015/annotations/editors/highlight-editor.js +717 -0
  48. package/dist/es2015/annotations/editors/outliner.js +747 -0
  49. package/dist/es2015/annotations/helpers/annotation-storage.js +294 -0
  50. package/dist/es2015/annotations/helpers/color-manager.js +72 -0
  51. package/dist/es2015/annotations/helpers/command-manager.js +133 -0
  52. package/dist/es2015/annotations/helpers/id-manager.js +34 -0
  53. package/dist/es2015/annotations/helpers/image-manager.js +176 -0
  54. package/dist/es2015/annotations/helpers/text-accessibility-manager.js +212 -0
  55. package/dist/es2015/annotations/helpers/tools.js +19 -0
  56. package/dist/es2015/annotations/shared/display_utils.js +1024 -0
  57. package/dist/es2015/annotations/shared/event_utils.js +213 -0
  58. package/dist/es2015/annotations/shared/murmurhash3.js +126 -0
  59. package/dist/es2015/annotations/shared/scripting_utils.js +90 -0
  60. package/dist/es2015/annotations/shared/ui_utils.js +823 -0
  61. package/dist/es2015/annotations/shared/utils.js +909 -0
  62. package/dist/es2015/common/component.js +33 -0
  63. package/dist/es2015/common/core.js +91 -0
  64. package/dist/es2015/common/dom.js +11 -0
  65. package/dist/es2015/common/main.js +4 -0
  66. package/dist/es2015/common/math.js +1 -0
  67. package/dist/es2015/enums/PdfViewerInteractionMode.js +6 -0
  68. package/dist/es2015/links/link-service.js +505 -0
  69. package/dist/es2015/main.js +2 -0
  70. package/dist/es2015/scroller.js +29 -30
  71. package/dist/es2015/text/text-layer-builder.js +288 -0
  72. package/dist/es2015/utils.js +5 -5
  73. package/dist/es2015/widget/page.js +762 -0
  74. package/dist/es2015/widget/pdfviewer.js +1659 -0
  75. package/dist/npm/annotations/annotation-editor-layer-builder.d.ts +39 -0
  76. package/dist/npm/annotations/annotation-editor-layer-builder.js +142 -0
  77. package/dist/npm/annotations/annotation-editor-layer.d.ts +196 -0
  78. package/dist/npm/annotations/annotation-editor-layer.js +783 -0
  79. package/dist/npm/annotations/annotation-editor-ui-manager.d.ts +281 -0
  80. package/dist/npm/annotations/annotation-editor-ui-manager.js +1694 -0
  81. package/dist/npm/annotations/annotation-layer-builder.d.ts +58 -0
  82. package/dist/npm/annotations/annotation-layer-builder.js +220 -0
  83. package/dist/npm/annotations/annotation-layer.d.ts +134 -0
  84. package/dist/npm/annotations/annotation-layer.js +2794 -0
  85. package/dist/npm/annotations/draw-layer-builder.d.ts +21 -0
  86. package/dist/npm/annotations/draw-layer-builder.js +68 -0
  87. package/dist/npm/annotations/draw-layer.d.ts +33 -0
  88. package/dist/npm/annotations/draw-layer.js +223 -0
  89. package/dist/npm/annotations/editors/annotation-editor.d.ts +349 -0
  90. package/dist/npm/annotations/editors/annotation-editor.js +1523 -0
  91. package/dist/npm/annotations/editors/free-text-editor.d.ts +108 -0
  92. package/dist/npm/annotations/editors/free-text-editor.js +786 -0
  93. package/dist/npm/annotations/editors/highlight-editor.d.ts +114 -0
  94. package/dist/npm/annotations/editors/highlight-editor.js +717 -0
  95. package/dist/npm/annotations/editors/outliner.d.ts +51 -0
  96. package/dist/npm/annotations/editors/outliner.js +750 -0
  97. package/dist/npm/annotations/helpers/annotation-storage.d.ts +98 -0
  98. package/dist/npm/annotations/helpers/annotation-storage.js +299 -0
  99. package/dist/npm/annotations/helpers/color-manager.d.ts +6 -0
  100. package/dist/npm/annotations/helpers/color-manager.js +76 -0
  101. package/dist/npm/annotations/helpers/command-manager.d.ts +42 -0
  102. package/dist/npm/annotations/helpers/command-manager.js +137 -0
  103. package/dist/npm/annotations/helpers/id-manager.d.ts +6 -0
  104. package/dist/npm/annotations/helpers/id-manager.js +38 -0
  105. package/dist/npm/annotations/helpers/image-manager.d.ts +18 -0
  106. package/dist/npm/annotations/helpers/image-manager.js +180 -0
  107. package/dist/npm/annotations/helpers/text-accessibility-manager.d.ts +36 -0
  108. package/dist/npm/annotations/helpers/text-accessibility-manager.js +215 -0
  109. package/dist/npm/annotations/helpers/tools.d.ts +1 -0
  110. package/dist/npm/annotations/helpers/tools.js +23 -0
  111. package/dist/npm/annotations/shared/display_utils.d.ts +6 -0
  112. package/dist/npm/annotations/shared/display_utils.js +1030 -0
  113. package/dist/npm/annotations/shared/event_utils.d.ts +33 -0
  114. package/dist/npm/annotations/shared/event_utils.js +165 -0
  115. package/dist/npm/annotations/shared/murmurhash3.d.ts +8 -0
  116. package/dist/npm/annotations/shared/murmurhash3.js +129 -0
  117. package/dist/npm/annotations/shared/scripting_utils.d.ts +17 -0
  118. package/dist/npm/annotations/shared/scripting_utils.js +93 -0
  119. package/dist/npm/annotations/shared/ui_utils.d.ts +54 -0
  120. package/dist/npm/annotations/shared/ui_utils.js +250 -0
  121. package/dist/npm/annotations/shared/utils.d.ts +148 -0
  122. package/dist/npm/annotations/shared/utils.js +872 -0
  123. package/dist/npm/common/component.d.ts +9 -0
  124. package/dist/npm/common/component.js +37 -0
  125. package/dist/npm/common/core.d.ts +18 -0
  126. package/dist/npm/common/core.js +112 -0
  127. package/dist/npm/common/dom.d.ts +3 -0
  128. package/dist/npm/common/dom.js +17 -0
  129. package/dist/npm/common/main.d.ts +4 -0
  130. package/dist/npm/common/main.js +7 -0
  131. package/dist/npm/common/math.d.ts +1 -0
  132. package/dist/npm/common/math.js +5 -0
  133. package/dist/npm/enums/PdfViewerInteractionMode.d.ts +4 -0
  134. package/dist/npm/enums/PdfViewerInteractionMode.js +9 -0
  135. package/dist/npm/links/link-service.d.ts +116 -0
  136. package/dist/npm/links/link-service.js +501 -0
  137. package/dist/npm/main.d.ts +2 -0
  138. package/dist/npm/main.js +2 -0
  139. package/dist/npm/scroller.d.ts +7 -3
  140. package/dist/npm/scroller.js +32 -32
  141. package/dist/npm/text/text-layer-builder.d.ts +30 -0
  142. package/dist/npm/text/text-layer-builder.js +291 -0
  143. package/dist/npm/utils.d.ts +20 -2
  144. package/dist/npm/utils.js +11 -8
  145. package/dist/npm/widget/page.d.ts +75 -0
  146. package/dist/npm/widget/page.js +763 -0
  147. package/dist/npm/widget/pdfviewer.d.ts +222 -0
  148. package/dist/npm/widget/pdfviewer.js +1663 -0
  149. package/package.json +13 -9
@@ -0,0 +1,65 @@
1
+ /* Copyright 2022 Mozilla Foundation
2
+ *
3
+ * Licensed under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License.
5
+ * You may obtain a copy of the License at
6
+ *
7
+ * http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software
10
+ * distributed under the License is distributed on an "AS IS" BASIS,
11
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ * See the License for the specific language governing permissions and
13
+ * limitations under the License.
14
+ */
15
+ var _DrawLayerBuilder_drawLayer;
16
+ import { __awaiter, __classPrivateFieldGet, __classPrivateFieldSet } from "tslib";
17
+ import { DrawLayer } from "./draw-layer";
18
+ /**
19
+ * @typedef {Object} DrawLayerBuilderOptions
20
+ * @property {number} pageIndex
21
+ */
22
+ class DrawLayerBuilder {
23
+ /**
24
+ * @param {DrawLayerBuilderOptions} options
25
+ */
26
+ constructor(options) {
27
+ // todo: props
28
+ this.pageIndex = null;
29
+ this._cancelled = null;
30
+ // todo: props
31
+ _DrawLayerBuilder_drawLayer.set(this, null);
32
+ this.pageIndex = options.pageIndex;
33
+ }
34
+ /**
35
+ * @param {string} intent (default value is 'display')
36
+ */
37
+ render() {
38
+ return __awaiter(this, arguments, void 0, function* (intent = "display") {
39
+ // if (intent !== "display" || this.#drawLayer || this._cancelled) {
40
+ if (intent !== "display" || __classPrivateFieldGet(this, _DrawLayerBuilder_drawLayer, "f")) {
41
+ return;
42
+ }
43
+ __classPrivateFieldSet(this, _DrawLayerBuilder_drawLayer, new DrawLayer({
44
+ pageIndex: this.pageIndex,
45
+ }), "f");
46
+ });
47
+ }
48
+ cancel() {
49
+ // this._cancelled = true;
50
+ if (!__classPrivateFieldGet(this, _DrawLayerBuilder_drawLayer, "f")) {
51
+ return;
52
+ }
53
+ __classPrivateFieldGet(this, _DrawLayerBuilder_drawLayer, "f").destroy();
54
+ __classPrivateFieldSet(this, _DrawLayerBuilder_drawLayer, null, "f");
55
+ }
56
+ setParent(parent) {
57
+ var _a;
58
+ (_a = __classPrivateFieldGet(this, _DrawLayerBuilder_drawLayer, "f")) === null || _a === void 0 ? void 0 : _a.setParent(parent);
59
+ }
60
+ getDrawLayer() {
61
+ return __classPrivateFieldGet(this, _DrawLayerBuilder_drawLayer, "f");
62
+ }
63
+ }
64
+ _DrawLayerBuilder_drawLayer = new WeakMap();
65
+ export { DrawLayerBuilder };
@@ -0,0 +1,220 @@
1
+ /* Copyright 2023 Mozilla Foundation
2
+ *
3
+ * Licensed under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License.
5
+ * You may obtain a copy of the License at
6
+ *
7
+ * http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software
10
+ * distributed under the License is distributed on an "AS IS" BASIS,
11
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ * See the License for the specific language governing permissions and
13
+ * limitations under the License.
14
+ */
15
+ var _DrawLayer_instances, _a, _DrawLayer_parent, _DrawLayer_id, _DrawLayer_mapping, _DrawLayer_toUpdate, _DrawLayer_setBox, _DrawLayer_createSVG, _DrawLayer_createClipPath;
16
+ import { __classPrivateFieldGet, __classPrivateFieldSet } from "tslib";
17
+ // import { DOMSVGFactory } from "./display_utils.js";
18
+ // import { shadow } from "../shared/util.js";
19
+ import { DOMSVGFactory, shadow } from "pdfjs-dist/legacy/build/pdf.mjs";
20
+ /**
21
+ * Manage the SVGs drawn on top of the page canvas.
22
+ * It's important to have them directly on top of the canvas because we want to
23
+ * be able to use mix-blend-mode for some of them.
24
+ */
25
+ class DrawLayer {
26
+ constructor({ pageIndex }) {
27
+ _DrawLayer_instances.add(this);
28
+ // todo: props
29
+ this.pageIndex = 0;
30
+ // todo: props
31
+ _DrawLayer_parent.set(this, null);
32
+ _DrawLayer_id.set(this, 0);
33
+ _DrawLayer_mapping.set(this, new Map());
34
+ _DrawLayer_toUpdate.set(this, new Map());
35
+ this.pageIndex = pageIndex;
36
+ }
37
+ setParent(parent) {
38
+ if (!__classPrivateFieldGet(this, _DrawLayer_parent, "f")) {
39
+ __classPrivateFieldSet(this, _DrawLayer_parent, parent, "f");
40
+ return;
41
+ }
42
+ if (__classPrivateFieldGet(this, _DrawLayer_parent, "f") !== parent) {
43
+ if (__classPrivateFieldGet(this, _DrawLayer_mapping, "f").size > 0) {
44
+ for (const root of __classPrivateFieldGet(this, _DrawLayer_mapping, "f").values()) {
45
+ root.remove();
46
+ parent.append(root);
47
+ }
48
+ }
49
+ __classPrivateFieldSet(this, _DrawLayer_parent, parent, "f");
50
+ }
51
+ }
52
+ static get _svgFactory() {
53
+ return shadow(this, "_svgFactory", new DOMSVGFactory());
54
+ }
55
+ highlight(outlines, color, opacity, isPathUpdatable = false) {
56
+ var _b, _c;
57
+ const id = (__classPrivateFieldSet(this, _DrawLayer_id, (_c = __classPrivateFieldGet(this, _DrawLayer_id, "f"), _b = _c++, _c), "f"), _b);
58
+ const root = __classPrivateFieldGet(this, _DrawLayer_instances, "m", _DrawLayer_createSVG).call(this, outlines.box);
59
+ // root.classList.add("highlight");
60
+ root.classList.add("k-highlight");
61
+ if (outlines.free) {
62
+ // root.classList.add("free");
63
+ }
64
+ const defs = _a._svgFactory.createElement("defs");
65
+ root.append(defs);
66
+ const path = _a._svgFactory.createElement("path");
67
+ defs.append(path);
68
+ const pathId = `path_p${this.pageIndex}_${id}`;
69
+ path.setAttribute("id", pathId);
70
+ path.setAttribute("d", outlines.toSVGPath());
71
+ if (isPathUpdatable) {
72
+ __classPrivateFieldGet(this, _DrawLayer_toUpdate, "f").set(id, path);
73
+ }
74
+ // Create the clipping path for the editor div.
75
+ const clipPathId = __classPrivateFieldGet(this, _DrawLayer_instances, "m", _DrawLayer_createClipPath).call(this, defs, pathId);
76
+ const use = _a._svgFactory.createElement("use");
77
+ root.append(use);
78
+ root.setAttribute("fill", color);
79
+ root.setAttribute("fill-opacity", opacity);
80
+ use.setAttribute("href", `#${pathId}`);
81
+ __classPrivateFieldGet(this, _DrawLayer_mapping, "f").set(id, root);
82
+ return { id, clipPathId: `url(#${clipPathId})` };
83
+ }
84
+ highlightOutline(outlines) {
85
+ var _b, _c;
86
+ // We cannot draw the outline directly in the SVG for highlights because
87
+ // it composes with its parent with mix-blend-mode: multiply.
88
+ // But the outline has a different mix-blend-mode, so we need to draw it in
89
+ // its own SVG.
90
+ const id = (__classPrivateFieldSet(this, _DrawLayer_id, (_c = __classPrivateFieldGet(this, _DrawLayer_id, "f"), _b = _c++, _c), "f"), _b);
91
+ const root = __classPrivateFieldGet(this, _DrawLayer_instances, "m", _DrawLayer_createSVG).call(this, outlines.box);
92
+ // root.classList.add("highlightOutline");
93
+ root.classList.add("k-highlight-outline");
94
+ const defs = _a._svgFactory.createElement("defs");
95
+ root.append(defs);
96
+ const path = _a._svgFactory.createElement("path");
97
+ defs.append(path);
98
+ const pathId = `path_p${this.pageIndex}_${id}`;
99
+ path.setAttribute("id", pathId);
100
+ path.setAttribute("d", outlines.toSVGPath());
101
+ path.setAttribute("vector-effect", "non-scaling-stroke");
102
+ let maskId;
103
+ if (outlines.free) {
104
+ // root.classList.add("free");
105
+ const mask = _a._svgFactory.createElement("mask");
106
+ defs.append(mask);
107
+ maskId = `mask_p${this.pageIndex}_${id}`;
108
+ mask.setAttribute("id", maskId);
109
+ mask.setAttribute("maskUnits", "objectBoundingBox");
110
+ const rect = _a._svgFactory.createElement("rect");
111
+ mask.append(rect);
112
+ rect.setAttribute("width", "1");
113
+ rect.setAttribute("height", "1");
114
+ rect.setAttribute("fill", "white");
115
+ const use = _a._svgFactory.createElement("use");
116
+ mask.append(use);
117
+ use.setAttribute("href", `#${pathId}`);
118
+ use.setAttribute("stroke", "none");
119
+ use.setAttribute("fill", "black");
120
+ use.setAttribute("fill-rule", "nonzero");
121
+ // use.classList.add("mask");
122
+ }
123
+ const use1 = _a._svgFactory.createElement("use");
124
+ root.append(use1);
125
+ use1.setAttribute("href", `#${pathId}`);
126
+ if (maskId) {
127
+ use1.setAttribute("mask", `url(#${maskId})`);
128
+ }
129
+ const use2 = use1.cloneNode();
130
+ root.append(use2);
131
+ // use1.classList.add("mainOutline");
132
+ // use2.classList.add("secondaryOutline");
133
+ __classPrivateFieldGet(this, _DrawLayer_mapping, "f").set(id, root);
134
+ return id;
135
+ }
136
+ finalizeLine(id, line) {
137
+ const path = __classPrivateFieldGet(this, _DrawLayer_toUpdate, "f").get(id);
138
+ __classPrivateFieldGet(this, _DrawLayer_toUpdate, "f").delete(id);
139
+ this.updateBox(id, line.box);
140
+ path.setAttribute("d", line.toSVGPath());
141
+ }
142
+ updateLine(id, line) {
143
+ const root = __classPrivateFieldGet(this, _DrawLayer_mapping, "f").get(id);
144
+ const defs = root.firstChild;
145
+ const path = defs.firstChild;
146
+ path.setAttribute("d", line.toSVGPath());
147
+ }
148
+ removeFreeHighlight(id) {
149
+ this.remove(id);
150
+ __classPrivateFieldGet(this, _DrawLayer_toUpdate, "f").delete(id);
151
+ }
152
+ updatePath(id, line) {
153
+ __classPrivateFieldGet(this, _DrawLayer_toUpdate, "f").get(id).setAttribute("d", line.toSVGPath());
154
+ }
155
+ updateBox(id, box) {
156
+ __classPrivateFieldGet(_a, _a, "m", _DrawLayer_setBox).call(_a, __classPrivateFieldGet(this, _DrawLayer_mapping, "f").get(id), box);
157
+ }
158
+ show(id, visible) {
159
+ // this.#mapping.get(id).classList.toggle("hidden", !visible);
160
+ __classPrivateFieldGet(this, _DrawLayer_mapping, "f").get(id).classList.toggle("k-hidden", !visible);
161
+ }
162
+ rotate(id, angle) {
163
+ __classPrivateFieldGet(this, _DrawLayer_mapping, "f").get(id).setAttribute("data-main-rotation", angle);
164
+ }
165
+ changeColor(id, color) {
166
+ __classPrivateFieldGet(this, _DrawLayer_mapping, "f").get(id).setAttribute("fill", color);
167
+ }
168
+ changeOpacity(id, opacity) {
169
+ __classPrivateFieldGet(this, _DrawLayer_mapping, "f").get(id).setAttribute("fill-opacity", opacity);
170
+ }
171
+ addClass(id, className) {
172
+ __classPrivateFieldGet(this, _DrawLayer_mapping, "f").get(id).classList.add(className);
173
+ }
174
+ removeClass(id, className) {
175
+ __classPrivateFieldGet(this, _DrawLayer_mapping, "f").get(id).classList.remove(className);
176
+ }
177
+ remove(id) {
178
+ if (__classPrivateFieldGet(this, _DrawLayer_parent, "f") === null) {
179
+ return;
180
+ }
181
+ __classPrivateFieldGet(this, _DrawLayer_mapping, "f").get(id).remove();
182
+ __classPrivateFieldGet(this, _DrawLayer_mapping, "f").delete(id);
183
+ }
184
+ destroy() {
185
+ __classPrivateFieldSet(this, _DrawLayer_parent, null, "f");
186
+ for (const root of __classPrivateFieldGet(this, _DrawLayer_mapping, "f").values()) {
187
+ root.remove();
188
+ }
189
+ __classPrivateFieldGet(this, _DrawLayer_mapping, "f").clear();
190
+ }
191
+ }
192
+ _a = DrawLayer, _DrawLayer_parent = new WeakMap(), _DrawLayer_id = new WeakMap(), _DrawLayer_mapping = new WeakMap(), _DrawLayer_toUpdate = new WeakMap(), _DrawLayer_instances = new WeakSet(), _DrawLayer_setBox = function _DrawLayer_setBox(element, { x = 0, y = 0, width = 1, height = 1 } = {}) {
193
+ const { style } = element;
194
+ style.top = `${100 * y}%`;
195
+ style.left = `${100 * x}%`;
196
+ // style.width = `${100 * width}%`;
197
+ // style.height = `${100 * height}%`;
198
+ // todo: reduce the dimensions, so that the annotation editor toolbar
199
+ // does not overlap the outline
200
+ style.width = `${100 * width - 0.2}%`;
201
+ style.height = `${100 * height - 0.2}%`;
202
+ }, _DrawLayer_createSVG = function _DrawLayer_createSVG(box) {
203
+ const svg = _a._svgFactory.create(1, 1, /* skipDimensions = */ true);
204
+ __classPrivateFieldGet(this, _DrawLayer_parent, "f").append(svg);
205
+ svg.setAttribute("aria-hidden", true);
206
+ __classPrivateFieldGet(_a, _a, "m", _DrawLayer_setBox).call(_a, svg, box);
207
+ return svg;
208
+ }, _DrawLayer_createClipPath = function _DrawLayer_createClipPath(defs, pathId) {
209
+ const clipPath = _a._svgFactory.createElement("clipPath");
210
+ defs.append(clipPath);
211
+ const clipPathId = `clip_${pathId}`;
212
+ clipPath.setAttribute("id", clipPathId);
213
+ clipPath.setAttribute("clipPathUnits", "objectBoundingBox");
214
+ const clipPathUse = _a._svgFactory.createElement("use");
215
+ clipPath.append(clipPathUse);
216
+ clipPathUse.setAttribute("href", `#${pathId}`);
217
+ // clipPathUse.classList.add("clip");
218
+ return clipPathId;
219
+ };
220
+ export { DrawLayer };