@embedpdf/plugin-annotation 2.6.2 → 2.8.0
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.
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +538 -90
- package/dist/index.js.map +1 -1
- package/dist/lib/actions.d.ts +12 -1
- package/dist/lib/annotation-plugin.d.ts +19 -0
- package/dist/lib/handlers/index.d.ts +4 -0
- package/dist/lib/handlers/insert-text.handler.d.ts +8 -0
- package/dist/lib/handlers/replace-text.handler.d.ts +9 -0
- package/dist/lib/handlers/selection-utils.d.ts +7 -0
- package/dist/lib/handlers/text-markup.handler.d.ts +7 -0
- package/dist/lib/handlers/text.handler.d.ts +3 -0
- package/dist/lib/handlers/types.d.ts +12 -0
- package/dist/lib/helpers.d.ts +2 -1
- package/dist/lib/selectors.d.ts +6 -1
- package/dist/lib/tools/default-tools.d.ts +153 -6
- package/dist/lib/tools/tools-utils.d.ts +2 -0
- package/dist/lib/tools/types.d.ts +4 -0
- package/dist/lib/types.d.ts +19 -2
- package/dist/preact/index.cjs +1 -1
- package/dist/preact/index.cjs.map +1 -1
- package/dist/preact/index.js +1258 -1074
- package/dist/preact/index.js.map +1 -1
- package/dist/react/index.cjs +1 -1
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.js +1258 -1074
- package/dist/react/index.js.map +1 -1
- package/dist/shared/annotation-bounds.d.ts +14 -0
- package/dist/shared/components/annotation-container.d.ts +11 -5
- package/dist/shared/components/annotations/caret.d.ts +24 -0
- package/dist/shared/components/annotations/circle.d.ts +6 -4
- package/dist/shared/components/annotations/free-text.d.ts +6 -3
- package/dist/shared/components/annotations/ink.d.ts +5 -3
- package/dist/shared/components/annotations/line.d.ts +5 -3
- package/dist/shared/components/annotations/link.d.ts +2 -2
- package/dist/shared/components/annotations/polygon.d.ts +5 -4
- package/dist/shared/components/annotations/polyline.d.ts +10 -4
- package/dist/shared/components/annotations/square.d.ts +6 -4
- package/dist/shared/components/annotations/stamp.d.ts +2 -2
- package/dist/shared/components/annotations/text.d.ts +14 -0
- package/dist/shared/components/annotations.d.ts +0 -1
- package/dist/shared/components/appearance-image.d.ts +12 -0
- package/dist/shared/components/built-in-renderers.d.ts +2 -0
- package/dist/shared/components/text-markup/highlight.d.ts +5 -3
- package/dist/shared/components/text-markup/squiggly.d.ts +5 -3
- package/dist/shared/components/text-markup/strikeout.d.ts +5 -3
- package/dist/shared/components/text-markup/underline.d.ts +5 -3
- package/dist/shared/components/types.d.ts +67 -11
- package/dist/shared-preact/annotation-bounds.d.ts +14 -0
- package/dist/shared-preact/components/annotation-container.d.ts +11 -5
- package/dist/shared-preact/components/annotations/caret.d.ts +24 -0
- package/dist/shared-preact/components/annotations/circle.d.ts +6 -4
- package/dist/shared-preact/components/annotations/free-text.d.ts +6 -3
- package/dist/shared-preact/components/annotations/ink.d.ts +5 -3
- package/dist/shared-preact/components/annotations/line.d.ts +5 -3
- package/dist/shared-preact/components/annotations/link.d.ts +2 -2
- package/dist/shared-preact/components/annotations/polygon.d.ts +5 -4
- package/dist/shared-preact/components/annotations/polyline.d.ts +10 -4
- package/dist/shared-preact/components/annotations/square.d.ts +6 -4
- package/dist/shared-preact/components/annotations/stamp.d.ts +2 -2
- package/dist/shared-preact/components/annotations/text.d.ts +14 -0
- package/dist/shared-preact/components/annotations.d.ts +0 -1
- package/dist/shared-preact/components/appearance-image.d.ts +12 -0
- package/dist/shared-preact/components/built-in-renderers.d.ts +2 -0
- package/dist/shared-preact/components/text-markup/highlight.d.ts +5 -3
- package/dist/shared-preact/components/text-markup/squiggly.d.ts +5 -3
- package/dist/shared-preact/components/text-markup/strikeout.d.ts +5 -3
- package/dist/shared-preact/components/text-markup/underline.d.ts +5 -3
- package/dist/shared-preact/components/types.d.ts +67 -11
- package/dist/shared-react/annotation-bounds.d.ts +14 -0
- package/dist/shared-react/components/annotation-container.d.ts +11 -5
- package/dist/shared-react/components/annotations/caret.d.ts +24 -0
- package/dist/shared-react/components/annotations/circle.d.ts +6 -4
- package/dist/shared-react/components/annotations/free-text.d.ts +6 -3
- package/dist/shared-react/components/annotations/ink.d.ts +5 -3
- package/dist/shared-react/components/annotations/line.d.ts +5 -3
- package/dist/shared-react/components/annotations/link.d.ts +2 -2
- package/dist/shared-react/components/annotations/polygon.d.ts +5 -4
- package/dist/shared-react/components/annotations/polyline.d.ts +10 -4
- package/dist/shared-react/components/annotations/square.d.ts +6 -4
- package/dist/shared-react/components/annotations/stamp.d.ts +2 -2
- package/dist/shared-react/components/annotations/text.d.ts +14 -0
- package/dist/shared-react/components/annotations.d.ts +0 -1
- package/dist/shared-react/components/appearance-image.d.ts +12 -0
- package/dist/shared-react/components/built-in-renderers.d.ts +2 -0
- package/dist/shared-react/components/text-markup/highlight.d.ts +5 -3
- package/dist/shared-react/components/text-markup/squiggly.d.ts +5 -3
- package/dist/shared-react/components/text-markup/strikeout.d.ts +5 -3
- package/dist/shared-react/components/text-markup/underline.d.ts +5 -3
- package/dist/shared-react/components/types.d.ts +67 -11
- package/dist/shared-vue/annotation-bounds.d.ts +14 -0
- package/dist/svelte/components/Annotations.svelte.d.ts +0 -7
- package/dist/svelte/components/AppearanceImage.svelte.d.ts +8 -0
- package/dist/svelte/components/annotations/Caret.svelte.d.ts +13 -0
- package/dist/svelte/components/annotations/Circle.svelte.d.ts +2 -11
- package/dist/svelte/components/annotations/FreeText.svelte.d.ts +2 -1
- package/dist/svelte/components/annotations/Ink.svelte.d.ts +2 -2
- package/dist/svelte/components/annotations/Line.svelte.d.ts +2 -1
- package/dist/svelte/components/annotations/Link.svelte.d.ts +1 -1
- package/dist/svelte/components/annotations/Polygon.svelte.d.ts +2 -1
- package/dist/svelte/components/annotations/Polyline.svelte.d.ts +5 -3
- package/dist/svelte/components/annotations/Square.svelte.d.ts +2 -1
- package/dist/svelte/components/annotations/Stamp.svelte.d.ts +1 -1
- package/dist/svelte/components/annotations/Text.svelte.d.ts +10 -0
- package/dist/svelte/components/annotations/index.d.ts +1 -0
- package/dist/svelte/components/built-in-renderers.d.ts +2 -0
- package/dist/svelte/components/renderers/CaretRenderer.svelte.d.ts +5 -0
- package/dist/svelte/components/renderers/CircleRenderer.svelte.d.ts +5 -0
- package/dist/svelte/components/renderers/FreeTextRenderer.svelte.d.ts +5 -0
- package/dist/svelte/components/renderers/HighlightRenderer.svelte.d.ts +5 -0
- package/dist/svelte/components/renderers/InkRenderer.svelte.d.ts +5 -0
- package/dist/svelte/components/renderers/LineRenderer.svelte.d.ts +5 -0
- package/dist/svelte/components/renderers/LinkRenderer.svelte.d.ts +5 -0
- package/dist/svelte/components/renderers/PolygonRenderer.svelte.d.ts +5 -0
- package/dist/svelte/components/renderers/PolylineRenderer.svelte.d.ts +5 -0
- package/dist/svelte/components/renderers/SquareRenderer.svelte.d.ts +5 -0
- package/dist/svelte/components/renderers/SquigglyRenderer.svelte.d.ts +5 -0
- package/dist/svelte/components/renderers/StampRenderer.svelte.d.ts +5 -0
- package/dist/svelte/components/renderers/StrikeoutRenderer.svelte.d.ts +5 -0
- package/dist/svelte/components/renderers/TextRenderer.svelte.d.ts +5 -0
- package/dist/svelte/components/renderers/UnderlineRenderer.svelte.d.ts +5 -0
- package/dist/svelte/components/text-markup/Highlight.svelte.d.ts +3 -1
- package/dist/svelte/components/text-markup/Squiggly.svelte.d.ts +3 -1
- package/dist/svelte/components/text-markup/Strikeout.svelte.d.ts +3 -1
- package/dist/svelte/components/text-markup/Underline.svelte.d.ts +3 -1
- package/dist/svelte/components/types.d.ts +8 -2
- package/dist/svelte/context/renderer-registry.svelte.d.ts +2 -2
- package/dist/svelte/context/types.d.ts +63 -2
- package/dist/svelte/index.cjs +1 -1
- package/dist/svelte/index.cjs.map +1 -1
- package/dist/svelte/index.js +2738 -2890
- package/dist/svelte/index.js.map +1 -1
- package/dist/vue/components/annotation-container.vue.d.ts +7 -2
- package/dist/vue/components/annotation-layer.vue.d.ts +2 -21
- package/dist/vue/components/annotations/caret.vue.d.ts +24 -0
- package/dist/vue/components/annotations/circle.vue.d.ts +19 -6
- package/dist/vue/components/annotations/free-text.vue.d.ts +18 -6
- package/dist/vue/components/annotations/index.d.ts +1 -0
- package/dist/vue/components/annotations/ink.vue.d.ts +17 -7
- package/dist/vue/components/annotations/line.vue.d.ts +21 -6
- package/dist/vue/components/annotations/link.vue.d.ts +24 -6
- package/dist/vue/components/annotations/polygon.vue.d.ts +22 -6
- package/dist/vue/components/annotations/polyline.vue.d.ts +25 -7
- package/dist/vue/components/annotations/square.vue.d.ts +19 -6
- package/dist/vue/components/annotations/stamp.vue.d.ts +12 -6
- package/dist/vue/components/annotations/text.vue.d.ts +14 -0
- package/dist/vue/components/annotations.vue.d.ts +9 -576
- package/dist/vue/components/appearance-image.vue.d.ts +9 -0
- package/dist/vue/components/built-in-renderers.d.ts +2 -0
- package/dist/vue/components/group-selection-box.vue.d.ts +2 -2
- package/dist/vue/components/renderers/caret-renderer.vue.d.ts +6 -0
- package/dist/vue/components/renderers/circle-renderer.vue.d.ts +6 -0
- package/dist/vue/components/renderers/free-text-renderer.vue.d.ts +6 -0
- package/dist/vue/components/renderers/highlight-renderer.vue.d.ts +6 -0
- package/dist/vue/components/renderers/ink-renderer.vue.d.ts +6 -0
- package/dist/vue/components/renderers/line-renderer.vue.d.ts +6 -0
- package/dist/vue/components/renderers/link-renderer.vue.d.ts +6 -0
- package/dist/vue/components/renderers/polygon-renderer.vue.d.ts +6 -0
- package/dist/vue/components/renderers/polyline-renderer.vue.d.ts +6 -0
- package/dist/vue/components/renderers/square-renderer.vue.d.ts +6 -0
- package/dist/vue/components/renderers/squiggly-renderer.vue.d.ts +6 -0
- package/dist/vue/components/renderers/stamp-renderer.vue.d.ts +6 -0
- package/dist/vue/components/renderers/strikeout-renderer.vue.d.ts +6 -0
- package/dist/vue/components/renderers/text-renderer.vue.d.ts +6 -0
- package/dist/vue/components/renderers/underline-renderer.vue.d.ts +6 -0
- package/dist/vue/components/text-markup/highlight.vue.d.ts +18 -6
- package/dist/vue/components/text-markup/squiggly.vue.d.ts +18 -6
- package/dist/vue/components/text-markup/strikeout.vue.d.ts +18 -6
- package/dist/vue/components/text-markup/underline.vue.d.ts +18 -6
- package/dist/vue/context/renderer-registry.d.ts +2 -2
- package/dist/vue/context/types.d.ts +63 -2
- package/dist/vue/index.cjs +1 -1
- package/dist/vue/index.cjs.map +1 -1
- package/dist/vue/index.js +1995 -1336
- package/dist/vue/index.js.map +1 -1
- package/package.json +10 -10
package/dist/vue/index.js
CHANGED
|
@@ -1,12 +1,61 @@
|
|
|
1
1
|
import { createPluginPackage } from "@embedpdf/core";
|
|
2
|
-
import { AnnotationPlugin, initialDocumentState, inferRotationCenterFromRects, patching,
|
|
2
|
+
import { AnnotationPlugin, initialDocumentState, inferRotationCenterFromRects, patching, resolveInteractionProp, getAnnotationsByPageIndex, getSelectedAnnotationIds, AnnotationPluginPackage as AnnotationPluginPackage$1 } from "@embedpdf/plugin-annotation";
|
|
3
3
|
export * from "@embedpdf/plugin-annotation";
|
|
4
|
-
import { ref,
|
|
4
|
+
import { defineComponent, ref, watchEffect, openBlock, createElementBlock, normalizeStyle, createCommentVNode, toValue, watch, computed, shallowRef, toRaw, useSlots, createElementVNode, Fragment, unref, renderSlot, normalizeProps, mergeProps, createBlock, renderList, withCtx, resolveDynamicComponent, Teleport, toDisplayString, markRaw, provide, inject, onUnmounted, onMounted, createVNode, createSlots, guardReactiveProps } from "vue";
|
|
5
|
+
import { getCounterRotation } from "@embedpdf/utils";
|
|
5
6
|
import { useInteractionHandles, useDoublePressProps, CounterRotate, deepToRaw } from "@embedpdf/utils/vue";
|
|
6
|
-
import {
|
|
7
|
-
import { boundingRectOrEmpty, PdfAnnotationBorderStyle, PdfVerticalAlignment, textAlignmentToCss, standardFontCssProperties, ignore, PdfErrorCode,
|
|
7
|
+
import { useCapability, usePlugin, useDocumentPermissions, useDocumentState } from "@embedpdf/core/vue";
|
|
8
|
+
import { boundingRectOrEmpty, PdfAnnotationBorderStyle, PdfVerticalAlignment, textAlignmentToCss, standardFontCssProperties, ignore, PdfErrorCode, getContrastStrokeColor, PdfAnnotationSubtype, blendModeToCss, PdfBlendMode } from "@embedpdf/models";
|
|
8
9
|
import { usePointerHandlers } from "@embedpdf/plugin-interaction-manager/vue";
|
|
9
10
|
import { useSelectionCapability } from "@embedpdf/plugin-selection/vue";
|
|
11
|
+
const _hoisted_1$d = ["src"];
|
|
12
|
+
const _sfc_main$D = /* @__PURE__ */ defineComponent({
|
|
13
|
+
__name: "appearance-image",
|
|
14
|
+
props: {
|
|
15
|
+
appearance: {},
|
|
16
|
+
style: {}
|
|
17
|
+
},
|
|
18
|
+
setup(__props) {
|
|
19
|
+
const props = __props;
|
|
20
|
+
const imageUrl = ref(null);
|
|
21
|
+
const urlRef = ref(null);
|
|
22
|
+
watchEffect((onCleanup) => {
|
|
23
|
+
const url = URL.createObjectURL(props.appearance.data);
|
|
24
|
+
imageUrl.value = url;
|
|
25
|
+
urlRef.value = url;
|
|
26
|
+
onCleanup(() => {
|
|
27
|
+
if (urlRef.value) {
|
|
28
|
+
URL.revokeObjectURL(urlRef.value);
|
|
29
|
+
urlRef.value = null;
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
const handleImageLoad = () => {
|
|
34
|
+
if (urlRef.value) {
|
|
35
|
+
URL.revokeObjectURL(urlRef.value);
|
|
36
|
+
urlRef.value = null;
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
return (_ctx, _cache) => {
|
|
40
|
+
return imageUrl.value ? (openBlock(), createElementBlock("img", {
|
|
41
|
+
key: 0,
|
|
42
|
+
src: imageUrl.value,
|
|
43
|
+
alt: "",
|
|
44
|
+
draggable: "false",
|
|
45
|
+
onLoad: handleImageLoad,
|
|
46
|
+
style: normalizeStyle({
|
|
47
|
+
position: "absolute",
|
|
48
|
+
width: "100%",
|
|
49
|
+
height: "100%",
|
|
50
|
+
display: "block",
|
|
51
|
+
pointerEvents: "none",
|
|
52
|
+
userSelect: "none",
|
|
53
|
+
...__props.style
|
|
54
|
+
})
|
|
55
|
+
}, null, 44, _hoisted_1$d)) : createCommentVNode("", true);
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
});
|
|
10
59
|
const useAnnotationPlugin = () => usePlugin(AnnotationPlugin.id);
|
|
11
60
|
const useAnnotationCapability = () => useCapability(AnnotationPlugin.id);
|
|
12
61
|
const useAnnotation = (documentId) => {
|
|
@@ -37,13 +86,13 @@ const useAnnotation = (documentId) => {
|
|
|
37
86
|
})
|
|
38
87
|
};
|
|
39
88
|
};
|
|
40
|
-
const _hoisted_1$
|
|
41
|
-
const _hoisted_2$
|
|
42
|
-
const __default__ = {
|
|
89
|
+
const _hoisted_1$c = ["width", "height", "stroke"];
|
|
90
|
+
const _hoisted_2$a = ["width", "height", "stroke"];
|
|
91
|
+
const __default__$e = {
|
|
43
92
|
inheritAttrs: false
|
|
44
93
|
};
|
|
45
|
-
const _sfc_main$
|
|
46
|
-
...__default__,
|
|
94
|
+
const _sfc_main$C = /* @__PURE__ */ defineComponent({
|
|
95
|
+
...__default__$e,
|
|
47
96
|
__name: "annotation-container",
|
|
48
97
|
props: {
|
|
49
98
|
scale: {},
|
|
@@ -54,6 +103,7 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
54
103
|
pageHeight: {},
|
|
55
104
|
trackedAnnotation: {},
|
|
56
105
|
isSelected: { type: Boolean },
|
|
106
|
+
isEditing: { type: Boolean, default: false },
|
|
57
107
|
isMultiSelected: { type: Boolean, default: false },
|
|
58
108
|
isDraggable: { type: Boolean },
|
|
59
109
|
isResizable: { type: Boolean },
|
|
@@ -64,6 +114,7 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
64
114
|
outlineOffset: { default: 1 },
|
|
65
115
|
onDoubleClick: {},
|
|
66
116
|
onSelect: {},
|
|
117
|
+
appearance: {},
|
|
67
118
|
zIndex: { default: 1 },
|
|
68
119
|
selectionOutlineColor: { default: "#007ACC" },
|
|
69
120
|
selectionOutline: {},
|
|
@@ -148,6 +199,7 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
148
199
|
const liveRotation = ref(null);
|
|
149
200
|
const cursorScreen = ref(null);
|
|
150
201
|
const isHandleHovered = ref(false);
|
|
202
|
+
const gestureActive = ref(false);
|
|
151
203
|
const { provides: annotationCapability } = useAnnotationCapability();
|
|
152
204
|
const { plugin: annotationPlugin } = useAnnotationPlugin();
|
|
153
205
|
const permissions = useDocumentPermissions(props.documentId);
|
|
@@ -174,6 +226,12 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
174
226
|
const currentObject = computed(
|
|
175
227
|
() => ({ ...toRaw(props.trackedAnnotation.object), ...toRaw(preview.value) })
|
|
176
228
|
);
|
|
229
|
+
const hasNoZoom = computed(() => (props.trackedAnnotation.object.flags ?? []).includes("noZoom"));
|
|
230
|
+
const hasNoRotate = computed(
|
|
231
|
+
() => (props.trackedAnnotation.object.flags ?? []).includes("noRotate")
|
|
232
|
+
);
|
|
233
|
+
const visualScale = computed(() => hasNoZoom.value ? 1 : props.scale);
|
|
234
|
+
const effectivePageRotation = computed(() => hasNoRotate.value ? 0 : props.rotation);
|
|
177
235
|
const annotationRotation = computed(
|
|
178
236
|
() => liveRotation.value ?? currentObject.value.rotation ?? 0
|
|
179
237
|
);
|
|
@@ -218,8 +276,8 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
218
276
|
y: currentObject.value.rect.origin.y * props.scale
|
|
219
277
|
},
|
|
220
278
|
size: {
|
|
221
|
-
width: currentObject.value.rect.size.width *
|
|
222
|
-
height: currentObject.value.rect.size.height *
|
|
279
|
+
width: currentObject.value.rect.size.width * visualScale.value,
|
|
280
|
+
height: currentObject.value.rect.size.height * visualScale.value
|
|
223
281
|
}
|
|
224
282
|
}));
|
|
225
283
|
const menuContext = computed(() => ({
|
|
@@ -228,7 +286,7 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
228
286
|
pageIndex: props.pageIndex
|
|
229
287
|
}));
|
|
230
288
|
const menuPlacement = computed(() => {
|
|
231
|
-
const effectiveAngle = ((annotationRotation.value +
|
|
289
|
+
const effectiveAngle = ((annotationRotation.value + effectivePageRotation.value * 90) % 360 + 360) % 360;
|
|
232
290
|
const handleNearMenuSide = effectiveIsRotatable.value && effectiveAngle > 90 && effectiveAngle < 270;
|
|
233
291
|
return {
|
|
234
292
|
suggestTop: handleNearMenuSide
|
|
@@ -286,6 +344,9 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
286
344
|
if (event.state === "start") {
|
|
287
345
|
gestureBaseRectRef.value = props.trackedAnnotation.object.unrotatedRect ?? props.trackedAnnotation.object.rect;
|
|
288
346
|
gestureBaseRef.value = currentObject.value;
|
|
347
|
+
if (type === "resize" || type === "vertex-edit") {
|
|
348
|
+
gestureActive.value = true;
|
|
349
|
+
}
|
|
289
350
|
if (type === "move") {
|
|
290
351
|
plugin.startDrag(props.documentId, { annotationIds: [id], pageSize });
|
|
291
352
|
} else if (type === "resize") {
|
|
@@ -344,6 +405,7 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
344
405
|
return;
|
|
345
406
|
}
|
|
346
407
|
if (event.state === "end") {
|
|
408
|
+
gestureActive.value = false;
|
|
347
409
|
gestureBaseRectRef.value = null;
|
|
348
410
|
gestureBaseRef.value = null;
|
|
349
411
|
if (type === "move") plugin.commitDrag(props.documentId);
|
|
@@ -407,42 +469,55 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
407
469
|
];
|
|
408
470
|
onCleanup(() => unsubs.forEach((u) => u()));
|
|
409
471
|
});
|
|
410
|
-
const aabbWidth = computed(() => currentObject.value.rect.size.width *
|
|
411
|
-
const aabbHeight = computed(() => currentObject.value.rect.size.height *
|
|
412
|
-
const innerWidth = computed(() => effectiveUnrotatedRect.value.size.width *
|
|
413
|
-
const innerHeight = computed(() => effectiveUnrotatedRect.value.size.height *
|
|
472
|
+
const aabbWidth = computed(() => currentObject.value.rect.size.width * visualScale.value);
|
|
473
|
+
const aabbHeight = computed(() => currentObject.value.rect.size.height * visualScale.value);
|
|
474
|
+
const innerWidth = computed(() => effectiveUnrotatedRect.value.size.width * visualScale.value);
|
|
475
|
+
const innerHeight = computed(() => effectiveUnrotatedRect.value.size.height * visualScale.value);
|
|
414
476
|
const usesCustomPivot = computed(
|
|
415
477
|
() => Boolean(explicitUnrotatedRect.value) && annotationRotation.value !== 0
|
|
416
478
|
);
|
|
417
479
|
const innerLeft = computed(
|
|
418
|
-
() => usesCustomPivot.value ? (effectiveUnrotatedRect.value.origin.x - currentObject.value.rect.origin.x) *
|
|
480
|
+
() => usesCustomPivot.value ? (effectiveUnrotatedRect.value.origin.x - currentObject.value.rect.origin.x) * visualScale.value : (aabbWidth.value - innerWidth.value) / 2
|
|
419
481
|
);
|
|
420
482
|
const innerTop = computed(
|
|
421
|
-
() => usesCustomPivot.value ? (effectiveUnrotatedRect.value.origin.y - currentObject.value.rect.origin.y) *
|
|
483
|
+
() => usesCustomPivot.value ? (effectiveUnrotatedRect.value.origin.y - currentObject.value.rect.origin.y) * visualScale.value : (aabbHeight.value - innerHeight.value) / 2
|
|
422
484
|
);
|
|
423
485
|
const innerTransformOrigin = computed(() => {
|
|
424
486
|
if (usesCustomPivot.value && rotationPivot.value) {
|
|
425
|
-
return `${(rotationPivot.value.x - effectiveUnrotatedRect.value.origin.x) *
|
|
487
|
+
return `${(rotationPivot.value.x - effectiveUnrotatedRect.value.origin.x) * visualScale.value}px ${(rotationPivot.value.y - effectiveUnrotatedRect.value.origin.y) * visualScale.value}px`;
|
|
426
488
|
}
|
|
427
489
|
return "center center";
|
|
428
490
|
});
|
|
429
491
|
const centerX = computed(
|
|
430
|
-
() => rotationPivot.value ? (rotationPivot.value.x - currentObject.value.rect.origin.x) *
|
|
492
|
+
() => rotationPivot.value ? (rotationPivot.value.x - currentObject.value.rect.origin.x) * visualScale.value : aabbWidth.value / 2
|
|
431
493
|
);
|
|
432
494
|
const centerY = computed(
|
|
433
|
-
() => rotationPivot.value ? (rotationPivot.value.y - currentObject.value.rect.origin.y) *
|
|
495
|
+
() => rotationPivot.value ? (rotationPivot.value.y - currentObject.value.rect.origin.y) * visualScale.value : aabbHeight.value / 2
|
|
434
496
|
);
|
|
435
497
|
const guideLength = computed(() => Math.max(300, Math.max(aabbWidth.value, aabbHeight.value) + 80));
|
|
498
|
+
const counterRot = computed(
|
|
499
|
+
() => hasNoRotate.value ? getCounterRotation(
|
|
500
|
+
{ origin: { x: 0, y: 0 }, size: { width: aabbWidth.value, height: aabbHeight.value } },
|
|
501
|
+
props.rotation
|
|
502
|
+
) : null
|
|
503
|
+
);
|
|
436
504
|
const rotationIconSize = computed(() => Math.round(ROTATION_SIZE.value * 0.6));
|
|
505
|
+
const apActive = computed(
|
|
506
|
+
() => {
|
|
507
|
+
var _a;
|
|
508
|
+
return !!((_a = props.appearance) == null ? void 0 : _a.normal) && !gestureActive.value && !props.isEditing && !props.trackedAnnotation.dictMode;
|
|
509
|
+
}
|
|
510
|
+
);
|
|
437
511
|
const contentsStyle = { display: "contents" };
|
|
438
512
|
const outerAABBStyle = computed(() => ({
|
|
439
513
|
position: "absolute",
|
|
440
514
|
left: `${currentObject.value.rect.origin.x * props.scale}px`,
|
|
441
515
|
top: `${currentObject.value.rect.origin.y * props.scale}px`,
|
|
442
|
-
width: `${aabbWidth.value}px`,
|
|
443
|
-
height: `${aabbHeight.value}px`,
|
|
516
|
+
width: `${counterRot.value ? counterRot.value.width : aabbWidth.value}px`,
|
|
517
|
+
height: `${counterRot.value ? counterRot.value.height : aabbHeight.value}px`,
|
|
444
518
|
pointerEvents: "none",
|
|
445
519
|
zIndex: props.zIndex,
|
|
520
|
+
...counterRot.value ? { transform: counterRot.value.matrix, transformOrigin: "0 0" } : {},
|
|
446
521
|
...props.style ?? {}
|
|
447
522
|
}));
|
|
448
523
|
const innerRotatedStyle = computed(() => ({
|
|
@@ -550,6 +625,7 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
550
625
|
}));
|
|
551
626
|
const slots = useSlots();
|
|
552
627
|
return (_ctx, _cache) => {
|
|
628
|
+
var _a;
|
|
553
629
|
return openBlock(), createElementBlock("div", {
|
|
554
630
|
"data-no-interaction": "",
|
|
555
631
|
style: contentsStyle
|
|
@@ -596,7 +672,7 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
596
672
|
}, [..._cache[2] || (_cache[2] = [
|
|
597
673
|
createElementVNode("path", { d: "M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8" }, null, -1),
|
|
598
674
|
createElementVNode("path", { d: "M21 3v5h-5" }, null, -1)
|
|
599
|
-
])], 8, _hoisted_1$
|
|
675
|
+
])], 8, _hoisted_1$c))
|
|
600
676
|
], 16)
|
|
601
677
|
]) : (openBlock(), createElementBlock("div", mergeProps({ key: 2 }, rotationHandleBindings.value, { style: rotationHandleStyle.value }), [
|
|
602
678
|
(openBlock(), createElementBlock("svg", {
|
|
@@ -611,12 +687,20 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
611
687
|
}, [..._cache[3] || (_cache[3] = [
|
|
612
688
|
createElementVNode("path", { d: "M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8" }, null, -1),
|
|
613
689
|
createElementVNode("path", { d: "M21 3v5h-5" }, null, -1)
|
|
614
|
-
])], 8, _hoisted_2$
|
|
690
|
+
])], 8, _hoisted_2$a))
|
|
615
691
|
], 16))
|
|
616
692
|
], 32)) : createCommentVNode("", true),
|
|
617
693
|
createElementVNode("div", mergeProps({ ...effectiveIsDraggable.value && __props.isSelected ? unref(dragProps) : {}, ...unref(doubleProps) }, { style: innerRotatedStyle.value }), [
|
|
618
|
-
renderSlot(_ctx.$slots, "default", {
|
|
619
|
-
|
|
694
|
+
renderSlot(_ctx.$slots, "default", {
|
|
695
|
+
annotation: childObject.value,
|
|
696
|
+
appearanceActive: apActive.value
|
|
697
|
+
}),
|
|
698
|
+
((_a = __props.appearance) == null ? void 0 : _a.normal) ? (openBlock(), createBlock(_sfc_main$D, {
|
|
699
|
+
key: 0,
|
|
700
|
+
appearance: __props.appearance.normal,
|
|
701
|
+
style: normalizeStyle({ display: apActive.value ? "block" : "none" })
|
|
702
|
+
}, null, 8, ["appearance", "style"])) : createCommentVNode("", true),
|
|
703
|
+
__props.isSelected && effectiveIsResizable.value && !rotationActive.value ? (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(unref(resize), ({ key, style, ...handle }) => {
|
|
620
704
|
return openBlock(), createElementBlock(Fragment, { key }, [
|
|
621
705
|
unref(slots)["resize-handle"] ? renderSlot(_ctx.$slots, "resize-handle", mergeProps({
|
|
622
706
|
key: 0,
|
|
@@ -633,7 +717,7 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
633
717
|
}), null, 16))
|
|
634
718
|
], 64);
|
|
635
719
|
}), 128)) : createCommentVNode("", true),
|
|
636
|
-
__props.isSelected && unref(permissions).canModifyAnnotations && !__props.isMultiSelected && !rotationActive.value && unref(vertices).length > 0 ? (openBlock(true), createElementBlock(Fragment, { key:
|
|
720
|
+
__props.isSelected && unref(permissions).canModifyAnnotations && !__props.isMultiSelected && !rotationActive.value && unref(vertices).length > 0 ? (openBlock(true), createElementBlock(Fragment, { key: 2 }, renderList(unref(vertices), ({ key, style, ...vertex }) => {
|
|
637
721
|
return openBlock(), createElementBlock(Fragment, { key }, [
|
|
638
722
|
unref(slots)["vertex-handle"] ? renderSlot(_ctx.$slots, "vertex-handle", mergeProps({
|
|
639
723
|
key: 0,
|
|
@@ -681,14 +765,65 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
681
765
|
};
|
|
682
766
|
}
|
|
683
767
|
});
|
|
684
|
-
|
|
768
|
+
function mapCounterRotatePoint(x, y, width, height, rotation) {
|
|
769
|
+
switch (rotation) {
|
|
770
|
+
case 1:
|
|
771
|
+
return { x: y, y: height - x };
|
|
772
|
+
case 2:
|
|
773
|
+
return { x: width - x, y: height - y };
|
|
774
|
+
case 3:
|
|
775
|
+
return { x: width - y, y: x };
|
|
776
|
+
default:
|
|
777
|
+
return { x, y };
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
function getAnnotationScreenBounds(annotation, scale, rotation) {
|
|
781
|
+
const flags = annotation.object.flags ?? [];
|
|
782
|
+
const hasNoZoom = flags.includes("noZoom");
|
|
783
|
+
const hasNoRotate = flags.includes("noRotate");
|
|
784
|
+
const left = annotation.object.rect.origin.x * scale;
|
|
785
|
+
const top = annotation.object.rect.origin.y * scale;
|
|
786
|
+
const width = annotation.object.rect.size.width * (hasNoZoom ? 1 : scale);
|
|
787
|
+
const height = annotation.object.rect.size.height * (hasNoZoom ? 1 : scale);
|
|
788
|
+
if (!hasNoRotate || rotation === 0) {
|
|
789
|
+
return {
|
|
790
|
+
left,
|
|
791
|
+
top,
|
|
792
|
+
right: left + width,
|
|
793
|
+
bottom: top + height
|
|
794
|
+
};
|
|
795
|
+
}
|
|
796
|
+
const corners = [
|
|
797
|
+
mapCounterRotatePoint(0, 0, width, height, rotation),
|
|
798
|
+
mapCounterRotatePoint(width, 0, width, height, rotation),
|
|
799
|
+
mapCounterRotatePoint(0, height, width, height, rotation),
|
|
800
|
+
mapCounterRotatePoint(width, height, width, height, rotation)
|
|
801
|
+
];
|
|
802
|
+
let minX = Infinity;
|
|
803
|
+
let minY = Infinity;
|
|
804
|
+
let maxX = -Infinity;
|
|
805
|
+
let maxY = -Infinity;
|
|
806
|
+
for (const corner of corners) {
|
|
807
|
+
if (corner.x < minX) minX = corner.x;
|
|
808
|
+
if (corner.y < minY) minY = corner.y;
|
|
809
|
+
if (corner.x > maxX) maxX = corner.x;
|
|
810
|
+
if (corner.y > maxY) maxY = corner.y;
|
|
811
|
+
}
|
|
812
|
+
return {
|
|
813
|
+
left: left + minX,
|
|
814
|
+
top: top + minY,
|
|
815
|
+
right: left + maxX,
|
|
816
|
+
bottom: top + maxY
|
|
817
|
+
};
|
|
818
|
+
}
|
|
819
|
+
const _hoisted_1$b = {
|
|
685
820
|
key: 0,
|
|
686
821
|
"data-group-selection-box": "",
|
|
687
822
|
"data-no-interaction": ""
|
|
688
823
|
};
|
|
689
|
-
const _hoisted_2$
|
|
690
|
-
const _hoisted_3$
|
|
691
|
-
const _sfc_main$
|
|
824
|
+
const _hoisted_2$9 = ["width", "height", "stroke"];
|
|
825
|
+
const _hoisted_3$9 = ["width", "height", "stroke"];
|
|
826
|
+
const _sfc_main$B = /* @__PURE__ */ defineComponent({
|
|
692
827
|
__name: "group-selection-box",
|
|
693
828
|
props: {
|
|
694
829
|
documentId: {},
|
|
@@ -827,8 +962,42 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
|
827
962
|
},
|
|
828
963
|
{ immediate: true }
|
|
829
964
|
);
|
|
830
|
-
const
|
|
831
|
-
|
|
965
|
+
const visualBoundsCorrection = computed(() => {
|
|
966
|
+
let visualLeft = Infinity;
|
|
967
|
+
let visualTop = Infinity;
|
|
968
|
+
let visualRight = -Infinity;
|
|
969
|
+
let visualBottom = -Infinity;
|
|
970
|
+
for (const ta of props.selectedAnnotations) {
|
|
971
|
+
const bounds = getAnnotationScreenBounds(ta, props.scale, props.rotation);
|
|
972
|
+
if (bounds.left < visualLeft) visualLeft = bounds.left;
|
|
973
|
+
if (bounds.top < visualTop) visualTop = bounds.top;
|
|
974
|
+
if (bounds.right > visualRight) visualRight = bounds.right;
|
|
975
|
+
if (bounds.bottom > visualBottom) visualBottom = bounds.bottom;
|
|
976
|
+
}
|
|
977
|
+
const gb = groupBox.value;
|
|
978
|
+
const logicalLeft = gb.origin.x * props.scale;
|
|
979
|
+
const logicalTop = gb.origin.y * props.scale;
|
|
980
|
+
const logicalRight = (gb.origin.x + gb.size.width) * props.scale;
|
|
981
|
+
const logicalBottom = (gb.origin.y + gb.size.height) * props.scale;
|
|
982
|
+
return {
|
|
983
|
+
left: visualLeft - logicalLeft,
|
|
984
|
+
top: visualTop - logicalTop,
|
|
985
|
+
right: visualRight - logicalRight,
|
|
986
|
+
bottom: visualBottom - logicalBottom
|
|
987
|
+
};
|
|
988
|
+
});
|
|
989
|
+
const groupBoxLeft = computed(
|
|
990
|
+
() => previewGroupBox.value.origin.x * props.scale + visualBoundsCorrection.value.left
|
|
991
|
+
);
|
|
992
|
+
const groupBoxTop = computed(
|
|
993
|
+
() => previewGroupBox.value.origin.y * props.scale + visualBoundsCorrection.value.top
|
|
994
|
+
);
|
|
995
|
+
const groupBoxWidth = computed(
|
|
996
|
+
() => previewGroupBox.value.size.width * props.scale + (visualBoundsCorrection.value.right - visualBoundsCorrection.value.left)
|
|
997
|
+
);
|
|
998
|
+
const groupBoxHeight = computed(
|
|
999
|
+
() => previewGroupBox.value.size.height * props.scale + (visualBoundsCorrection.value.bottom - visualBoundsCorrection.value.top)
|
|
1000
|
+
);
|
|
832
1001
|
const groupCenterX = computed(() => groupBoxWidth.value / 2);
|
|
833
1002
|
const groupCenterY = computed(() => groupBoxHeight.value / 2);
|
|
834
1003
|
const groupGuideLength = computed(
|
|
@@ -837,8 +1006,8 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
|
837
1006
|
const contentsStyle = { display: "contents" };
|
|
838
1007
|
const outerStyle = computed(() => ({
|
|
839
1008
|
position: "absolute",
|
|
840
|
-
left: `${
|
|
841
|
-
top: `${
|
|
1009
|
+
left: `${groupBoxLeft.value}px`,
|
|
1010
|
+
top: `${groupBoxTop.value}px`,
|
|
842
1011
|
width: `${groupBoxWidth.value}px`,
|
|
843
1012
|
height: `${groupBoxHeight.value}px`,
|
|
844
1013
|
pointerEvents: "none",
|
|
@@ -947,12 +1116,12 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
|
947
1116
|
}));
|
|
948
1117
|
const menuRect = computed(() => ({
|
|
949
1118
|
origin: {
|
|
950
|
-
x:
|
|
951
|
-
y:
|
|
1119
|
+
x: groupBoxLeft.value,
|
|
1120
|
+
y: groupBoxTop.value
|
|
952
1121
|
},
|
|
953
1122
|
size: {
|
|
954
|
-
width:
|
|
955
|
-
height:
|
|
1123
|
+
width: groupBoxWidth.value,
|
|
1124
|
+
height: groupBoxHeight.value
|
|
956
1125
|
}
|
|
957
1126
|
}));
|
|
958
1127
|
const menuContext = computed(() => ({
|
|
@@ -1114,7 +1283,7 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
|
1114
1283
|
currentRotation: computed(() => liveRotation.value ?? 0)
|
|
1115
1284
|
});
|
|
1116
1285
|
return (_ctx, _cache) => {
|
|
1117
|
-
return __props.selectedAnnotations.length >= 2 ? (openBlock(), createElementBlock("div", _hoisted_1$
|
|
1286
|
+
return __props.selectedAnnotations.length >= 2 ? (openBlock(), createElementBlock("div", _hoisted_1$b, [
|
|
1118
1287
|
createElementVNode("div", {
|
|
1119
1288
|
style: normalizeStyle(outerStyle.value)
|
|
1120
1289
|
}, [
|
|
@@ -1157,7 +1326,7 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
|
1157
1326
|
}, [..._cache[2] || (_cache[2] = [
|
|
1158
1327
|
createElementVNode("path", { d: "M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8" }, null, -1),
|
|
1159
1328
|
createElementVNode("path", { d: "M21 3v5h-5" }, null, -1)
|
|
1160
|
-
])], 8, _hoisted_2$
|
|
1329
|
+
])], 8, _hoisted_2$9))
|
|
1161
1330
|
], 16)
|
|
1162
1331
|
]) : (openBlock(), createElementBlock("div", mergeProps({ key: 2 }, rotationHandleBindings.value, { style: rotationHandleStyle.value }), [
|
|
1163
1332
|
(openBlock(), createElementBlock("svg", {
|
|
@@ -1172,7 +1341,7 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
|
1172
1341
|
}, [..._cache[3] || (_cache[3] = [
|
|
1173
1342
|
createElementVNode("path", { d: "M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8" }, null, -1),
|
|
1174
1343
|
createElementVNode("path", { d: "M21 3v5h-5" }, null, -1)
|
|
1175
|
-
])], 8, _hoisted_3$
|
|
1344
|
+
])], 8, _hoisted_3$9))
|
|
1176
1345
|
], 16))
|
|
1177
1346
|
], 32)) : createCommentVNode("", true),
|
|
1178
1347
|
createElementVNode("div", mergeProps(
|
|
@@ -1227,10 +1396,173 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
|
1227
1396
|
};
|
|
1228
1397
|
}
|
|
1229
1398
|
});
|
|
1230
|
-
const
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1399
|
+
const RendererRegistryKey = Symbol(
|
|
1400
|
+
"AnnotationRendererRegistry"
|
|
1401
|
+
);
|
|
1402
|
+
function createRendererRegistry() {
|
|
1403
|
+
const renderers = shallowRef([]);
|
|
1404
|
+
return {
|
|
1405
|
+
register(entries) {
|
|
1406
|
+
const ids = new Set(entries.map((e) => e.id));
|
|
1407
|
+
renderers.value = [...renderers.value.filter((r) => !ids.has(r.id)), ...entries];
|
|
1408
|
+
return () => {
|
|
1409
|
+
renderers.value = renderers.value.filter((r) => !entries.some((e) => e.id === r.id));
|
|
1410
|
+
};
|
|
1411
|
+
},
|
|
1412
|
+
getAll() {
|
|
1413
|
+
return renderers.value;
|
|
1414
|
+
}
|
|
1415
|
+
};
|
|
1416
|
+
}
|
|
1417
|
+
function provideRendererRegistry() {
|
|
1418
|
+
const registry = createRendererRegistry();
|
|
1419
|
+
provide(RendererRegistryKey, registry);
|
|
1420
|
+
return registry;
|
|
1421
|
+
}
|
|
1422
|
+
function useRendererRegistry() {
|
|
1423
|
+
return inject(RendererRegistryKey, null);
|
|
1424
|
+
}
|
|
1425
|
+
function useRegisterRenderers(entries) {
|
|
1426
|
+
const registry = useRendererRegistry();
|
|
1427
|
+
if (!registry) return;
|
|
1428
|
+
const unregister = registry.register(entries);
|
|
1429
|
+
onUnmounted(unregister);
|
|
1430
|
+
}
|
|
1431
|
+
function createRenderer(entry) {
|
|
1432
|
+
return {
|
|
1433
|
+
id: entry.id,
|
|
1434
|
+
matches: entry.matches,
|
|
1435
|
+
component: markRaw(entry.component),
|
|
1436
|
+
vertexConfig: entry.vertexConfig,
|
|
1437
|
+
zIndex: entry.zIndex,
|
|
1438
|
+
containerStyle: entry.containerStyle,
|
|
1439
|
+
interactionDefaults: entry.interactionDefaults,
|
|
1440
|
+
useAppearanceStream: entry.useAppearanceStream,
|
|
1441
|
+
isDraggable: entry.isDraggable,
|
|
1442
|
+
onDoubleClick: entry.onDoubleClick,
|
|
1443
|
+
selectOverride: entry.selectOverride,
|
|
1444
|
+
hideSelectionMenu: entry.hideSelectionMenu
|
|
1445
|
+
};
|
|
1446
|
+
}
|
|
1447
|
+
const _hoisted_1$a = ["width", "height", "viewBox"];
|
|
1448
|
+
const _hoisted_2$8 = ["d", "stroke-width"];
|
|
1449
|
+
const _hoisted_3$8 = ["d", "opacity"];
|
|
1450
|
+
const __default__$d = { inheritAttrs: false };
|
|
1451
|
+
const _sfc_main$A = /* @__PURE__ */ defineComponent({
|
|
1452
|
+
...__default__$d,
|
|
1453
|
+
__name: "ink",
|
|
1454
|
+
props: {
|
|
1455
|
+
isSelected: { type: Boolean },
|
|
1456
|
+
strokeColor: {},
|
|
1457
|
+
opacity: { default: 1 },
|
|
1458
|
+
strokeWidth: {},
|
|
1459
|
+
inkList: {},
|
|
1460
|
+
rect: {},
|
|
1461
|
+
scale: {},
|
|
1462
|
+
onClick: {},
|
|
1463
|
+
appearanceActive: { type: Boolean, default: false }
|
|
1464
|
+
},
|
|
1465
|
+
setup(__props) {
|
|
1466
|
+
const MIN_HIT_AREA_SCREEN_PX = 20;
|
|
1467
|
+
const props = __props;
|
|
1468
|
+
const resolvedColor = computed(() => props.strokeColor ?? "#000000");
|
|
1469
|
+
const paths = computed(() => {
|
|
1470
|
+
return props.inkList.map(({ points }) => {
|
|
1471
|
+
let d = "";
|
|
1472
|
+
points.forEach(({ x, y }, i) => {
|
|
1473
|
+
const lx = x - props.rect.origin.x;
|
|
1474
|
+
const ly = y - props.rect.origin.y;
|
|
1475
|
+
d += (i === 0 ? "M" : "L") + `${lx} ${ly} `;
|
|
1476
|
+
});
|
|
1477
|
+
return d.trim();
|
|
1478
|
+
});
|
|
1479
|
+
});
|
|
1480
|
+
const width = computed(() => props.rect.size.width * props.scale);
|
|
1481
|
+
const height = computed(() => props.rect.size.height * props.scale);
|
|
1482
|
+
const hitStrokeWidth = computed(
|
|
1483
|
+
() => Math.max(props.strokeWidth, MIN_HIT_AREA_SCREEN_PX / props.scale)
|
|
1484
|
+
);
|
|
1485
|
+
return (_ctx, _cache) => {
|
|
1486
|
+
return openBlock(), createElementBlock("svg", {
|
|
1487
|
+
style: normalizeStyle({
|
|
1488
|
+
position: "absolute",
|
|
1489
|
+
width: `${width.value}px`,
|
|
1490
|
+
height: `${height.value}px`,
|
|
1491
|
+
pointerEvents: "none",
|
|
1492
|
+
zIndex: 2,
|
|
1493
|
+
overflow: "visible"
|
|
1494
|
+
}),
|
|
1495
|
+
width: width.value,
|
|
1496
|
+
height: height.value,
|
|
1497
|
+
viewBox: `0 0 ${__props.rect.size.width} ${__props.rect.size.height}`
|
|
1498
|
+
}, [
|
|
1499
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(paths.value, (d, i) => {
|
|
1500
|
+
return openBlock(), createElementBlock("path", {
|
|
1501
|
+
key: `hit-${i}`,
|
|
1502
|
+
d,
|
|
1503
|
+
fill: "none",
|
|
1504
|
+
stroke: "transparent",
|
|
1505
|
+
"stroke-width": hitStrokeWidth.value,
|
|
1506
|
+
onPointerdown: _cache[0] || (_cache[0] = //@ts-ignore
|
|
1507
|
+
(...args) => __props.onClick && __props.onClick(...args)),
|
|
1508
|
+
style: normalizeStyle({
|
|
1509
|
+
cursor: __props.isSelected ? "move" : "pointer",
|
|
1510
|
+
pointerEvents: __props.isSelected ? "none" : "visibleStroke",
|
|
1511
|
+
strokeLinecap: "round",
|
|
1512
|
+
strokeLinejoin: "round"
|
|
1513
|
+
})
|
|
1514
|
+
}, null, 44, _hoisted_2$8);
|
|
1515
|
+
}), 128)),
|
|
1516
|
+
!__props.appearanceActive ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(paths.value, (d, i) => {
|
|
1517
|
+
return openBlock(), createElementBlock("path", {
|
|
1518
|
+
key: `vis-${i}`,
|
|
1519
|
+
d,
|
|
1520
|
+
fill: "none",
|
|
1521
|
+
opacity: __props.opacity,
|
|
1522
|
+
style: normalizeStyle({
|
|
1523
|
+
pointerEvents: "none",
|
|
1524
|
+
stroke: resolvedColor.value,
|
|
1525
|
+
strokeWidth: __props.strokeWidth,
|
|
1526
|
+
strokeLinecap: "round",
|
|
1527
|
+
strokeLinejoin: "round"
|
|
1528
|
+
})
|
|
1529
|
+
}, null, 12, _hoisted_3$8);
|
|
1530
|
+
}), 128)) : createCommentVNode("", true)
|
|
1531
|
+
], 12, _hoisted_1$a);
|
|
1532
|
+
};
|
|
1533
|
+
}
|
|
1534
|
+
});
|
|
1535
|
+
const _sfc_main$z = /* @__PURE__ */ defineComponent({
|
|
1536
|
+
__name: "ink-renderer",
|
|
1537
|
+
props: {
|
|
1538
|
+
annotation: {},
|
|
1539
|
+
currentObject: {},
|
|
1540
|
+
isSelected: { type: Boolean },
|
|
1541
|
+
isEditing: { type: Boolean },
|
|
1542
|
+
scale: {},
|
|
1543
|
+
pageIndex: {},
|
|
1544
|
+
documentId: {},
|
|
1545
|
+
onClick: { type: Function },
|
|
1546
|
+
appearanceActive: { type: Boolean }
|
|
1547
|
+
},
|
|
1548
|
+
setup(__props) {
|
|
1549
|
+
return (_ctx, _cache) => {
|
|
1550
|
+
return openBlock(), createBlock(_sfc_main$A, mergeProps(__props.currentObject, {
|
|
1551
|
+
isSelected: __props.isSelected,
|
|
1552
|
+
scale: __props.scale,
|
|
1553
|
+
onClick: __props.onClick,
|
|
1554
|
+
appearanceActive: __props.appearanceActive
|
|
1555
|
+
}), null, 16, ["isSelected", "scale", "onClick", "appearanceActive"]);
|
|
1556
|
+
};
|
|
1557
|
+
}
|
|
1558
|
+
});
|
|
1559
|
+
const _hoisted_1$9 = ["width", "height", "viewBox"];
|
|
1560
|
+
const _hoisted_2$7 = ["x", "y", "width", "height", "stroke-width"];
|
|
1561
|
+
const _hoisted_3$7 = ["x", "y", "width", "height", "fill", "opacity"];
|
|
1562
|
+
const __default__$c = { inheritAttrs: false };
|
|
1563
|
+
const _sfc_main$y = /* @__PURE__ */ defineComponent({
|
|
1564
|
+
...__default__$c,
|
|
1565
|
+
__name: "square",
|
|
1234
1566
|
props: {
|
|
1235
1567
|
isSelected: { type: Boolean },
|
|
1236
1568
|
color: { default: "#000000" },
|
|
@@ -1241,9 +1573,11 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
|
|
|
1241
1573
|
strokeDashArray: {},
|
|
1242
1574
|
rect: {},
|
|
1243
1575
|
scale: {},
|
|
1244
|
-
onClick: {}
|
|
1576
|
+
onClick: {},
|
|
1577
|
+
appearanceActive: { type: Boolean, default: false }
|
|
1245
1578
|
},
|
|
1246
1579
|
setup(__props) {
|
|
1580
|
+
const MIN_HIT_AREA_SCREEN_PX = 20;
|
|
1247
1581
|
const props = __props;
|
|
1248
1582
|
const geometry = computed(() => {
|
|
1249
1583
|
const outerW = props.rect.size.width;
|
|
@@ -1251,16 +1585,17 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
|
|
|
1251
1585
|
const innerW = Math.max(outerW - props.strokeWidth, 0);
|
|
1252
1586
|
const innerH = Math.max(outerH - props.strokeWidth, 0);
|
|
1253
1587
|
return {
|
|
1254
|
-
width:
|
|
1255
|
-
height:
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
rx: innerW / 2,
|
|
1259
|
-
ry: innerH / 2
|
|
1588
|
+
width: innerW,
|
|
1589
|
+
height: innerH,
|
|
1590
|
+
x: props.strokeWidth / 2,
|
|
1591
|
+
y: props.strokeWidth / 2
|
|
1260
1592
|
};
|
|
1261
1593
|
});
|
|
1262
|
-
const svgWidth = computed(() => geometry.value.width * props.scale);
|
|
1263
|
-
const svgHeight = computed(() => geometry.value.height * props.scale);
|
|
1594
|
+
const svgWidth = computed(() => (geometry.value.width + props.strokeWidth) * props.scale);
|
|
1595
|
+
const svgHeight = computed(() => (geometry.value.height + props.strokeWidth) * props.scale);
|
|
1596
|
+
const hitStrokeWidth = computed(
|
|
1597
|
+
() => Math.max(props.strokeWidth, MIN_HIT_AREA_SCREEN_PX / props.scale)
|
|
1598
|
+
);
|
|
1264
1599
|
return (_ctx, _cache) => {
|
|
1265
1600
|
var _a;
|
|
1266
1601
|
return openBlock(), createElementBlock("svg", {
|
|
@@ -1273,208 +1608,196 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
|
|
|
1273
1608
|
}),
|
|
1274
1609
|
width: svgWidth.value,
|
|
1275
1610
|
height: svgHeight.value,
|
|
1276
|
-
viewBox: `0 0 ${geometry.value.width} ${geometry.value.height}
|
|
1611
|
+
viewBox: `0 0 ${geometry.value.width + __props.strokeWidth} ${geometry.value.height + __props.strokeWidth}`,
|
|
1612
|
+
overflow: "visible"
|
|
1277
1613
|
}, [
|
|
1278
|
-
createElementVNode("
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
fill:
|
|
1284
|
-
|
|
1614
|
+
createElementVNode("rect", {
|
|
1615
|
+
x: geometry.value.x,
|
|
1616
|
+
y: geometry.value.y,
|
|
1617
|
+
width: geometry.value.width,
|
|
1618
|
+
height: geometry.value.height,
|
|
1619
|
+
fill: "transparent",
|
|
1620
|
+
stroke: "transparent",
|
|
1621
|
+
"stroke-width": hitStrokeWidth.value,
|
|
1285
1622
|
onPointerdown: _cache[0] || (_cache[0] = //@ts-ignore
|
|
1286
1623
|
(...args) => __props.onClick && __props.onClick(...args)),
|
|
1287
|
-
onTouchstart: _cache[1] || (_cache[1] = //@ts-ignore
|
|
1288
|
-
(...args) => __props.onClick && __props.onClick(...args)),
|
|
1289
1624
|
style: normalizeStyle({
|
|
1290
1625
|
cursor: __props.isSelected ? "move" : "pointer",
|
|
1291
|
-
pointerEvents: __props.isSelected ? "none" : __props.color === "transparent" ? "visibleStroke" : "visible"
|
|
1626
|
+
pointerEvents: __props.isSelected ? "none" : __props.color === "transparent" ? "visibleStroke" : "visible"
|
|
1627
|
+
})
|
|
1628
|
+
}, null, 44, _hoisted_2$7),
|
|
1629
|
+
!__props.appearanceActive ? (openBlock(), createElementBlock("rect", {
|
|
1630
|
+
key: 0,
|
|
1631
|
+
x: geometry.value.x,
|
|
1632
|
+
y: geometry.value.y,
|
|
1633
|
+
width: geometry.value.width,
|
|
1634
|
+
height: geometry.value.height,
|
|
1635
|
+
fill: __props.color,
|
|
1636
|
+
opacity: __props.opacity,
|
|
1637
|
+
style: normalizeStyle({
|
|
1638
|
+
pointerEvents: "none",
|
|
1292
1639
|
stroke: __props.strokeColor ?? __props.color,
|
|
1293
1640
|
strokeWidth: __props.strokeWidth,
|
|
1294
1641
|
...__props.strokeStyle === unref(PdfAnnotationBorderStyle).DASHED && {
|
|
1295
1642
|
strokeDasharray: (_a = __props.strokeDashArray) == null ? void 0 : _a.join(",")
|
|
1296
1643
|
}
|
|
1297
1644
|
})
|
|
1298
|
-
}, null,
|
|
1299
|
-
], 12, _hoisted_1$
|
|
1645
|
+
}, null, 12, _hoisted_3$7)) : createCommentVNode("", true)
|
|
1646
|
+
], 12, _hoisted_1$9);
|
|
1300
1647
|
};
|
|
1301
1648
|
}
|
|
1302
1649
|
});
|
|
1303
|
-
const
|
|
1304
|
-
|
|
1305
|
-
__name: "free-text",
|
|
1650
|
+
const _sfc_main$x = /* @__PURE__ */ defineComponent({
|
|
1651
|
+
__name: "square-renderer",
|
|
1306
1652
|
props: {
|
|
1653
|
+
annotation: {},
|
|
1654
|
+
currentObject: {},
|
|
1307
1655
|
isSelected: { type: Boolean },
|
|
1308
1656
|
isEditing: { type: Boolean },
|
|
1309
|
-
|
|
1657
|
+
scale: {},
|
|
1310
1658
|
pageIndex: {},
|
|
1659
|
+
documentId: {},
|
|
1660
|
+
onClick: { type: Function },
|
|
1661
|
+
appearanceActive: { type: Boolean }
|
|
1662
|
+
},
|
|
1663
|
+
setup(__props) {
|
|
1664
|
+
return (_ctx, _cache) => {
|
|
1665
|
+
return openBlock(), createBlock(_sfc_main$y, mergeProps(__props.currentObject, {
|
|
1666
|
+
isSelected: __props.isSelected,
|
|
1667
|
+
scale: __props.scale,
|
|
1668
|
+
onClick: __props.onClick,
|
|
1669
|
+
appearanceActive: __props.appearanceActive
|
|
1670
|
+
}), null, 16, ["isSelected", "scale", "onClick", "appearanceActive"]);
|
|
1671
|
+
};
|
|
1672
|
+
}
|
|
1673
|
+
});
|
|
1674
|
+
const _hoisted_1$8 = ["width", "height", "viewBox"];
|
|
1675
|
+
const _hoisted_2$6 = ["cx", "cy", "rx", "ry", "stroke-width"];
|
|
1676
|
+
const _hoisted_3$6 = ["cx", "cy", "rx", "ry", "fill", "opacity"];
|
|
1677
|
+
const __default__$b = { inheritAttrs: false };
|
|
1678
|
+
const _sfc_main$w = /* @__PURE__ */ defineComponent({
|
|
1679
|
+
...__default__$b,
|
|
1680
|
+
__name: "circle",
|
|
1681
|
+
props: {
|
|
1682
|
+
isSelected: { type: Boolean },
|
|
1683
|
+
color: { default: "#000000" },
|
|
1684
|
+
strokeColor: {},
|
|
1685
|
+
opacity: { default: 1 },
|
|
1686
|
+
strokeWidth: {},
|
|
1687
|
+
strokeStyle: { default: PdfAnnotationBorderStyle.SOLID },
|
|
1688
|
+
strokeDashArray: {},
|
|
1689
|
+
rect: {},
|
|
1311
1690
|
scale: {},
|
|
1312
|
-
onClick: {
|
|
1691
|
+
onClick: {},
|
|
1692
|
+
appearanceActive: { type: Boolean, default: false }
|
|
1313
1693
|
},
|
|
1314
1694
|
setup(__props) {
|
|
1695
|
+
const MIN_HIT_AREA_SCREEN_PX = 20;
|
|
1315
1696
|
const props = __props;
|
|
1316
|
-
const
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
const nav = navigator;
|
|
1322
|
-
isIOS.value = /iPad|iPhone|iPod/.test(navigator.userAgent) || navigator.platform === "MacIntel" && (nav == null ? void 0 : nav.maxTouchPoints) > 1;
|
|
1323
|
-
} catch {
|
|
1324
|
-
isIOS.value = false;
|
|
1325
|
-
}
|
|
1326
|
-
});
|
|
1327
|
-
watch(
|
|
1328
|
-
() => props.isEditing,
|
|
1329
|
-
(editing) => {
|
|
1330
|
-
if (editing && editorRef.value) {
|
|
1331
|
-
const editor = editorRef.value;
|
|
1332
|
-
editor.focus();
|
|
1333
|
-
const selection = window.getSelection();
|
|
1334
|
-
if (selection) {
|
|
1335
|
-
const range = document.createRange();
|
|
1336
|
-
range.selectNodeContents(editor);
|
|
1337
|
-
range.collapse(false);
|
|
1338
|
-
selection.removeAllRanges();
|
|
1339
|
-
selection.addRange(range);
|
|
1340
|
-
}
|
|
1341
|
-
}
|
|
1342
|
-
}
|
|
1343
|
-
);
|
|
1344
|
-
const handleBlur = () => {
|
|
1345
|
-
if (!annotationProvides.value || !editorRef.value) return;
|
|
1346
|
-
annotationProvides.value.updateAnnotation(props.pageIndex, props.annotation.object.id, {
|
|
1347
|
-
contents: editorRef.value.innerText
|
|
1348
|
-
});
|
|
1349
|
-
};
|
|
1350
|
-
const editorStyle = computed(() => {
|
|
1351
|
-
const { object: anno } = props.annotation;
|
|
1352
|
-
const computedFontPx = anno.fontSize * props.scale;
|
|
1353
|
-
const MIN_IOS_FOCUS_FONT_PX = 16;
|
|
1354
|
-
const needsComp = isIOS.value && props.isEditing && computedFontPx > 0 && computedFontPx < MIN_IOS_FOCUS_FONT_PX;
|
|
1355
|
-
const adjustedFontPx = needsComp ? MIN_IOS_FOCUS_FONT_PX : computedFontPx;
|
|
1356
|
-
const scaleComp = needsComp ? computedFontPx / MIN_IOS_FOCUS_FONT_PX : 1;
|
|
1357
|
-
const invScalePercent = needsComp ? 100 / scaleComp : 100;
|
|
1697
|
+
const geometry = computed(() => {
|
|
1698
|
+
const outerW = props.rect.size.width;
|
|
1699
|
+
const outerH = props.rect.size.height;
|
|
1700
|
+
const innerW = Math.max(outerW - props.strokeWidth, 0);
|
|
1701
|
+
const innerH = Math.max(outerH - props.strokeWidth, 0);
|
|
1358
1702
|
return {
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
display: "flex",
|
|
1366
|
-
backgroundColor: anno.color ?? anno.backgroundColor,
|
|
1367
|
-
opacity: anno.opacity,
|
|
1368
|
-
width: needsComp ? `${invScalePercent}%` : "100%",
|
|
1369
|
-
height: needsComp ? `${invScalePercent}%` : "100%",
|
|
1370
|
-
lineHeight: "1.18",
|
|
1371
|
-
overflow: "hidden",
|
|
1372
|
-
cursor: props.isEditing ? "text" : "pointer",
|
|
1373
|
-
outline: "none",
|
|
1374
|
-
transform: needsComp ? `scale(${scaleComp})` : void 0,
|
|
1375
|
-
transformOrigin: "top left"
|
|
1703
|
+
width: outerW,
|
|
1704
|
+
height: outerH,
|
|
1705
|
+
cx: props.strokeWidth / 2 + innerW / 2,
|
|
1706
|
+
cy: props.strokeWidth / 2 + innerH / 2,
|
|
1707
|
+
rx: innerW / 2,
|
|
1708
|
+
ry: innerH / 2
|
|
1376
1709
|
};
|
|
1377
1710
|
});
|
|
1711
|
+
const svgWidth = computed(() => geometry.value.width * props.scale);
|
|
1712
|
+
const svgHeight = computed(() => geometry.value.height * props.scale);
|
|
1713
|
+
const hitStrokeWidth = computed(
|
|
1714
|
+
() => Math.max(props.strokeWidth, MIN_HIT_AREA_SCREEN_PX / props.scale)
|
|
1715
|
+
);
|
|
1378
1716
|
return (_ctx, _cache) => {
|
|
1379
|
-
|
|
1717
|
+
var _a;
|
|
1718
|
+
return openBlock(), createElementBlock("svg", {
|
|
1380
1719
|
style: normalizeStyle({
|
|
1381
1720
|
position: "absolute",
|
|
1382
|
-
width:
|
|
1383
|
-
height:
|
|
1384
|
-
|
|
1385
|
-
pointerEvents: __props.isSelected && !__props.isEditing ? "none" : "auto",
|
|
1721
|
+
width: svgWidth.value,
|
|
1722
|
+
height: svgHeight.value,
|
|
1723
|
+
pointerEvents: "none",
|
|
1386
1724
|
zIndex: 2
|
|
1387
1725
|
}),
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1726
|
+
width: svgWidth.value,
|
|
1727
|
+
height: svgHeight.value,
|
|
1728
|
+
viewBox: `0 0 ${geometry.value.width} ${geometry.value.height}`,
|
|
1729
|
+
overflow: "visible"
|
|
1392
1730
|
}, [
|
|
1393
|
-
createElementVNode("
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1731
|
+
createElementVNode("ellipse", {
|
|
1732
|
+
cx: geometry.value.cx,
|
|
1733
|
+
cy: geometry.value.cy,
|
|
1734
|
+
rx: geometry.value.rx,
|
|
1735
|
+
ry: geometry.value.ry,
|
|
1736
|
+
fill: "transparent",
|
|
1737
|
+
stroke: "transparent",
|
|
1738
|
+
"stroke-width": hitStrokeWidth.value,
|
|
1739
|
+
onPointerdown: _cache[0] || (_cache[0] = //@ts-ignore
|
|
1740
|
+
(...args) => __props.onClick && __props.onClick(...args)),
|
|
1741
|
+
style: normalizeStyle({
|
|
1742
|
+
cursor: __props.isSelected ? "move" : "pointer",
|
|
1743
|
+
pointerEvents: __props.isSelected ? "none" : __props.color === "transparent" ? "visibleStroke" : "visible"
|
|
1744
|
+
})
|
|
1745
|
+
}, null, 44, _hoisted_2$6),
|
|
1746
|
+
!__props.appearanceActive ? (openBlock(), createElementBlock("ellipse", {
|
|
1747
|
+
key: 0,
|
|
1748
|
+
cx: geometry.value.cx,
|
|
1749
|
+
cy: geometry.value.cy,
|
|
1750
|
+
rx: geometry.value.rx,
|
|
1751
|
+
ry: geometry.value.ry,
|
|
1752
|
+
fill: __props.color,
|
|
1753
|
+
opacity: __props.opacity,
|
|
1754
|
+
style: normalizeStyle({
|
|
1755
|
+
pointerEvents: "none",
|
|
1756
|
+
stroke: __props.strokeColor ?? __props.color,
|
|
1757
|
+
strokeWidth: __props.strokeWidth,
|
|
1758
|
+
...__props.strokeStyle === unref(PdfAnnotationBorderStyle).DASHED && {
|
|
1759
|
+
strokeDasharray: (_a = __props.strokeDashArray) == null ? void 0 : _a.join(",")
|
|
1760
|
+
}
|
|
1761
|
+
})
|
|
1762
|
+
}, null, 12, _hoisted_3$6)) : createCommentVNode("", true)
|
|
1763
|
+
], 12, _hoisted_1$8);
|
|
1402
1764
|
};
|
|
1403
1765
|
}
|
|
1404
1766
|
});
|
|
1405
|
-
const
|
|
1406
|
-
|
|
1407
|
-
const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
1408
|
-
__name: "ink",
|
|
1767
|
+
const _sfc_main$v = /* @__PURE__ */ defineComponent({
|
|
1768
|
+
__name: "circle-renderer",
|
|
1409
1769
|
props: {
|
|
1770
|
+
annotation: {},
|
|
1771
|
+
currentObject: {},
|
|
1410
1772
|
isSelected: { type: Boolean },
|
|
1411
|
-
|
|
1412
|
-
opacity: { default: 1 },
|
|
1413
|
-
strokeWidth: {},
|
|
1414
|
-
inkList: {},
|
|
1415
|
-
rect: {},
|
|
1773
|
+
isEditing: { type: Boolean },
|
|
1416
1774
|
scale: {},
|
|
1417
|
-
|
|
1775
|
+
pageIndex: {},
|
|
1776
|
+
documentId: {},
|
|
1777
|
+
onClick: { type: Function },
|
|
1778
|
+
appearanceActive: { type: Boolean }
|
|
1418
1779
|
},
|
|
1419
1780
|
setup(__props) {
|
|
1420
|
-
const props = __props;
|
|
1421
|
-
const resolvedColor = computed(() => props.strokeColor ?? "#000000");
|
|
1422
|
-
const paths = computed(() => {
|
|
1423
|
-
return props.inkList.map(({ points }) => {
|
|
1424
|
-
let d = "";
|
|
1425
|
-
points.forEach(({ x, y }, i) => {
|
|
1426
|
-
const lx = x - props.rect.origin.x;
|
|
1427
|
-
const ly = y - props.rect.origin.y;
|
|
1428
|
-
d += (i === 0 ? "M" : "L") + `${lx} ${ly} `;
|
|
1429
|
-
});
|
|
1430
|
-
return d.trim();
|
|
1431
|
-
});
|
|
1432
|
-
});
|
|
1433
|
-
const width = computed(() => props.rect.size.width * props.scale);
|
|
1434
|
-
const height = computed(() => props.rect.size.height * props.scale);
|
|
1435
1781
|
return (_ctx, _cache) => {
|
|
1436
|
-
return openBlock(),
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
zIndex: 2,
|
|
1443
|
-
overflow: "visible"
|
|
1444
|
-
}),
|
|
1445
|
-
width: width.value,
|
|
1446
|
-
height: height.value,
|
|
1447
|
-
viewBox: `0 0 ${__props.rect.size.width} ${__props.rect.size.height}`
|
|
1448
|
-
}, [
|
|
1449
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(paths.value, (d, i) => {
|
|
1450
|
-
return openBlock(), createElementBlock("path", {
|
|
1451
|
-
key: i,
|
|
1452
|
-
d,
|
|
1453
|
-
fill: "none",
|
|
1454
|
-
opacity: __props.opacity,
|
|
1455
|
-
onPointerdown: _cache[0] || (_cache[0] = //@ts-ignore
|
|
1456
|
-
(...args) => __props.onClick && __props.onClick(...args)),
|
|
1457
|
-
onTouchstart: _cache[1] || (_cache[1] = //@ts-ignore
|
|
1458
|
-
(...args) => __props.onClick && __props.onClick(...args)),
|
|
1459
|
-
style: normalizeStyle({
|
|
1460
|
-
cursor: __props.isSelected ? "move" : "pointer",
|
|
1461
|
-
pointerEvents: __props.isSelected ? "none" : "visibleStroke",
|
|
1462
|
-
stroke: resolvedColor.value,
|
|
1463
|
-
strokeWidth: __props.strokeWidth,
|
|
1464
|
-
strokeLinecap: "round",
|
|
1465
|
-
strokeLinejoin: "round"
|
|
1466
|
-
})
|
|
1467
|
-
}, null, 44, _hoisted_2$5);
|
|
1468
|
-
}), 128))
|
|
1469
|
-
], 12, _hoisted_1$6);
|
|
1782
|
+
return openBlock(), createBlock(_sfc_main$w, mergeProps(__props.currentObject, {
|
|
1783
|
+
isSelected: __props.isSelected,
|
|
1784
|
+
scale: __props.scale,
|
|
1785
|
+
onClick: __props.onClick,
|
|
1786
|
+
appearanceActive: __props.appearanceActive
|
|
1787
|
+
}), null, 16, ["isSelected", "scale", "onClick", "appearanceActive"]);
|
|
1470
1788
|
};
|
|
1471
1789
|
}
|
|
1472
1790
|
});
|
|
1473
|
-
const _hoisted_1$
|
|
1474
|
-
const _hoisted_2$
|
|
1475
|
-
const _hoisted_3$
|
|
1476
|
-
const _hoisted_4$
|
|
1477
|
-
const
|
|
1791
|
+
const _hoisted_1$7 = ["width", "height", "viewBox"];
|
|
1792
|
+
const _hoisted_2$5 = ["x1", "y1", "x2", "y2", "stroke-width"];
|
|
1793
|
+
const _hoisted_3$5 = ["d", "transform", "stroke-width"];
|
|
1794
|
+
const _hoisted_4$4 = ["d", "transform", "stroke-width"];
|
|
1795
|
+
const _hoisted_5$3 = ["x1", "y1", "x2", "y2", "opacity"];
|
|
1796
|
+
const _hoisted_6$1 = ["d", "transform", "stroke", "fill"];
|
|
1797
|
+
const _hoisted_7$1 = ["d", "transform", "stroke", "fill"];
|
|
1798
|
+
const __default__$a = { inheritAttrs: false };
|
|
1799
|
+
const _sfc_main$u = /* @__PURE__ */ defineComponent({
|
|
1800
|
+
...__default__$a,
|
|
1478
1801
|
__name: "line",
|
|
1479
1802
|
props: {
|
|
1480
1803
|
color: { default: "transparent" },
|
|
@@ -1488,9 +1811,11 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
|
1488
1811
|
lineEndings: {},
|
|
1489
1812
|
scale: {},
|
|
1490
1813
|
onClick: {},
|
|
1491
|
-
isSelected: { type: Boolean }
|
|
1814
|
+
isSelected: { type: Boolean },
|
|
1815
|
+
appearanceActive: { type: Boolean, default: false }
|
|
1492
1816
|
},
|
|
1493
1817
|
setup(__props) {
|
|
1818
|
+
const MIN_HIT_AREA_SCREEN_PX = 20;
|
|
1494
1819
|
const props = __props;
|
|
1495
1820
|
const localLine = computed(() => ({
|
|
1496
1821
|
x1: props.linePoints.start.x - props.rect.origin.x,
|
|
@@ -1513,22 +1838,13 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
|
1513
1838
|
end: patching.createEnding((_b = props.lineEndings) == null ? void 0 : _b.end, props.strokeWidth, angle, x2, y2)
|
|
1514
1839
|
};
|
|
1515
1840
|
});
|
|
1516
|
-
const getEndingStyle = (ending) => {
|
|
1517
|
-
var _a;
|
|
1518
|
-
return {
|
|
1519
|
-
cursor: props.isSelected ? "move" : "pointer",
|
|
1520
|
-
strokeWidth: props.strokeWidth,
|
|
1521
|
-
strokeLinecap: "butt",
|
|
1522
|
-
pointerEvents: props.isSelected ? "none" : ending.filled ? "visible" : "visibleStroke",
|
|
1523
|
-
...props.strokeStyle === PdfAnnotationBorderStyle.DASHED && {
|
|
1524
|
-
strokeDasharray: (_a = props.strokeDashArray) == null ? void 0 : _a.join(",")
|
|
1525
|
-
}
|
|
1526
|
-
};
|
|
1527
|
-
};
|
|
1528
1841
|
const width = computed(() => props.rect.size.width * props.scale);
|
|
1529
1842
|
const height = computed(() => props.rect.size.height * props.scale);
|
|
1843
|
+
const hitStrokeWidth = computed(
|
|
1844
|
+
() => Math.max(props.strokeWidth, MIN_HIT_AREA_SCREEN_PX / props.scale)
|
|
1845
|
+
);
|
|
1530
1846
|
return (_ctx, _cache) => {
|
|
1531
|
-
var _a;
|
|
1847
|
+
var _a, _b, _c;
|
|
1532
1848
|
return openBlock(), createElementBlock("svg", {
|
|
1533
1849
|
style: normalizeStyle({
|
|
1534
1850
|
position: "absolute",
|
|
@@ -1547,145 +1863,133 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
|
1547
1863
|
y1: localLine.value.y1,
|
|
1548
1864
|
x2: localLine.value.x2,
|
|
1549
1865
|
y2: localLine.value.y2,
|
|
1550
|
-
|
|
1866
|
+
stroke: "transparent",
|
|
1867
|
+
"stroke-width": hitStrokeWidth.value,
|
|
1551
1868
|
onPointerdown: _cache[0] || (_cache[0] = //@ts-ignore
|
|
1552
1869
|
(...args) => __props.onClick && __props.onClick(...args)),
|
|
1553
|
-
onTouchstart: _cache[1] || (_cache[1] = //@ts-ignore
|
|
1554
|
-
(...args) => __props.onClick && __props.onClick(...args)),
|
|
1555
1870
|
style: normalizeStyle({
|
|
1556
1871
|
cursor: __props.isSelected ? "move" : "pointer",
|
|
1557
1872
|
pointerEvents: __props.isSelected ? "none" : "visibleStroke",
|
|
1558
|
-
|
|
1559
|
-
strokeWidth: __props.strokeWidth,
|
|
1560
|
-
strokeLinecap: "butt",
|
|
1561
|
-
...__props.strokeStyle === unref(PdfAnnotationBorderStyle).DASHED && {
|
|
1562
|
-
strokeDasharray: (_a = __props.strokeDashArray) == null ? void 0 : _a.join(",")
|
|
1563
|
-
}
|
|
1873
|
+
strokeLinecap: "butt"
|
|
1564
1874
|
})
|
|
1565
|
-
}, null, 44, _hoisted_2$
|
|
1875
|
+
}, null, 44, _hoisted_2$5),
|
|
1566
1876
|
endings.value.start ? (openBlock(), createElementBlock("path", {
|
|
1567
1877
|
key: 0,
|
|
1568
1878
|
d: endings.value.start.d,
|
|
1569
1879
|
transform: endings.value.start.transform,
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1880
|
+
fill: "transparent",
|
|
1881
|
+
stroke: "transparent",
|
|
1882
|
+
"stroke-width": hitStrokeWidth.value,
|
|
1883
|
+
onPointerdown: _cache[1] || (_cache[1] = //@ts-ignore
|
|
1573
1884
|
(...args) => __props.onClick && __props.onClick(...args)),
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1885
|
+
style: normalizeStyle({
|
|
1886
|
+
cursor: __props.isSelected ? "move" : "pointer",
|
|
1887
|
+
pointerEvents: __props.isSelected ? "none" : endings.value.start.filled ? "visible" : "visibleStroke",
|
|
1888
|
+
strokeLinecap: "butt"
|
|
1889
|
+
})
|
|
1890
|
+
}, null, 44, _hoisted_3$5)) : createCommentVNode("", true),
|
|
1578
1891
|
endings.value.end ? (openBlock(), createElementBlock("path", {
|
|
1579
1892
|
key: 1,
|
|
1580
1893
|
d: endings.value.end.d,
|
|
1581
1894
|
transform: endings.value.end.transform,
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1895
|
+
fill: "transparent",
|
|
1896
|
+
stroke: "transparent",
|
|
1897
|
+
"stroke-width": hitStrokeWidth.value,
|
|
1898
|
+
onPointerdown: _cache[2] || (_cache[2] = //@ts-ignore
|
|
1585
1899
|
(...args) => __props.onClick && __props.onClick(...args)),
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1900
|
+
style: normalizeStyle({
|
|
1901
|
+
cursor: __props.isSelected ? "move" : "pointer",
|
|
1902
|
+
pointerEvents: __props.isSelected ? "none" : endings.value.end.filled ? "visible" : "visibleStroke",
|
|
1903
|
+
strokeLinecap: "butt"
|
|
1904
|
+
})
|
|
1905
|
+
}, null, 44, _hoisted_4$4)) : createCommentVNode("", true),
|
|
1906
|
+
!__props.appearanceActive ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
|
|
1907
|
+
createElementVNode("line", {
|
|
1908
|
+
x1: localLine.value.x1,
|
|
1909
|
+
y1: localLine.value.y1,
|
|
1910
|
+
x2: localLine.value.x2,
|
|
1911
|
+
y2: localLine.value.y2,
|
|
1912
|
+
opacity: __props.opacity,
|
|
1913
|
+
style: normalizeStyle({
|
|
1914
|
+
pointerEvents: "none",
|
|
1915
|
+
stroke: __props.strokeColor,
|
|
1916
|
+
strokeWidth: __props.strokeWidth,
|
|
1917
|
+
strokeLinecap: "butt",
|
|
1918
|
+
...__props.strokeStyle === unref(PdfAnnotationBorderStyle).DASHED && {
|
|
1919
|
+
strokeDasharray: (_a = __props.strokeDashArray) == null ? void 0 : _a.join(",")
|
|
1920
|
+
}
|
|
1921
|
+
})
|
|
1922
|
+
}, null, 12, _hoisted_5$3),
|
|
1923
|
+
endings.value.start ? (openBlock(), createElementBlock("path", {
|
|
1924
|
+
key: 0,
|
|
1925
|
+
d: endings.value.start.d,
|
|
1926
|
+
transform: endings.value.start.transform,
|
|
1927
|
+
stroke: __props.strokeColor,
|
|
1928
|
+
fill: endings.value.start.filled ? __props.color : "none",
|
|
1929
|
+
style: normalizeStyle({
|
|
1930
|
+
pointerEvents: "none",
|
|
1931
|
+
strokeWidth: __props.strokeWidth,
|
|
1932
|
+
strokeLinecap: "butt",
|
|
1933
|
+
...__props.strokeStyle === unref(PdfAnnotationBorderStyle).DASHED && {
|
|
1934
|
+
strokeDasharray: (_b = __props.strokeDashArray) == null ? void 0 : _b.join(",")
|
|
1935
|
+
}
|
|
1936
|
+
})
|
|
1937
|
+
}, null, 12, _hoisted_6$1)) : createCommentVNode("", true),
|
|
1938
|
+
endings.value.end ? (openBlock(), createElementBlock("path", {
|
|
1939
|
+
key: 1,
|
|
1940
|
+
d: endings.value.end.d,
|
|
1941
|
+
transform: endings.value.end.transform,
|
|
1942
|
+
stroke: __props.strokeColor,
|
|
1943
|
+
fill: endings.value.end.filled ? __props.color : "none",
|
|
1944
|
+
style: normalizeStyle({
|
|
1945
|
+
pointerEvents: "none",
|
|
1946
|
+
strokeWidth: __props.strokeWidth,
|
|
1947
|
+
strokeLinecap: "butt",
|
|
1948
|
+
...__props.strokeStyle === unref(PdfAnnotationBorderStyle).DASHED && {
|
|
1949
|
+
strokeDasharray: (_c = __props.strokeDashArray) == null ? void 0 : _c.join(",")
|
|
1950
|
+
}
|
|
1951
|
+
})
|
|
1952
|
+
}, null, 12, _hoisted_7$1)) : createCommentVNode("", true)
|
|
1953
|
+
], 64)) : createCommentVNode("", true)
|
|
1954
|
+
], 12, _hoisted_1$7);
|
|
1591
1955
|
};
|
|
1592
1956
|
}
|
|
1593
1957
|
});
|
|
1594
|
-
const
|
|
1595
|
-
|
|
1596
|
-
const _hoisted_3$2 = ["y1", "x2", "y2", "stroke", "stroke-width", "stroke-dasharray"];
|
|
1597
|
-
const _hoisted_4$2 = ["x", "y", "width", "height", "stroke", "stroke-width", "stroke-dasharray"];
|
|
1598
|
-
const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
1599
|
-
__name: "link",
|
|
1958
|
+
const _sfc_main$t = /* @__PURE__ */ defineComponent({
|
|
1959
|
+
__name: "line-renderer",
|
|
1600
1960
|
props: {
|
|
1961
|
+
annotation: {},
|
|
1962
|
+
currentObject: {},
|
|
1601
1963
|
isSelected: { type: Boolean },
|
|
1602
|
-
|
|
1603
|
-
strokeWidth: { default: 2 },
|
|
1604
|
-
strokeStyle: { default: PdfAnnotationBorderStyle.UNDERLINE },
|
|
1605
|
-
strokeDashArray: {},
|
|
1606
|
-
rect: {},
|
|
1964
|
+
isEditing: { type: Boolean },
|
|
1607
1965
|
scale: {},
|
|
1608
|
-
|
|
1609
|
-
|
|
1966
|
+
pageIndex: {},
|
|
1967
|
+
documentId: {},
|
|
1968
|
+
onClick: { type: Function },
|
|
1969
|
+
appearanceActive: { type: Boolean }
|
|
1610
1970
|
},
|
|
1611
1971
|
setup(__props) {
|
|
1612
|
-
const props = __props;
|
|
1613
|
-
const width = computed(() => props.rect.size.width);
|
|
1614
|
-
const height = computed(() => props.rect.size.height);
|
|
1615
|
-
const svgWidth = computed(() => width.value * props.scale);
|
|
1616
|
-
const svgHeight = computed(() => height.value * props.scale);
|
|
1617
|
-
const dashArray = computed(() => {
|
|
1618
|
-
var _a;
|
|
1619
|
-
if (props.strokeStyle === PdfAnnotationBorderStyle.DASHED) {
|
|
1620
|
-
return ((_a = props.strokeDashArray) == null ? void 0 : _a.join(",")) ?? `${props.strokeWidth * 3},${props.strokeWidth}`;
|
|
1621
|
-
}
|
|
1622
|
-
return void 0;
|
|
1623
|
-
});
|
|
1624
|
-
const isUnderline2 = computed(() => props.strokeStyle === PdfAnnotationBorderStyle.UNDERLINE);
|
|
1625
|
-
const hitAreaCursor = computed(
|
|
1626
|
-
() => props.hasIRT ? "default" : props.isSelected ? "move" : "pointer"
|
|
1627
|
-
);
|
|
1628
|
-
const hitAreaPointerEvents = computed(
|
|
1629
|
-
() => props.hasIRT ? "none" : props.isSelected ? "none" : "visible"
|
|
1630
|
-
);
|
|
1631
1972
|
return (_ctx, _cache) => {
|
|
1632
|
-
return openBlock(),
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
zIndex: 2
|
|
1639
|
-
}),
|
|
1640
|
-
width: svgWidth.value,
|
|
1641
|
-
height: svgHeight.value,
|
|
1642
|
-
viewBox: `0 0 ${width.value} ${height.value}`
|
|
1643
|
-
}, [
|
|
1644
|
-
createElementVNode("rect", {
|
|
1645
|
-
x: 0,
|
|
1646
|
-
y: 0,
|
|
1647
|
-
width: width.value,
|
|
1648
|
-
height: height.value,
|
|
1649
|
-
fill: "transparent",
|
|
1650
|
-
onPointerdown: _cache[0] || (_cache[0] = ($event) => __props.hasIRT ? void 0 : __props.onClick),
|
|
1651
|
-
onTouchstart: _cache[1] || (_cache[1] = ($event) => __props.hasIRT ? void 0 : __props.onClick),
|
|
1652
|
-
style: normalizeStyle({
|
|
1653
|
-
cursor: hitAreaCursor.value,
|
|
1654
|
-
pointerEvents: hitAreaPointerEvents.value
|
|
1655
|
-
})
|
|
1656
|
-
}, null, 44, _hoisted_2$3),
|
|
1657
|
-
isUnderline2.value ? (openBlock(), createElementBlock("line", {
|
|
1658
|
-
key: 0,
|
|
1659
|
-
x1: 1,
|
|
1660
|
-
y1: height.value - 1,
|
|
1661
|
-
x2: width.value - 1,
|
|
1662
|
-
y2: height.value - 1,
|
|
1663
|
-
stroke: __props.strokeColor,
|
|
1664
|
-
"stroke-width": __props.strokeWidth,
|
|
1665
|
-
"stroke-dasharray": dashArray.value,
|
|
1666
|
-
style: { "pointer-events": "none" }
|
|
1667
|
-
}, null, 8, _hoisted_3$2)) : (openBlock(), createElementBlock("rect", {
|
|
1668
|
-
key: 1,
|
|
1669
|
-
x: __props.strokeWidth / 2,
|
|
1670
|
-
y: __props.strokeWidth / 2,
|
|
1671
|
-
width: Math.max(width.value - __props.strokeWidth, 0),
|
|
1672
|
-
height: Math.max(height.value - __props.strokeWidth, 0),
|
|
1673
|
-
fill: "transparent",
|
|
1674
|
-
stroke: __props.strokeColor,
|
|
1675
|
-
"stroke-width": __props.strokeWidth,
|
|
1676
|
-
"stroke-dasharray": dashArray.value,
|
|
1677
|
-
style: { "pointer-events": "none" }
|
|
1678
|
-
}, null, 8, _hoisted_4$2))
|
|
1679
|
-
], 12, _hoisted_1$4);
|
|
1973
|
+
return openBlock(), createBlock(_sfc_main$u, mergeProps(__props.currentObject, {
|
|
1974
|
+
isSelected: __props.isSelected,
|
|
1975
|
+
scale: __props.scale,
|
|
1976
|
+
onClick: __props.onClick,
|
|
1977
|
+
appearanceActive: __props.appearanceActive
|
|
1978
|
+
}), null, 16, ["isSelected", "scale", "onClick", "appearanceActive"]);
|
|
1680
1979
|
};
|
|
1681
1980
|
}
|
|
1682
1981
|
});
|
|
1683
|
-
const _hoisted_1$
|
|
1684
|
-
const _hoisted_2$
|
|
1685
|
-
const _hoisted_3$
|
|
1686
|
-
const _hoisted_4$
|
|
1687
|
-
const
|
|
1688
|
-
|
|
1982
|
+
const _hoisted_1$6 = ["width", "height", "viewBox"];
|
|
1983
|
+
const _hoisted_2$4 = ["d", "stroke-width"];
|
|
1984
|
+
const _hoisted_3$4 = ["d", "transform", "stroke-width"];
|
|
1985
|
+
const _hoisted_4$3 = ["d", "transform", "stroke-width"];
|
|
1986
|
+
const _hoisted_5$2 = ["d", "opacity"];
|
|
1987
|
+
const _hoisted_6 = ["d", "transform", "stroke", "fill"];
|
|
1988
|
+
const _hoisted_7 = ["d", "transform", "stroke", "fill"];
|
|
1989
|
+
const __default__$9 = { inheritAttrs: false };
|
|
1990
|
+
const _sfc_main$s = /* @__PURE__ */ defineComponent({
|
|
1991
|
+
...__default__$9,
|
|
1992
|
+
__name: "polyline",
|
|
1689
1993
|
props: {
|
|
1690
1994
|
rect: {},
|
|
1691
1995
|
vertices: {},
|
|
@@ -1698,109 +2002,11 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
1698
2002
|
scale: {},
|
|
1699
2003
|
isSelected: { type: Boolean },
|
|
1700
2004
|
onClick: {},
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
},
|
|
1704
|
-
setup(__props) {
|
|
1705
|
-
const props = __props;
|
|
1706
|
-
const allPoints = computed(
|
|
1707
|
-
() => props.currentVertex ? [...props.vertices, props.currentVertex] : props.vertices
|
|
1708
|
-
);
|
|
1709
|
-
const localPts = computed(
|
|
1710
|
-
() => allPoints.value.map(({ x, y }) => ({
|
|
1711
|
-
x: x - props.rect.origin.x,
|
|
1712
|
-
y: y - props.rect.origin.y
|
|
1713
|
-
}))
|
|
1714
|
-
);
|
|
1715
|
-
const pathData = computed(() => {
|
|
1716
|
-
if (!localPts.value.length) return "";
|
|
1717
|
-
const [first, ...rest] = localPts.value;
|
|
1718
|
-
const isPreview = !!props.currentVertex;
|
|
1719
|
-
return (`M ${first.x} ${first.y} ` + rest.map((p) => `L ${p.x} ${p.y}`).join(" ") + (isPreview ? "" : " Z")).trim();
|
|
1720
|
-
});
|
|
1721
|
-
const isPreviewing = computed(() => props.currentVertex && props.vertices.length > 0);
|
|
1722
|
-
const width = computed(() => props.rect.size.width * props.scale);
|
|
1723
|
-
const height = computed(() => props.rect.size.height * props.scale);
|
|
1724
|
-
return (_ctx, _cache) => {
|
|
1725
|
-
var _a;
|
|
1726
|
-
return openBlock(), createElementBlock("svg", {
|
|
1727
|
-
style: normalizeStyle({
|
|
1728
|
-
position: "absolute",
|
|
1729
|
-
width: `${width.value}px`,
|
|
1730
|
-
height: `${height.value}px`,
|
|
1731
|
-
pointerEvents: "none",
|
|
1732
|
-
zIndex: 2,
|
|
1733
|
-
overflow: "visible"
|
|
1734
|
-
}),
|
|
1735
|
-
width: width.value,
|
|
1736
|
-
height: height.value,
|
|
1737
|
-
viewBox: `0 0 ${__props.rect.size.width} ${__props.rect.size.height}`
|
|
1738
|
-
}, [
|
|
1739
|
-
createElementVNode("path", {
|
|
1740
|
-
d: pathData.value,
|
|
1741
|
-
onPointerdown: _cache[0] || (_cache[0] = //@ts-ignore
|
|
1742
|
-
(...args) => __props.onClick && __props.onClick(...args)),
|
|
1743
|
-
onTouchstart: _cache[1] || (_cache[1] = //@ts-ignore
|
|
1744
|
-
(...args) => __props.onClick && __props.onClick(...args)),
|
|
1745
|
-
opacity: __props.opacity,
|
|
1746
|
-
style: normalizeStyle({
|
|
1747
|
-
fill: __props.currentVertex ? "none" : __props.color,
|
|
1748
|
-
stroke: __props.strokeColor ?? __props.color,
|
|
1749
|
-
strokeWidth: __props.strokeWidth,
|
|
1750
|
-
cursor: __props.isSelected ? "move" : "pointer",
|
|
1751
|
-
pointerEvents: __props.isSelected ? "none" : __props.color === "transparent" ? "visibleStroke" : "visible",
|
|
1752
|
-
strokeLinecap: "butt",
|
|
1753
|
-
strokeLinejoin: "miter",
|
|
1754
|
-
...__props.strokeStyle === unref(PdfAnnotationBorderStyle).DASHED && {
|
|
1755
|
-
strokeDasharray: (_a = __props.strokeDashArray) == null ? void 0 : _a.join(",")
|
|
1756
|
-
}
|
|
1757
|
-
})
|
|
1758
|
-
}, null, 44, _hoisted_2$2),
|
|
1759
|
-
isPreviewing.value && localPts.value.length > 1 ? (openBlock(), createElementBlock("path", {
|
|
1760
|
-
key: 0,
|
|
1761
|
-
d: `M ${localPts.value[localPts.value.length - 1].x} ${localPts.value[localPts.value.length - 1].y} L ${localPts.value[0].x} ${localPts.value[0].y}`,
|
|
1762
|
-
fill: "none",
|
|
1763
|
-
style: normalizeStyle({
|
|
1764
|
-
stroke: __props.strokeColor,
|
|
1765
|
-
strokeWidth: __props.strokeWidth,
|
|
1766
|
-
strokeDasharray: "4,4",
|
|
1767
|
-
opacity: 0.7
|
|
1768
|
-
})
|
|
1769
|
-
}, null, 12, _hoisted_3$1)) : createCommentVNode("", true),
|
|
1770
|
-
isPreviewing.value && localPts.value.length >= 2 ? (openBlock(), createElementBlock("rect", {
|
|
1771
|
-
key: 1,
|
|
1772
|
-
x: localPts.value[0].x - __props.handleSize / __props.scale / 2,
|
|
1773
|
-
y: localPts.value[0].y - __props.handleSize / __props.scale / 2,
|
|
1774
|
-
width: __props.handleSize / __props.scale,
|
|
1775
|
-
height: __props.handleSize / __props.scale,
|
|
1776
|
-
fill: __props.strokeColor,
|
|
1777
|
-
opacity: 0.4,
|
|
1778
|
-
stroke: __props.strokeColor,
|
|
1779
|
-
"stroke-width": __props.strokeWidth / 2
|
|
1780
|
-
}, null, 8, _hoisted_4$1)) : createCommentVNode("", true)
|
|
1781
|
-
], 12, _hoisted_1$3);
|
|
1782
|
-
};
|
|
1783
|
-
}
|
|
1784
|
-
});
|
|
1785
|
-
const _hoisted_1$2 = ["width", "height", "viewBox"];
|
|
1786
|
-
const _hoisted_2$1 = ["d", "opacity"];
|
|
1787
|
-
const _hoisted_3 = ["d", "transform", "stroke", "fill"];
|
|
1788
|
-
const _hoisted_4 = ["d", "transform", "stroke", "fill"];
|
|
1789
|
-
const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
1790
|
-
__name: "polyline",
|
|
1791
|
-
props: {
|
|
1792
|
-
rect: {},
|
|
1793
|
-
vertices: {},
|
|
1794
|
-
color: { default: "transparent" },
|
|
1795
|
-
strokeColor: { default: "#000000" },
|
|
1796
|
-
opacity: { default: 1 },
|
|
1797
|
-
strokeWidth: {},
|
|
1798
|
-
scale: {},
|
|
1799
|
-
isSelected: { type: Boolean },
|
|
1800
|
-
onClick: {},
|
|
1801
|
-
lineEndings: {}
|
|
2005
|
+
lineEndings: {},
|
|
2006
|
+
appearanceActive: { type: Boolean, default: false }
|
|
1802
2007
|
},
|
|
1803
2008
|
setup(__props) {
|
|
2009
|
+
const MIN_HIT_AREA_SCREEN_PX = 20;
|
|
1804
2010
|
const props = __props;
|
|
1805
2011
|
const localPts = computed(
|
|
1806
2012
|
() => props.vertices.map(({ x, y }) => ({
|
|
@@ -1839,15 +2045,13 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
1839
2045
|
)
|
|
1840
2046
|
};
|
|
1841
2047
|
});
|
|
1842
|
-
const getEndingStyle = (ending) => ({
|
|
1843
|
-
cursor: props.isSelected ? "move" : "pointer",
|
|
1844
|
-
strokeWidth: props.strokeWidth,
|
|
1845
|
-
pointerEvents: props.isSelected ? "none" : ending.filled ? "visible" : "visibleStroke",
|
|
1846
|
-
strokeLinecap: "butt"
|
|
1847
|
-
});
|
|
1848
2048
|
const width = computed(() => props.rect.size.width * props.scale);
|
|
1849
2049
|
const height = computed(() => props.rect.size.height * props.scale);
|
|
2050
|
+
const hitStrokeWidth = computed(
|
|
2051
|
+
() => Math.max(props.strokeWidth, MIN_HIT_AREA_SCREEN_PX / props.scale)
|
|
2052
|
+
);
|
|
1850
2053
|
return (_ctx, _cache) => {
|
|
2054
|
+
var _a, _b, _c;
|
|
1851
2055
|
return openBlock(), createElementBlock("svg", {
|
|
1852
2056
|
style: normalizeStyle({
|
|
1853
2057
|
position: "absolute",
|
|
@@ -1863,122 +2067,415 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
1863
2067
|
}, [
|
|
1864
2068
|
createElementVNode("path", {
|
|
1865
2069
|
d: pathData.value,
|
|
2070
|
+
fill: "none",
|
|
2071
|
+
stroke: "transparent",
|
|
2072
|
+
"stroke-width": hitStrokeWidth.value,
|
|
1866
2073
|
onPointerdown: _cache[0] || (_cache[0] = //@ts-ignore
|
|
1867
2074
|
(...args) => __props.onClick && __props.onClick(...args)),
|
|
1868
|
-
onTouchstart: _cache[1] || (_cache[1] = //@ts-ignore
|
|
1869
|
-
(...args) => __props.onClick && __props.onClick(...args)),
|
|
1870
|
-
opacity: __props.opacity,
|
|
1871
2075
|
style: normalizeStyle({
|
|
1872
|
-
fill: "none",
|
|
1873
|
-
stroke: __props.strokeColor ?? __props.color,
|
|
1874
|
-
strokeWidth: __props.strokeWidth,
|
|
1875
2076
|
cursor: __props.isSelected ? "move" : "pointer",
|
|
1876
2077
|
pointerEvents: __props.isSelected ? "none" : "visibleStroke",
|
|
1877
2078
|
strokeLinecap: "butt",
|
|
1878
2079
|
strokeLinejoin: "miter"
|
|
1879
2080
|
})
|
|
1880
|
-
}, null, 44, _hoisted_2$
|
|
2081
|
+
}, null, 44, _hoisted_2$4),
|
|
1881
2082
|
endings.value.start ? (openBlock(), createElementBlock("path", {
|
|
1882
2083
|
key: 0,
|
|
1883
2084
|
d: endings.value.start.d,
|
|
1884
2085
|
transform: endings.value.start.transform,
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
onTouchstart: _cache[3] || (_cache[3] = //@ts-ignore
|
|
2086
|
+
fill: "transparent",
|
|
2087
|
+
stroke: "transparent",
|
|
2088
|
+
"stroke-width": hitStrokeWidth.value,
|
|
2089
|
+
onPointerdown: _cache[1] || (_cache[1] = //@ts-ignore
|
|
1890
2090
|
(...args) => __props.onClick && __props.onClick(...args)),
|
|
1891
|
-
style: normalizeStyle(
|
|
1892
|
-
|
|
2091
|
+
style: normalizeStyle({
|
|
2092
|
+
cursor: __props.isSelected ? "move" : "pointer",
|
|
2093
|
+
pointerEvents: __props.isSelected ? "none" : endings.value.start.filled ? "visible" : "visibleStroke",
|
|
2094
|
+
strokeLinecap: "butt"
|
|
2095
|
+
})
|
|
2096
|
+
}, null, 44, _hoisted_3$4)) : createCommentVNode("", true),
|
|
1893
2097
|
endings.value.end ? (openBlock(), createElementBlock("path", {
|
|
1894
2098
|
key: 1,
|
|
1895
2099
|
d: endings.value.end.d,
|
|
1896
2100
|
transform: endings.value.end.transform,
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
onTouchstart: _cache[5] || (_cache[5] = //@ts-ignore
|
|
2101
|
+
fill: "transparent",
|
|
2102
|
+
stroke: "transparent",
|
|
2103
|
+
"stroke-width": hitStrokeWidth.value,
|
|
2104
|
+
onPointerdown: _cache[2] || (_cache[2] = //@ts-ignore
|
|
1902
2105
|
(...args) => __props.onClick && __props.onClick(...args)),
|
|
1903
|
-
style: normalizeStyle(
|
|
1904
|
-
|
|
1905
|
-
|
|
2106
|
+
style: normalizeStyle({
|
|
2107
|
+
cursor: __props.isSelected ? "move" : "pointer",
|
|
2108
|
+
pointerEvents: __props.isSelected ? "none" : endings.value.end.filled ? "visible" : "visibleStroke",
|
|
2109
|
+
strokeLinecap: "butt"
|
|
2110
|
+
})
|
|
2111
|
+
}, null, 44, _hoisted_4$3)) : createCommentVNode("", true),
|
|
2112
|
+
!__props.appearanceActive ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
|
|
2113
|
+
createElementVNode("path", {
|
|
2114
|
+
d: pathData.value,
|
|
2115
|
+
opacity: __props.opacity,
|
|
2116
|
+
style: normalizeStyle({
|
|
2117
|
+
fill: "none",
|
|
2118
|
+
stroke: __props.strokeColor ?? __props.color,
|
|
2119
|
+
strokeWidth: __props.strokeWidth,
|
|
2120
|
+
pointerEvents: "none",
|
|
2121
|
+
strokeLinecap: "butt",
|
|
2122
|
+
strokeLinejoin: "miter",
|
|
2123
|
+
...__props.strokeStyle === unref(PdfAnnotationBorderStyle).DASHED && {
|
|
2124
|
+
strokeDasharray: (_a = __props.strokeDashArray) == null ? void 0 : _a.join(",")
|
|
2125
|
+
}
|
|
2126
|
+
})
|
|
2127
|
+
}, null, 12, _hoisted_5$2),
|
|
2128
|
+
endings.value.start ? (openBlock(), createElementBlock("path", {
|
|
2129
|
+
key: 0,
|
|
2130
|
+
d: endings.value.start.d,
|
|
2131
|
+
transform: endings.value.start.transform,
|
|
2132
|
+
stroke: __props.strokeColor,
|
|
2133
|
+
fill: endings.value.start.filled ? __props.color : "none",
|
|
2134
|
+
style: normalizeStyle({
|
|
2135
|
+
pointerEvents: "none",
|
|
2136
|
+
strokeWidth: __props.strokeWidth,
|
|
2137
|
+
strokeLinecap: "butt",
|
|
2138
|
+
...__props.strokeStyle === unref(PdfAnnotationBorderStyle).DASHED && {
|
|
2139
|
+
strokeDasharray: (_b = __props.strokeDashArray) == null ? void 0 : _b.join(",")
|
|
2140
|
+
}
|
|
2141
|
+
})
|
|
2142
|
+
}, null, 12, _hoisted_6)) : createCommentVNode("", true),
|
|
2143
|
+
endings.value.end ? (openBlock(), createElementBlock("path", {
|
|
2144
|
+
key: 1,
|
|
2145
|
+
d: endings.value.end.d,
|
|
2146
|
+
transform: endings.value.end.transform,
|
|
2147
|
+
stroke: __props.strokeColor,
|
|
2148
|
+
fill: endings.value.end.filled ? __props.color : "none",
|
|
2149
|
+
style: normalizeStyle({
|
|
2150
|
+
pointerEvents: "none",
|
|
2151
|
+
strokeWidth: __props.strokeWidth,
|
|
2152
|
+
strokeLinecap: "butt",
|
|
2153
|
+
...__props.strokeStyle === unref(PdfAnnotationBorderStyle).DASHED && {
|
|
2154
|
+
strokeDasharray: (_c = __props.strokeDashArray) == null ? void 0 : _c.join(",")
|
|
2155
|
+
}
|
|
2156
|
+
})
|
|
2157
|
+
}, null, 12, _hoisted_7)) : createCommentVNode("", true)
|
|
2158
|
+
], 64)) : createCommentVNode("", true)
|
|
2159
|
+
], 12, _hoisted_1$6);
|
|
1906
2160
|
};
|
|
1907
2161
|
}
|
|
1908
2162
|
});
|
|
1909
|
-
const
|
|
1910
|
-
|
|
1911
|
-
const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
1912
|
-
__name: "square",
|
|
2163
|
+
const _sfc_main$r = /* @__PURE__ */ defineComponent({
|
|
2164
|
+
__name: "polyline-renderer",
|
|
1913
2165
|
props: {
|
|
2166
|
+
annotation: {},
|
|
2167
|
+
currentObject: {},
|
|
1914
2168
|
isSelected: { type: Boolean },
|
|
1915
|
-
|
|
1916
|
-
|
|
2169
|
+
isEditing: { type: Boolean },
|
|
2170
|
+
scale: {},
|
|
2171
|
+
pageIndex: {},
|
|
2172
|
+
documentId: {},
|
|
2173
|
+
onClick: { type: Function },
|
|
2174
|
+
appearanceActive: { type: Boolean }
|
|
2175
|
+
},
|
|
2176
|
+
setup(__props) {
|
|
2177
|
+
return (_ctx, _cache) => {
|
|
2178
|
+
return openBlock(), createBlock(_sfc_main$s, mergeProps(__props.currentObject, {
|
|
2179
|
+
isSelected: __props.isSelected,
|
|
2180
|
+
scale: __props.scale,
|
|
2181
|
+
onClick: __props.onClick,
|
|
2182
|
+
appearanceActive: __props.appearanceActive
|
|
2183
|
+
}), null, 16, ["isSelected", "scale", "onClick", "appearanceActive"]);
|
|
2184
|
+
};
|
|
2185
|
+
}
|
|
2186
|
+
});
|
|
2187
|
+
const _hoisted_1$5 = ["width", "height", "viewBox"];
|
|
2188
|
+
const _hoisted_2$3 = ["d", "stroke-width"];
|
|
2189
|
+
const _hoisted_3$3 = ["d", "opacity"];
|
|
2190
|
+
const _hoisted_4$2 = ["d"];
|
|
2191
|
+
const _hoisted_5$1 = ["x", "y", "width", "height", "fill", "stroke", "stroke-width"];
|
|
2192
|
+
const __default__$8 = { inheritAttrs: false };
|
|
2193
|
+
const _sfc_main$q = /* @__PURE__ */ defineComponent({
|
|
2194
|
+
...__default__$8,
|
|
2195
|
+
__name: "polygon",
|
|
2196
|
+
props: {
|
|
2197
|
+
rect: {},
|
|
2198
|
+
vertices: {},
|
|
2199
|
+
color: { default: "transparent" },
|
|
2200
|
+
strokeColor: { default: "#000000" },
|
|
1917
2201
|
opacity: { default: 1 },
|
|
1918
2202
|
strokeWidth: {},
|
|
1919
2203
|
strokeStyle: { default: PdfAnnotationBorderStyle.SOLID },
|
|
1920
2204
|
strokeDashArray: {},
|
|
1921
|
-
rect: {},
|
|
1922
2205
|
scale: {},
|
|
1923
|
-
|
|
2206
|
+
isSelected: { type: Boolean },
|
|
2207
|
+
onClick: {},
|
|
2208
|
+
currentVertex: {},
|
|
2209
|
+
handleSize: { default: 14 },
|
|
2210
|
+
appearanceActive: { type: Boolean, default: false }
|
|
1924
2211
|
},
|
|
1925
2212
|
setup(__props) {
|
|
2213
|
+
const MIN_HIT_AREA_SCREEN_PX = 20;
|
|
1926
2214
|
const props = __props;
|
|
1927
|
-
const
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
2215
|
+
const allPoints = computed(
|
|
2216
|
+
() => props.currentVertex ? [...props.vertices, props.currentVertex] : props.vertices
|
|
2217
|
+
);
|
|
2218
|
+
const localPts = computed(
|
|
2219
|
+
() => allPoints.value.map(({ x, y }) => ({
|
|
2220
|
+
x: x - props.rect.origin.x,
|
|
2221
|
+
y: y - props.rect.origin.y
|
|
2222
|
+
}))
|
|
2223
|
+
);
|
|
2224
|
+
const pathData = computed(() => {
|
|
2225
|
+
if (!localPts.value.length) return "";
|
|
2226
|
+
const [first, ...rest] = localPts.value;
|
|
2227
|
+
const isPreview = !!props.currentVertex;
|
|
2228
|
+
return (`M ${first.x} ${first.y} ` + rest.map((p) => `L ${p.x} ${p.y}`).join(" ") + (isPreview ? "" : " Z")).trim();
|
|
1938
2229
|
});
|
|
1939
|
-
const
|
|
1940
|
-
const
|
|
2230
|
+
const isPreviewing = computed(() => props.currentVertex && props.vertices.length > 0);
|
|
2231
|
+
const width = computed(() => props.rect.size.width * props.scale);
|
|
2232
|
+
const height = computed(() => props.rect.size.height * props.scale);
|
|
2233
|
+
const hitStrokeWidth = computed(
|
|
2234
|
+
() => Math.max(props.strokeWidth, MIN_HIT_AREA_SCREEN_PX / props.scale)
|
|
2235
|
+
);
|
|
1941
2236
|
return (_ctx, _cache) => {
|
|
1942
2237
|
var _a;
|
|
1943
2238
|
return openBlock(), createElementBlock("svg", {
|
|
1944
2239
|
style: normalizeStyle({
|
|
1945
2240
|
position: "absolute",
|
|
1946
|
-
width:
|
|
1947
|
-
height:
|
|
2241
|
+
width: `${width.value}px`,
|
|
2242
|
+
height: `${height.value}px`,
|
|
1948
2243
|
pointerEvents: "none",
|
|
1949
|
-
zIndex: 2
|
|
2244
|
+
zIndex: 2,
|
|
2245
|
+
overflow: "visible"
|
|
1950
2246
|
}),
|
|
1951
|
-
width:
|
|
1952
|
-
height:
|
|
1953
|
-
viewBox: `0 0 ${
|
|
2247
|
+
width: width.value,
|
|
2248
|
+
height: height.value,
|
|
2249
|
+
viewBox: `0 0 ${__props.rect.size.width} ${__props.rect.size.height}`
|
|
1954
2250
|
}, [
|
|
1955
|
-
createElementVNode("
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
fill: __props.color,
|
|
1961
|
-
opacity: __props.opacity,
|
|
2251
|
+
createElementVNode("path", {
|
|
2252
|
+
d: pathData.value,
|
|
2253
|
+
fill: "transparent",
|
|
2254
|
+
stroke: "transparent",
|
|
2255
|
+
"stroke-width": hitStrokeWidth.value,
|
|
1962
2256
|
onPointerdown: _cache[0] || (_cache[0] = //@ts-ignore
|
|
1963
2257
|
(...args) => __props.onClick && __props.onClick(...args)),
|
|
1964
|
-
onTouchstart: _cache[1] || (_cache[1] = //@ts-ignore
|
|
1965
|
-
(...args) => __props.onClick && __props.onClick(...args)),
|
|
1966
2258
|
style: normalizeStyle({
|
|
1967
2259
|
cursor: __props.isSelected ? "move" : "pointer",
|
|
1968
2260
|
pointerEvents: __props.isSelected ? "none" : __props.color === "transparent" ? "visibleStroke" : "visible",
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
...__props.strokeStyle === unref(PdfAnnotationBorderStyle).DASHED && {
|
|
1972
|
-
strokeDasharray: (_a = __props.strokeDashArray) == null ? void 0 : _a.join(",")
|
|
1973
|
-
}
|
|
2261
|
+
strokeLinecap: "butt",
|
|
2262
|
+
strokeLinejoin: "miter"
|
|
1974
2263
|
})
|
|
1975
|
-
}, null, 44, _hoisted_2)
|
|
1976
|
-
|
|
2264
|
+
}, null, 44, _hoisted_2$3),
|
|
2265
|
+
!__props.appearanceActive ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
2266
|
+
createElementVNode("path", {
|
|
2267
|
+
d: pathData.value,
|
|
2268
|
+
opacity: __props.opacity,
|
|
2269
|
+
style: normalizeStyle({
|
|
2270
|
+
fill: __props.currentVertex ? "none" : __props.color,
|
|
2271
|
+
stroke: __props.strokeColor ?? __props.color,
|
|
2272
|
+
strokeWidth: __props.strokeWidth,
|
|
2273
|
+
pointerEvents: "none",
|
|
2274
|
+
strokeLinecap: "butt",
|
|
2275
|
+
strokeLinejoin: "miter",
|
|
2276
|
+
...__props.strokeStyle === unref(PdfAnnotationBorderStyle).DASHED && {
|
|
2277
|
+
strokeDasharray: (_a = __props.strokeDashArray) == null ? void 0 : _a.join(",")
|
|
2278
|
+
}
|
|
2279
|
+
})
|
|
2280
|
+
}, null, 12, _hoisted_3$3),
|
|
2281
|
+
isPreviewing.value && localPts.value.length > 1 ? (openBlock(), createElementBlock("path", {
|
|
2282
|
+
key: 0,
|
|
2283
|
+
d: `M ${localPts.value[localPts.value.length - 1].x} ${localPts.value[localPts.value.length - 1].y} L ${localPts.value[0].x} ${localPts.value[0].y}`,
|
|
2284
|
+
fill: "none",
|
|
2285
|
+
style: normalizeStyle({
|
|
2286
|
+
stroke: __props.strokeColor,
|
|
2287
|
+
strokeWidth: __props.strokeWidth,
|
|
2288
|
+
strokeDasharray: "4,4",
|
|
2289
|
+
opacity: 0.7,
|
|
2290
|
+
pointerEvents: "none"
|
|
2291
|
+
})
|
|
2292
|
+
}, null, 12, _hoisted_4$2)) : createCommentVNode("", true),
|
|
2293
|
+
isPreviewing.value && localPts.value.length >= 2 ? (openBlock(), createElementBlock("rect", {
|
|
2294
|
+
key: 1,
|
|
2295
|
+
x: localPts.value[0].x - __props.handleSize / __props.scale / 2,
|
|
2296
|
+
y: localPts.value[0].y - __props.handleSize / __props.scale / 2,
|
|
2297
|
+
width: __props.handleSize / __props.scale,
|
|
2298
|
+
height: __props.handleSize / __props.scale,
|
|
2299
|
+
fill: __props.strokeColor,
|
|
2300
|
+
opacity: 0.4,
|
|
2301
|
+
stroke: __props.strokeColor,
|
|
2302
|
+
"stroke-width": __props.strokeWidth / 2,
|
|
2303
|
+
style: { "pointer-events": "none" }
|
|
2304
|
+
}, null, 8, _hoisted_5$1)) : createCommentVNode("", true)
|
|
2305
|
+
], 64)) : createCommentVNode("", true)
|
|
2306
|
+
], 12, _hoisted_1$5);
|
|
1977
2307
|
};
|
|
1978
2308
|
}
|
|
1979
2309
|
});
|
|
1980
|
-
const
|
|
1981
|
-
|
|
2310
|
+
const _sfc_main$p = /* @__PURE__ */ defineComponent({
|
|
2311
|
+
__name: "polygon-renderer",
|
|
2312
|
+
props: {
|
|
2313
|
+
annotation: {},
|
|
2314
|
+
currentObject: {},
|
|
2315
|
+
isSelected: { type: Boolean },
|
|
2316
|
+
isEditing: { type: Boolean },
|
|
2317
|
+
scale: {},
|
|
2318
|
+
pageIndex: {},
|
|
2319
|
+
documentId: {},
|
|
2320
|
+
onClick: { type: Function },
|
|
2321
|
+
appearanceActive: { type: Boolean }
|
|
2322
|
+
},
|
|
2323
|
+
setup(__props) {
|
|
2324
|
+
return (_ctx, _cache) => {
|
|
2325
|
+
return openBlock(), createBlock(_sfc_main$q, mergeProps(__props.currentObject, {
|
|
2326
|
+
isSelected: __props.isSelected,
|
|
2327
|
+
scale: __props.scale,
|
|
2328
|
+
onClick: __props.onClick,
|
|
2329
|
+
appearanceActive: __props.appearanceActive
|
|
2330
|
+
}), null, 16, ["isSelected", "scale", "onClick", "appearanceActive"]);
|
|
2331
|
+
};
|
|
2332
|
+
}
|
|
2333
|
+
});
|
|
2334
|
+
const _hoisted_1$4 = ["contenteditable"];
|
|
2335
|
+
const __default__$7 = { inheritAttrs: false };
|
|
2336
|
+
const _sfc_main$o = /* @__PURE__ */ defineComponent({
|
|
2337
|
+
...__default__$7,
|
|
2338
|
+
__name: "free-text",
|
|
2339
|
+
props: {
|
|
2340
|
+
documentId: {},
|
|
2341
|
+
isSelected: { type: Boolean },
|
|
2342
|
+
isEditing: { type: Boolean },
|
|
2343
|
+
annotation: {},
|
|
2344
|
+
pageIndex: {},
|
|
2345
|
+
scale: {},
|
|
2346
|
+
onClick: {},
|
|
2347
|
+
appearanceActive: { type: Boolean, default: false }
|
|
2348
|
+
},
|
|
2349
|
+
setup(__props) {
|
|
2350
|
+
const props = __props;
|
|
2351
|
+
const editorRef = ref(null);
|
|
2352
|
+
const editingRef = ref(false);
|
|
2353
|
+
const { provides: annotationCapability } = useAnnotationCapability();
|
|
2354
|
+
const annotationProvides = computed(
|
|
2355
|
+
() => {
|
|
2356
|
+
var _a;
|
|
2357
|
+
return ((_a = annotationCapability.value) == null ? void 0 : _a.forDocument(props.documentId)) ?? null;
|
|
2358
|
+
}
|
|
2359
|
+
);
|
|
2360
|
+
const isIOS = ref(false);
|
|
2361
|
+
onMounted(() => {
|
|
2362
|
+
try {
|
|
2363
|
+
const nav = navigator;
|
|
2364
|
+
isIOS.value = /iPad|iPhone|iPod/.test(navigator.userAgent) || navigator.platform === "MacIntel" && (nav == null ? void 0 : nav.maxTouchPoints) > 1;
|
|
2365
|
+
} catch {
|
|
2366
|
+
isIOS.value = false;
|
|
2367
|
+
}
|
|
2368
|
+
});
|
|
2369
|
+
watch(
|
|
2370
|
+
() => props.isEditing,
|
|
2371
|
+
(editing) => {
|
|
2372
|
+
if (editing && editorRef.value) {
|
|
2373
|
+
editingRef.value = true;
|
|
2374
|
+
const editor = editorRef.value;
|
|
2375
|
+
editor.focus();
|
|
2376
|
+
const selection = window.getSelection();
|
|
2377
|
+
if (selection) {
|
|
2378
|
+
const range = document.createRange();
|
|
2379
|
+
range.selectNodeContents(editor);
|
|
2380
|
+
range.collapse(false);
|
|
2381
|
+
selection.removeAllRanges();
|
|
2382
|
+
selection.addRange(range);
|
|
2383
|
+
}
|
|
2384
|
+
}
|
|
2385
|
+
}
|
|
2386
|
+
);
|
|
2387
|
+
const handleBlur = () => {
|
|
2388
|
+
if (!editingRef.value) return;
|
|
2389
|
+
editingRef.value = false;
|
|
2390
|
+
if (!annotationProvides.value || !editorRef.value) return;
|
|
2391
|
+
annotationProvides.value.updateAnnotation(props.pageIndex, props.annotation.object.id, {
|
|
2392
|
+
contents: editorRef.value.innerText
|
|
2393
|
+
});
|
|
2394
|
+
};
|
|
2395
|
+
const editorStyle = computed(() => {
|
|
2396
|
+
const { object: anno } = props.annotation;
|
|
2397
|
+
const computedFontPx = anno.fontSize * props.scale;
|
|
2398
|
+
const MIN_IOS_FOCUS_FONT_PX = 16;
|
|
2399
|
+
const needsComp = isIOS.value && props.isEditing && computedFontPx > 0 && computedFontPx < MIN_IOS_FOCUS_FONT_PX;
|
|
2400
|
+
const adjustedFontPx = needsComp ? MIN_IOS_FOCUS_FONT_PX : computedFontPx;
|
|
2401
|
+
const scaleComp = needsComp ? computedFontPx / MIN_IOS_FOCUS_FONT_PX : 1;
|
|
2402
|
+
const invScalePercent = needsComp ? 100 / scaleComp : 100;
|
|
2403
|
+
return {
|
|
2404
|
+
color: anno.fontColor,
|
|
2405
|
+
fontSize: `${adjustedFontPx}px`,
|
|
2406
|
+
...standardFontCssProperties(anno.fontFamily),
|
|
2407
|
+
textAlign: textAlignmentToCss(anno.textAlign),
|
|
2408
|
+
flexDirection: "column",
|
|
2409
|
+
justifyContent: anno.verticalAlign === PdfVerticalAlignment.Top ? "flex-start" : anno.verticalAlign === PdfVerticalAlignment.Middle ? "center" : "flex-end",
|
|
2410
|
+
display: "flex",
|
|
2411
|
+
backgroundColor: anno.color ?? anno.backgroundColor,
|
|
2412
|
+
opacity: anno.opacity,
|
|
2413
|
+
width: needsComp ? `${invScalePercent}%` : "100%",
|
|
2414
|
+
height: needsComp ? `${invScalePercent}%` : "100%",
|
|
2415
|
+
lineHeight: "1.18",
|
|
2416
|
+
overflow: "hidden",
|
|
2417
|
+
cursor: props.isEditing ? "text" : "pointer",
|
|
2418
|
+
outline: "none",
|
|
2419
|
+
transform: needsComp ? `scale(${scaleComp})` : void 0,
|
|
2420
|
+
transformOrigin: "top left"
|
|
2421
|
+
};
|
|
2422
|
+
});
|
|
2423
|
+
return (_ctx, _cache) => {
|
|
2424
|
+
return openBlock(), createElementBlock("div", {
|
|
2425
|
+
style: normalizeStyle({
|
|
2426
|
+
position: "absolute",
|
|
2427
|
+
width: `${__props.annotation.object.rect.size.width * __props.scale}px`,
|
|
2428
|
+
height: `${__props.annotation.object.rect.size.height * __props.scale}px`,
|
|
2429
|
+
cursor: __props.isSelected && !__props.isEditing ? "move" : "default",
|
|
2430
|
+
pointerEvents: __props.isSelected && !__props.isEditing ? "none" : "auto",
|
|
2431
|
+
zIndex: 2,
|
|
2432
|
+
opacity: __props.appearanceActive ? 0 : 1
|
|
2433
|
+
}),
|
|
2434
|
+
onPointerdown: _cache[0] || (_cache[0] = //@ts-ignore
|
|
2435
|
+
(...args) => __props.onClick && __props.onClick(...args))
|
|
2436
|
+
}, [
|
|
2437
|
+
createElementVNode("span", {
|
|
2438
|
+
ref_key: "editorRef",
|
|
2439
|
+
ref: editorRef,
|
|
2440
|
+
onBlur: handleBlur,
|
|
2441
|
+
tabindex: "0",
|
|
2442
|
+
style: normalizeStyle(editorStyle.value),
|
|
2443
|
+
contenteditable: __props.isEditing
|
|
2444
|
+
}, toDisplayString(__props.annotation.object.contents), 45, _hoisted_1$4)
|
|
2445
|
+
], 36);
|
|
2446
|
+
};
|
|
2447
|
+
}
|
|
2448
|
+
});
|
|
2449
|
+
const _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
2450
|
+
__name: "free-text-renderer",
|
|
2451
|
+
props: {
|
|
2452
|
+
annotation: {},
|
|
2453
|
+
currentObject: {},
|
|
2454
|
+
isSelected: { type: Boolean },
|
|
2455
|
+
isEditing: { type: Boolean },
|
|
2456
|
+
scale: {},
|
|
2457
|
+
pageIndex: {},
|
|
2458
|
+
documentId: {},
|
|
2459
|
+
onClick: { type: Function },
|
|
2460
|
+
appearanceActive: { type: Boolean }
|
|
2461
|
+
},
|
|
2462
|
+
setup(__props) {
|
|
2463
|
+
return (_ctx, _cache) => {
|
|
2464
|
+
return openBlock(), createBlock(_sfc_main$o, {
|
|
2465
|
+
documentId: __props.documentId,
|
|
2466
|
+
isSelected: __props.isSelected,
|
|
2467
|
+
isEditing: __props.isEditing,
|
|
2468
|
+
annotation: { ...__props.annotation, object: __props.currentObject },
|
|
2469
|
+
pageIndex: __props.pageIndex,
|
|
2470
|
+
scale: __props.scale,
|
|
2471
|
+
onClick: __props.onClick,
|
|
2472
|
+
appearanceActive: __props.appearanceActive
|
|
2473
|
+
}, null, 8, ["documentId", "isSelected", "isEditing", "annotation", "pageIndex", "scale", "onClick", "appearanceActive"]);
|
|
2474
|
+
};
|
|
2475
|
+
}
|
|
2476
|
+
});
|
|
2477
|
+
const _hoisted_1$3 = ["src"];
|
|
2478
|
+
const _sfc_main$m = /* @__PURE__ */ defineComponent({
|
|
1982
2479
|
__name: "render-annotation",
|
|
1983
2480
|
props: {
|
|
1984
2481
|
documentId: {},
|
|
@@ -2073,11 +2570,13 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
2073
2570
|
display: "block",
|
|
2074
2571
|
...__props.style
|
|
2075
2572
|
})
|
|
2076
|
-
}, null, 44, _hoisted_1)) : createCommentVNode("", true);
|
|
2573
|
+
}, null, 44, _hoisted_1$3)) : createCommentVNode("", true);
|
|
2077
2574
|
};
|
|
2078
2575
|
}
|
|
2079
2576
|
});
|
|
2080
|
-
const
|
|
2577
|
+
const __default__$6 = { inheritAttrs: false };
|
|
2578
|
+
const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
2579
|
+
...__default__$6,
|
|
2081
2580
|
__name: "stamp",
|
|
2082
2581
|
props: {
|
|
2083
2582
|
isSelected: { type: Boolean },
|
|
@@ -2103,11 +2602,9 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
2103
2602
|
cursor: "pointer"
|
|
2104
2603
|
}),
|
|
2105
2604
|
onPointerdown: _cache[0] || (_cache[0] = //@ts-ignore
|
|
2106
|
-
(...args) => __props.onClick && __props.onClick(...args)),
|
|
2107
|
-
onTouchstart: _cache[1] || (_cache[1] = //@ts-ignore
|
|
2108
2605
|
(...args) => __props.onClick && __props.onClick(...args))
|
|
2109
2606
|
}, [
|
|
2110
|
-
createVNode(_sfc_main$
|
|
2607
|
+
createVNode(_sfc_main$m, {
|
|
2111
2608
|
documentId: __props.documentId,
|
|
2112
2609
|
pageIndex: __props.pageIndex,
|
|
2113
2610
|
annotation: { ...__props.annotation.object, id: __props.annotation.object.id },
|
|
@@ -2118,80 +2615,235 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
2118
2615
|
};
|
|
2119
2616
|
}
|
|
2120
2617
|
});
|
|
2121
|
-
const _sfc_main$
|
|
2122
|
-
__name: "
|
|
2618
|
+
const _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
2619
|
+
__name: "stamp-renderer",
|
|
2123
2620
|
props: {
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2621
|
+
annotation: {},
|
|
2622
|
+
currentObject: {},
|
|
2623
|
+
isSelected: { type: Boolean },
|
|
2624
|
+
isEditing: { type: Boolean },
|
|
2128
2625
|
scale: {},
|
|
2129
|
-
|
|
2626
|
+
pageIndex: {},
|
|
2627
|
+
documentId: {},
|
|
2628
|
+
onClick: { type: Function },
|
|
2629
|
+
appearanceActive: { type: Boolean }
|
|
2130
2630
|
},
|
|
2131
2631
|
setup(__props) {
|
|
2132
|
-
const props = __props;
|
|
2133
|
-
const resolvedColor = computed(() => props.strokeColor ?? "#FFFF00");
|
|
2134
2632
|
return (_ctx, _cache) => {
|
|
2135
|
-
return openBlock(
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
position: "absolute",
|
|
2144
|
-
left: `${(__props.rect ? b.origin.x - __props.rect.origin.x : b.origin.x) * __props.scale}px`,
|
|
2145
|
-
top: `${(__props.rect ? b.origin.y - __props.rect.origin.y : b.origin.y) * __props.scale}px`,
|
|
2146
|
-
width: `${b.size.width * __props.scale}px`,
|
|
2147
|
-
height: `${b.size.height * __props.scale}px`,
|
|
2148
|
-
background: resolvedColor.value,
|
|
2149
|
-
opacity: __props.opacity,
|
|
2150
|
-
pointerEvents: __props.onClick ? "auto" : "none",
|
|
2151
|
-
cursor: __props.onClick ? "pointer" : "default",
|
|
2152
|
-
zIndex: __props.onClick ? 1 : void 0
|
|
2153
|
-
})
|
|
2154
|
-
}, null, 36);
|
|
2155
|
-
}), 128);
|
|
2633
|
+
return openBlock(), createBlock(_sfc_main$l, {
|
|
2634
|
+
isSelected: __props.isSelected,
|
|
2635
|
+
annotation: __props.annotation,
|
|
2636
|
+
documentId: __props.documentId,
|
|
2637
|
+
pageIndex: __props.pageIndex,
|
|
2638
|
+
scale: __props.scale,
|
|
2639
|
+
onClick: __props.onClick
|
|
2640
|
+
}, null, 8, ["isSelected", "annotation", "documentId", "pageIndex", "scale", "onClick"]);
|
|
2156
2641
|
};
|
|
2157
2642
|
}
|
|
2158
2643
|
});
|
|
2159
|
-
const
|
|
2160
|
-
|
|
2644
|
+
const _hoisted_1$2 = ["width", "height", "viewBox"];
|
|
2645
|
+
const _hoisted_2$2 = ["width", "height"];
|
|
2646
|
+
const _hoisted_3$2 = ["y1", "x2", "y2", "stroke", "stroke-width", "stroke-dasharray"];
|
|
2647
|
+
const _hoisted_4$1 = ["x", "y", "width", "height", "stroke", "stroke-width", "stroke-dasharray"];
|
|
2648
|
+
const __default__$5 = { inheritAttrs: false };
|
|
2649
|
+
const _sfc_main$j = /* @__PURE__ */ defineComponent({
|
|
2650
|
+
...__default__$5,
|
|
2651
|
+
__name: "link",
|
|
2161
2652
|
props: {
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2653
|
+
isSelected: { type: Boolean },
|
|
2654
|
+
strokeColor: { default: "#0000FF" },
|
|
2655
|
+
strokeWidth: { default: 2 },
|
|
2656
|
+
strokeStyle: { default: PdfAnnotationBorderStyle.UNDERLINE },
|
|
2657
|
+
strokeDashArray: {},
|
|
2165
2658
|
rect: {},
|
|
2166
2659
|
scale: {},
|
|
2167
|
-
onClick: {}
|
|
2660
|
+
onClick: {},
|
|
2661
|
+
hasIRT: { type: Boolean, default: false }
|
|
2168
2662
|
},
|
|
2169
2663
|
setup(__props) {
|
|
2170
2664
|
const props = __props;
|
|
2171
|
-
const
|
|
2172
|
-
const
|
|
2173
|
-
const
|
|
2174
|
-
const
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
return `url("data:image/svg+xml;utf8,${encodeURIComponent(svg)}")`;
|
|
2665
|
+
const width = computed(() => props.rect.size.width);
|
|
2666
|
+
const height = computed(() => props.rect.size.height);
|
|
2667
|
+
const svgWidth = computed(() => width.value * props.scale);
|
|
2668
|
+
const svgHeight = computed(() => height.value * props.scale);
|
|
2669
|
+
const dashArray = computed(() => {
|
|
2670
|
+
var _a;
|
|
2671
|
+
if (props.strokeStyle === PdfAnnotationBorderStyle.DASHED) {
|
|
2672
|
+
return ((_a = props.strokeDashArray) == null ? void 0 : _a.join(",")) ?? `${props.strokeWidth * 3},${props.strokeWidth}`;
|
|
2673
|
+
}
|
|
2674
|
+
return void 0;
|
|
2182
2675
|
});
|
|
2676
|
+
const isUnderline = computed(() => props.strokeStyle === PdfAnnotationBorderStyle.UNDERLINE);
|
|
2677
|
+
const hitAreaCursor = computed(
|
|
2678
|
+
() => props.hasIRT ? "default" : props.isSelected ? "move" : "pointer"
|
|
2679
|
+
);
|
|
2680
|
+
const hitAreaPointerEvents = computed(
|
|
2681
|
+
() => props.hasIRT ? "none" : props.isSelected ? "none" : "visible"
|
|
2682
|
+
);
|
|
2183
2683
|
return (_ctx, _cache) => {
|
|
2184
|
-
return openBlock(
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2684
|
+
return openBlock(), createElementBlock("svg", {
|
|
2685
|
+
style: normalizeStyle({
|
|
2686
|
+
position: "absolute",
|
|
2687
|
+
width: `${svgWidth.value}px`,
|
|
2688
|
+
height: `${svgHeight.value}px`,
|
|
2689
|
+
pointerEvents: "none",
|
|
2690
|
+
zIndex: 2
|
|
2691
|
+
}),
|
|
2692
|
+
width: svgWidth.value,
|
|
2693
|
+
height: svgHeight.value,
|
|
2694
|
+
viewBox: `0 0 ${width.value} ${height.value}`
|
|
2695
|
+
}, [
|
|
2696
|
+
createElementVNode("rect", {
|
|
2697
|
+
x: 0,
|
|
2698
|
+
y: 0,
|
|
2699
|
+
width: width.value,
|
|
2700
|
+
height: height.value,
|
|
2701
|
+
fill: "transparent",
|
|
2702
|
+
onPointerdown: _cache[0] || (_cache[0] = ($event) => __props.hasIRT ? void 0 : __props.onClick),
|
|
2191
2703
|
style: normalizeStyle({
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2704
|
+
cursor: hitAreaCursor.value,
|
|
2705
|
+
pointerEvents: hitAreaPointerEvents.value
|
|
2706
|
+
})
|
|
2707
|
+
}, null, 44, _hoisted_2$2),
|
|
2708
|
+
isUnderline.value ? (openBlock(), createElementBlock("line", {
|
|
2709
|
+
key: 0,
|
|
2710
|
+
x1: 1,
|
|
2711
|
+
y1: height.value - 1,
|
|
2712
|
+
x2: width.value - 1,
|
|
2713
|
+
y2: height.value - 1,
|
|
2714
|
+
stroke: __props.strokeColor,
|
|
2715
|
+
"stroke-width": __props.strokeWidth,
|
|
2716
|
+
"stroke-dasharray": dashArray.value,
|
|
2717
|
+
style: { "pointer-events": "none" }
|
|
2718
|
+
}, null, 8, _hoisted_3$2)) : (openBlock(), createElementBlock("rect", {
|
|
2719
|
+
key: 1,
|
|
2720
|
+
x: __props.strokeWidth / 2,
|
|
2721
|
+
y: __props.strokeWidth / 2,
|
|
2722
|
+
width: Math.max(width.value - __props.strokeWidth, 0),
|
|
2723
|
+
height: Math.max(height.value - __props.strokeWidth, 0),
|
|
2724
|
+
fill: "transparent",
|
|
2725
|
+
stroke: __props.strokeColor,
|
|
2726
|
+
"stroke-width": __props.strokeWidth,
|
|
2727
|
+
"stroke-dasharray": dashArray.value,
|
|
2728
|
+
style: { "pointer-events": "none" }
|
|
2729
|
+
}, null, 8, _hoisted_4$1))
|
|
2730
|
+
], 12, _hoisted_1$2);
|
|
2731
|
+
};
|
|
2732
|
+
}
|
|
2733
|
+
});
|
|
2734
|
+
const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
2735
|
+
__name: "link-renderer",
|
|
2736
|
+
props: {
|
|
2737
|
+
annotation: {},
|
|
2738
|
+
currentObject: {},
|
|
2739
|
+
isSelected: { type: Boolean },
|
|
2740
|
+
isEditing: { type: Boolean },
|
|
2741
|
+
scale: {},
|
|
2742
|
+
pageIndex: {},
|
|
2743
|
+
documentId: {},
|
|
2744
|
+
onClick: { type: Function },
|
|
2745
|
+
appearanceActive: { type: Boolean }
|
|
2746
|
+
},
|
|
2747
|
+
setup(__props) {
|
|
2748
|
+
return (_ctx, _cache) => {
|
|
2749
|
+
return openBlock(), createBlock(_sfc_main$j, mergeProps(__props.currentObject, {
|
|
2750
|
+
isSelected: __props.isSelected,
|
|
2751
|
+
scale: __props.scale,
|
|
2752
|
+
onClick: __props.onClick,
|
|
2753
|
+
hasIRT: !!__props.currentObject.inReplyToId
|
|
2754
|
+
}), null, 16, ["isSelected", "scale", "onClick", "hasIRT"]);
|
|
2755
|
+
};
|
|
2756
|
+
}
|
|
2757
|
+
});
|
|
2758
|
+
const __default__$4 = { inheritAttrs: false };
|
|
2759
|
+
const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
2760
|
+
...__default__$4,
|
|
2761
|
+
__name: "highlight",
|
|
2762
|
+
props: {
|
|
2763
|
+
strokeColor: {},
|
|
2764
|
+
opacity: { default: 0.5 },
|
|
2765
|
+
segmentRects: {},
|
|
2766
|
+
rect: {},
|
|
2767
|
+
scale: {},
|
|
2768
|
+
onClick: {},
|
|
2769
|
+
appearanceActive: { type: Boolean, default: false }
|
|
2770
|
+
},
|
|
2771
|
+
setup(__props) {
|
|
2772
|
+
const props = __props;
|
|
2773
|
+
const resolvedColor = computed(() => props.strokeColor ?? "#FFFF00");
|
|
2774
|
+
return (_ctx, _cache) => {
|
|
2775
|
+
return openBlock(true), createElementBlock(Fragment, null, renderList(__props.segmentRects, (b, i) => {
|
|
2776
|
+
return openBlock(), createElementBlock("div", {
|
|
2777
|
+
key: i,
|
|
2778
|
+
onPointerdown: _cache[0] || (_cache[0] = //@ts-ignore
|
|
2779
|
+
(...args) => __props.onClick && __props.onClick(...args)),
|
|
2780
|
+
style: normalizeStyle({
|
|
2781
|
+
position: "absolute",
|
|
2782
|
+
left: `${(__props.rect ? b.origin.x - __props.rect.origin.x : b.origin.x) * __props.scale}px`,
|
|
2783
|
+
top: `${(__props.rect ? b.origin.y - __props.rect.origin.y : b.origin.y) * __props.scale}px`,
|
|
2784
|
+
width: `${b.size.width * __props.scale}px`,
|
|
2785
|
+
height: `${b.size.height * __props.scale}px`,
|
|
2786
|
+
background: __props.appearanceActive ? "transparent" : resolvedColor.value,
|
|
2787
|
+
opacity: __props.appearanceActive ? void 0 : __props.opacity,
|
|
2788
|
+
pointerEvents: __props.onClick ? "auto" : "none",
|
|
2789
|
+
cursor: __props.onClick ? "pointer" : "default",
|
|
2790
|
+
zIndex: __props.onClick ? 1 : void 0
|
|
2791
|
+
})
|
|
2792
|
+
}, null, 36);
|
|
2793
|
+
}), 128);
|
|
2794
|
+
};
|
|
2795
|
+
}
|
|
2796
|
+
});
|
|
2797
|
+
const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
2798
|
+
__name: "highlight-renderer",
|
|
2799
|
+
props: {
|
|
2800
|
+
annotation: {},
|
|
2801
|
+
currentObject: {},
|
|
2802
|
+
isSelected: { type: Boolean },
|
|
2803
|
+
isEditing: { type: Boolean },
|
|
2804
|
+
scale: {},
|
|
2805
|
+
pageIndex: {},
|
|
2806
|
+
documentId: {},
|
|
2807
|
+
onClick: { type: Function },
|
|
2808
|
+
appearanceActive: { type: Boolean }
|
|
2809
|
+
},
|
|
2810
|
+
setup(__props) {
|
|
2811
|
+
return (_ctx, _cache) => {
|
|
2812
|
+
return openBlock(), createBlock(_sfc_main$h, mergeProps(__props.currentObject, {
|
|
2813
|
+
scale: __props.scale,
|
|
2814
|
+
onClick: __props.onClick,
|
|
2815
|
+
appearanceActive: __props.appearanceActive
|
|
2816
|
+
}), null, 16, ["scale", "onClick", "appearanceActive"]);
|
|
2817
|
+
};
|
|
2818
|
+
}
|
|
2819
|
+
});
|
|
2820
|
+
const __default__$3 = { inheritAttrs: false };
|
|
2821
|
+
const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
2822
|
+
...__default__$3,
|
|
2823
|
+
__name: "underline",
|
|
2824
|
+
props: {
|
|
2825
|
+
strokeColor: {},
|
|
2826
|
+
opacity: { default: 0.5 },
|
|
2827
|
+
segmentRects: {},
|
|
2828
|
+
rect: {},
|
|
2829
|
+
scale: {},
|
|
2830
|
+
onClick: {},
|
|
2831
|
+
appearanceActive: { type: Boolean, default: false }
|
|
2832
|
+
},
|
|
2833
|
+
setup(__props) {
|
|
2834
|
+
const props = __props;
|
|
2835
|
+
const resolvedColor = computed(() => props.strokeColor ?? "#FFFF00");
|
|
2836
|
+
const thickness = computed(() => 2 * props.scale);
|
|
2837
|
+
return (_ctx, _cache) => {
|
|
2838
|
+
return openBlock(true), createElementBlock(Fragment, null, renderList(__props.segmentRects, (r, i) => {
|
|
2839
|
+
return openBlock(), createElementBlock("div", {
|
|
2840
|
+
key: i,
|
|
2841
|
+
onPointerdown: _cache[0] || (_cache[0] = //@ts-ignore
|
|
2842
|
+
(...args) => __props.onClick && __props.onClick(...args)),
|
|
2843
|
+
style: normalizeStyle({
|
|
2844
|
+
position: "absolute",
|
|
2845
|
+
left: `${(__props.rect ? r.origin.x - __props.rect.origin.x : r.origin.x) * __props.scale}px`,
|
|
2846
|
+
top: `${(__props.rect ? r.origin.y - __props.rect.origin.y : r.origin.y) * __props.scale}px`,
|
|
2195
2847
|
width: `${r.size.width * __props.scale}px`,
|
|
2196
2848
|
height: `${r.size.height * __props.scale}px`,
|
|
2197
2849
|
background: "transparent",
|
|
@@ -2200,26 +2852,50 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
|
2200
2852
|
zIndex: __props.onClick ? 1 : 0
|
|
2201
2853
|
})
|
|
2202
2854
|
}, [
|
|
2203
|
-
|
|
2855
|
+
!__props.appearanceActive ? (openBlock(), createElementBlock("div", {
|
|
2856
|
+
key: 0,
|
|
2204
2857
|
style: normalizeStyle({
|
|
2205
2858
|
position: "absolute",
|
|
2206
2859
|
left: 0,
|
|
2207
2860
|
bottom: 0,
|
|
2208
2861
|
width: "100%",
|
|
2209
|
-
height: `${
|
|
2210
|
-
|
|
2211
|
-
backgroundRepeat: "repeat-x",
|
|
2212
|
-
backgroundSize: `${period.value}px ${amplitude.value * 2}px`,
|
|
2862
|
+
height: `${thickness.value}px`,
|
|
2863
|
+
background: resolvedColor.value,
|
|
2213
2864
|
opacity: __props.opacity,
|
|
2214
2865
|
pointerEvents: "none"
|
|
2215
2866
|
})
|
|
2216
|
-
}, null, 4)
|
|
2867
|
+
}, null, 4)) : createCommentVNode("", true)
|
|
2217
2868
|
], 36);
|
|
2218
2869
|
}), 128);
|
|
2219
2870
|
};
|
|
2220
2871
|
}
|
|
2221
2872
|
});
|
|
2222
|
-
const _sfc_main$
|
|
2873
|
+
const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
2874
|
+
__name: "underline-renderer",
|
|
2875
|
+
props: {
|
|
2876
|
+
annotation: {},
|
|
2877
|
+
currentObject: {},
|
|
2878
|
+
isSelected: { type: Boolean },
|
|
2879
|
+
isEditing: { type: Boolean },
|
|
2880
|
+
scale: {},
|
|
2881
|
+
pageIndex: {},
|
|
2882
|
+
documentId: {},
|
|
2883
|
+
onClick: { type: Function },
|
|
2884
|
+
appearanceActive: { type: Boolean }
|
|
2885
|
+
},
|
|
2886
|
+
setup(__props) {
|
|
2887
|
+
return (_ctx, _cache) => {
|
|
2888
|
+
return openBlock(), createBlock(_sfc_main$f, mergeProps(__props.currentObject, {
|
|
2889
|
+
scale: __props.scale,
|
|
2890
|
+
onClick: __props.onClick,
|
|
2891
|
+
appearanceActive: __props.appearanceActive
|
|
2892
|
+
}), null, 16, ["scale", "onClick", "appearanceActive"]);
|
|
2893
|
+
};
|
|
2894
|
+
}
|
|
2895
|
+
});
|
|
2896
|
+
const __default__$2 = { inheritAttrs: false };
|
|
2897
|
+
const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
2898
|
+
...__default__$2,
|
|
2223
2899
|
__name: "strikeout",
|
|
2224
2900
|
props: {
|
|
2225
2901
|
strokeColor: {},
|
|
@@ -2227,7 +2903,8 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
2227
2903
|
segmentRects: {},
|
|
2228
2904
|
rect: {},
|
|
2229
2905
|
scale: {},
|
|
2230
|
-
onClick: {}
|
|
2906
|
+
onClick: {},
|
|
2907
|
+
appearanceActive: { type: Boolean, default: false }
|
|
2231
2908
|
},
|
|
2232
2909
|
setup(__props) {
|
|
2233
2910
|
const props = __props;
|
|
@@ -2239,8 +2916,6 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
2239
2916
|
key: i,
|
|
2240
2917
|
onPointerdown: _cache[0] || (_cache[0] = //@ts-ignore
|
|
2241
2918
|
(...args) => __props.onClick && __props.onClick(...args)),
|
|
2242
|
-
onTouchstart: _cache[1] || (_cache[1] = //@ts-ignore
|
|
2243
|
-
(...args) => __props.onClick && __props.onClick(...args)),
|
|
2244
2919
|
style: normalizeStyle({
|
|
2245
2920
|
position: "absolute",
|
|
2246
2921
|
left: `${(__props.rect ? r.origin.x - __props.rect.origin.x : r.origin.x) * __props.scale}px`,
|
|
@@ -2253,7 +2928,8 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
2253
2928
|
zIndex: __props.onClick ? 1 : 0
|
|
2254
2929
|
})
|
|
2255
2930
|
}, [
|
|
2256
|
-
|
|
2931
|
+
!__props.appearanceActive ? (openBlock(), createElementBlock("div", {
|
|
2932
|
+
key: 0,
|
|
2257
2933
|
style: normalizeStyle({
|
|
2258
2934
|
position: "absolute",
|
|
2259
2935
|
left: 0,
|
|
@@ -2265,34 +2941,68 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
2265
2941
|
transform: "translateY(-50%)",
|
|
2266
2942
|
pointerEvents: "none"
|
|
2267
2943
|
})
|
|
2268
|
-
}, null, 4)
|
|
2944
|
+
}, null, 4)) : createCommentVNode("", true)
|
|
2269
2945
|
], 36);
|
|
2270
2946
|
}), 128);
|
|
2271
2947
|
};
|
|
2272
2948
|
}
|
|
2273
2949
|
});
|
|
2274
|
-
const _sfc_main$
|
|
2275
|
-
__name: "
|
|
2950
|
+
const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
2951
|
+
__name: "strikeout-renderer",
|
|
2952
|
+
props: {
|
|
2953
|
+
annotation: {},
|
|
2954
|
+
currentObject: {},
|
|
2955
|
+
isSelected: { type: Boolean },
|
|
2956
|
+
isEditing: { type: Boolean },
|
|
2957
|
+
scale: {},
|
|
2958
|
+
pageIndex: {},
|
|
2959
|
+
documentId: {},
|
|
2960
|
+
onClick: { type: Function },
|
|
2961
|
+
appearanceActive: { type: Boolean }
|
|
2962
|
+
},
|
|
2963
|
+
setup(__props) {
|
|
2964
|
+
return (_ctx, _cache) => {
|
|
2965
|
+
return openBlock(), createBlock(_sfc_main$d, mergeProps(__props.currentObject, {
|
|
2966
|
+
scale: __props.scale,
|
|
2967
|
+
onClick: __props.onClick,
|
|
2968
|
+
appearanceActive: __props.appearanceActive
|
|
2969
|
+
}), null, 16, ["scale", "onClick", "appearanceActive"]);
|
|
2970
|
+
};
|
|
2971
|
+
}
|
|
2972
|
+
});
|
|
2973
|
+
const __default__$1 = { inheritAttrs: false };
|
|
2974
|
+
const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
2975
|
+
...__default__$1,
|
|
2976
|
+
__name: "squiggly",
|
|
2276
2977
|
props: {
|
|
2277
2978
|
strokeColor: {},
|
|
2278
2979
|
opacity: { default: 0.5 },
|
|
2279
2980
|
segmentRects: {},
|
|
2280
2981
|
rect: {},
|
|
2281
2982
|
scale: {},
|
|
2282
|
-
onClick: {}
|
|
2983
|
+
onClick: {},
|
|
2984
|
+
appearanceActive: { type: Boolean, default: false }
|
|
2283
2985
|
},
|
|
2284
2986
|
setup(__props) {
|
|
2285
2987
|
const props = __props;
|
|
2286
2988
|
const resolvedColor = computed(() => props.strokeColor ?? "#FFFF00");
|
|
2287
|
-
const
|
|
2989
|
+
const amplitude = computed(() => 2 * props.scale);
|
|
2990
|
+
const period = computed(() => 6 * props.scale);
|
|
2991
|
+
const svgDataUri = computed(() => {
|
|
2992
|
+
const amp = amplitude.value;
|
|
2993
|
+
const per = period.value;
|
|
2994
|
+
const svg = `<svg xmlns="http://www.w3.org/2000/svg" width="${per}" height="${amp * 2}" viewBox="0 0 ${per} ${amp * 2}">
|
|
2995
|
+
<path d="M0 ${amp} Q ${per / 4} 0 ${per / 2} ${amp} T ${per} ${amp}"
|
|
2996
|
+
fill="none" stroke="${resolvedColor.value}" stroke-width="${amp}" stroke-linecap="round"/>
|
|
2997
|
+
</svg>`;
|
|
2998
|
+
return `url("data:image/svg+xml;utf8,${encodeURIComponent(svg)}")`;
|
|
2999
|
+
});
|
|
2288
3000
|
return (_ctx, _cache) => {
|
|
2289
3001
|
return openBlock(true), createElementBlock(Fragment, null, renderList(__props.segmentRects, (r, i) => {
|
|
2290
3002
|
return openBlock(), createElementBlock("div", {
|
|
2291
3003
|
key: i,
|
|
2292
3004
|
onPointerdown: _cache[0] || (_cache[0] = //@ts-ignore
|
|
2293
3005
|
(...args) => __props.onClick && __props.onClick(...args)),
|
|
2294
|
-
onTouchstart: _cache[1] || (_cache[1] = //@ts-ignore
|
|
2295
|
-
(...args) => __props.onClick && __props.onClick(...args)),
|
|
2296
3006
|
style: normalizeStyle({
|
|
2297
3007
|
position: "absolute",
|
|
2298
3008
|
left: `${(__props.rect ? r.origin.x - __props.rect.origin.x : r.origin.x) * __props.scale}px`,
|
|
@@ -2305,576 +3015,712 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
2305
3015
|
zIndex: __props.onClick ? 1 : 0
|
|
2306
3016
|
})
|
|
2307
3017
|
}, [
|
|
2308
|
-
|
|
3018
|
+
!__props.appearanceActive ? (openBlock(), createElementBlock("div", {
|
|
3019
|
+
key: 0,
|
|
2309
3020
|
style: normalizeStyle({
|
|
2310
3021
|
position: "absolute",
|
|
2311
3022
|
left: 0,
|
|
2312
3023
|
bottom: 0,
|
|
2313
3024
|
width: "100%",
|
|
2314
|
-
height: `${
|
|
2315
|
-
|
|
3025
|
+
height: `${amplitude.value * 2}px`,
|
|
3026
|
+
backgroundImage: svgDataUri.value,
|
|
3027
|
+
backgroundRepeat: "repeat-x",
|
|
3028
|
+
backgroundSize: `${period.value}px ${amplitude.value * 2}px`,
|
|
2316
3029
|
opacity: __props.opacity,
|
|
2317
3030
|
pointerEvents: "none"
|
|
2318
3031
|
})
|
|
2319
|
-
}, null, 4)
|
|
3032
|
+
}, null, 4)) : createCommentVNode("", true)
|
|
2320
3033
|
], 36);
|
|
2321
3034
|
}), 128);
|
|
2322
3035
|
};
|
|
2323
3036
|
}
|
|
2324
3037
|
});
|
|
2325
|
-
const _sfc_main$
|
|
2326
|
-
__name: "
|
|
3038
|
+
const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
3039
|
+
__name: "squiggly-renderer",
|
|
2327
3040
|
props: {
|
|
2328
|
-
|
|
3041
|
+
annotation: {},
|
|
3042
|
+
currentObject: {},
|
|
3043
|
+
isSelected: { type: Boolean },
|
|
3044
|
+
isEditing: { type: Boolean },
|
|
3045
|
+
scale: {},
|
|
2329
3046
|
pageIndex: {},
|
|
3047
|
+
documentId: {},
|
|
3048
|
+
onClick: { type: Function },
|
|
3049
|
+
appearanceActive: { type: Boolean }
|
|
3050
|
+
},
|
|
3051
|
+
setup(__props) {
|
|
3052
|
+
return (_ctx, _cache) => {
|
|
3053
|
+
return openBlock(), createBlock(_sfc_main$b, mergeProps(__props.currentObject, {
|
|
3054
|
+
scale: __props.scale,
|
|
3055
|
+
onClick: __props.onClick,
|
|
3056
|
+
appearanceActive: __props.appearanceActive
|
|
3057
|
+
}), null, 16, ["scale", "onClick", "appearanceActive"]);
|
|
3058
|
+
};
|
|
3059
|
+
}
|
|
3060
|
+
});
|
|
3061
|
+
const _hoisted_1$1 = ["width", "height", "viewBox"];
|
|
3062
|
+
const _hoisted_2$1 = ["d"];
|
|
3063
|
+
const _hoisted_3$1 = ["d", "fill", "stroke", "opacity"];
|
|
3064
|
+
const __default__ = { inheritAttrs: false };
|
|
3065
|
+
const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
3066
|
+
...__default__,
|
|
3067
|
+
__name: "caret",
|
|
3068
|
+
props: {
|
|
3069
|
+
isSelected: { type: Boolean },
|
|
3070
|
+
strokeColor: { default: "#000000" },
|
|
3071
|
+
opacity: { default: 1 },
|
|
3072
|
+
rect: {},
|
|
2330
3073
|
scale: {},
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
pageHeight: {},
|
|
2334
|
-
resizeUi: {},
|
|
2335
|
-
vertexUi: {},
|
|
2336
|
-
rotationUi: {},
|
|
2337
|
-
selectionOutlineColor: {},
|
|
2338
|
-
selectionOutline: {},
|
|
2339
|
-
groupSelectionOutline: {},
|
|
2340
|
-
selectionMenu: { type: Function },
|
|
2341
|
-
groupSelectionMenu: { type: Function },
|
|
2342
|
-
annotationRenderers: {}
|
|
3074
|
+
onClick: {},
|
|
3075
|
+
appearanceActive: { type: Boolean, default: false }
|
|
2343
3076
|
},
|
|
2344
3077
|
setup(__props) {
|
|
2345
3078
|
const props = __props;
|
|
2346
|
-
const
|
|
2347
|
-
|
|
3079
|
+
const width = computed(() => props.rect.size.width);
|
|
3080
|
+
const height = computed(() => props.rect.size.height);
|
|
3081
|
+
const path = computed(() => {
|
|
3082
|
+
const w = width.value;
|
|
3083
|
+
const h = height.value;
|
|
3084
|
+
const midX = w / 2;
|
|
3085
|
+
return [
|
|
3086
|
+
`M 0 ${h}`,
|
|
3087
|
+
`C ${w * 0.27} ${h} ${midX} ${h - h * 0.44} ${midX} 0`,
|
|
3088
|
+
`C ${midX} ${h - h * 0.44} ${w - w * 0.27} ${h} ${w} ${h}`,
|
|
3089
|
+
"Z"
|
|
3090
|
+
].join(" ");
|
|
2348
3091
|
});
|
|
2349
|
-
const
|
|
2350
|
-
|
|
2351
|
-
|
|
3092
|
+
const svgWidth = computed(() => width.value * props.scale);
|
|
3093
|
+
const svgHeight = computed(() => height.value * props.scale);
|
|
3094
|
+
return (_ctx, _cache) => {
|
|
3095
|
+
return openBlock(), createElementBlock("svg", {
|
|
3096
|
+
style: normalizeStyle({
|
|
3097
|
+
position: "absolute",
|
|
3098
|
+
width: svgWidth.value,
|
|
3099
|
+
height: svgHeight.value,
|
|
3100
|
+
pointerEvents: "none",
|
|
3101
|
+
zIndex: 2
|
|
3102
|
+
}),
|
|
3103
|
+
width: svgWidth.value,
|
|
3104
|
+
height: svgHeight.value,
|
|
3105
|
+
viewBox: `0 0 ${width.value} ${height.value}`,
|
|
3106
|
+
overflow: "visible"
|
|
3107
|
+
}, [
|
|
3108
|
+
createElementVNode("path", {
|
|
3109
|
+
d: path.value,
|
|
3110
|
+
fill: "transparent",
|
|
3111
|
+
stroke: "transparent",
|
|
3112
|
+
"stroke-width": 4,
|
|
3113
|
+
onPointerdown: _cache[0] || (_cache[0] = //@ts-ignore
|
|
3114
|
+
(...args) => __props.onClick && __props.onClick(...args)),
|
|
3115
|
+
style: normalizeStyle({
|
|
3116
|
+
cursor: __props.isSelected ? "move" : "pointer",
|
|
3117
|
+
pointerEvents: __props.isSelected ? "none" : "visible"
|
|
3118
|
+
})
|
|
3119
|
+
}, null, 44, _hoisted_2$1),
|
|
3120
|
+
!__props.appearanceActive ? (openBlock(), createElementBlock("path", {
|
|
3121
|
+
key: 0,
|
|
3122
|
+
d: path.value,
|
|
3123
|
+
fill: __props.strokeColor,
|
|
3124
|
+
stroke: __props.strokeColor,
|
|
3125
|
+
"stroke-width": 0.5,
|
|
3126
|
+
opacity: __props.opacity,
|
|
3127
|
+
"fill-rule": "evenodd",
|
|
3128
|
+
style: { pointerEvents: "none" }
|
|
3129
|
+
}, null, 8, _hoisted_3$1)) : createCommentVNode("", true)
|
|
3130
|
+
], 12, _hoisted_1$1);
|
|
2352
3131
|
};
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
}
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
}
|
|
2377
|
-
});
|
|
2378
|
-
const handlePointerDown = (_pos, pe) => {
|
|
2379
|
-
if (pe.target === pe.currentTarget && annotationProvides.value) {
|
|
2380
|
-
annotationProvides.value.deselectAnnotation();
|
|
2381
|
-
editingId.value = null;
|
|
2382
|
-
}
|
|
3132
|
+
}
|
|
3133
|
+
});
|
|
3134
|
+
const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
3135
|
+
__name: "caret-renderer",
|
|
3136
|
+
props: {
|
|
3137
|
+
annotation: {},
|
|
3138
|
+
currentObject: {},
|
|
3139
|
+
isSelected: { type: Boolean },
|
|
3140
|
+
isEditing: { type: Boolean },
|
|
3141
|
+
scale: {},
|
|
3142
|
+
pageIndex: {},
|
|
3143
|
+
documentId: {},
|
|
3144
|
+
onClick: { type: Function },
|
|
3145
|
+
appearanceActive: { type: Boolean }
|
|
3146
|
+
},
|
|
3147
|
+
setup(__props) {
|
|
3148
|
+
return (_ctx, _cache) => {
|
|
3149
|
+
return openBlock(), createBlock(_sfc_main$9, mergeProps(__props.currentObject, {
|
|
3150
|
+
isSelected: __props.isSelected,
|
|
3151
|
+
scale: __props.scale,
|
|
3152
|
+
onClick: __props.onClick,
|
|
3153
|
+
appearanceActive: __props.appearanceActive
|
|
3154
|
+
}), null, 16, ["isSelected", "scale", "onClick", "appearanceActive"]);
|
|
2383
3155
|
};
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
3156
|
+
}
|
|
3157
|
+
});
|
|
3158
|
+
const _hoisted_1 = {
|
|
3159
|
+
key: 0,
|
|
3160
|
+
style: { position: "absolute", inset: 0, pointerEvents: "none" },
|
|
3161
|
+
viewBox: "0 0 20 20",
|
|
3162
|
+
width: "100%",
|
|
3163
|
+
height: "100%"
|
|
3164
|
+
};
|
|
3165
|
+
const _hoisted_2 = ["fill", "opacity", "stroke"];
|
|
3166
|
+
const _hoisted_3 = ["stroke"];
|
|
3167
|
+
const _hoisted_4 = ["stroke"];
|
|
3168
|
+
const _hoisted_5 = ["stroke"];
|
|
3169
|
+
const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
3170
|
+
__name: "text",
|
|
3171
|
+
props: {
|
|
3172
|
+
isSelected: { type: Boolean },
|
|
3173
|
+
color: { default: "#facc15" },
|
|
3174
|
+
opacity: { default: 1 },
|
|
3175
|
+
onClick: {},
|
|
3176
|
+
appearanceActive: { type: Boolean, default: false }
|
|
3177
|
+
},
|
|
3178
|
+
setup(__props) {
|
|
3179
|
+
const props = __props;
|
|
3180
|
+
const lineColor = computed(() => getContrastStrokeColor(props.color));
|
|
3181
|
+
return (_ctx, _cache) => {
|
|
3182
|
+
return openBlock(), createElementBlock("div", {
|
|
3183
|
+
style: normalizeStyle({
|
|
3184
|
+
position: "absolute",
|
|
3185
|
+
inset: 0,
|
|
3186
|
+
zIndex: 2,
|
|
3187
|
+
pointerEvents: __props.isSelected ? "none" : "auto",
|
|
3188
|
+
cursor: __props.isSelected ? "move" : "pointer"
|
|
3189
|
+
}),
|
|
3190
|
+
onPointerdown: _cache[0] || (_cache[0] = //@ts-ignore
|
|
3191
|
+
(...args) => __props.onClick && __props.onClick(...args))
|
|
3192
|
+
}, [
|
|
3193
|
+
!__props.appearanceActive ? (openBlock(), createElementBlock("svg", _hoisted_1, [
|
|
3194
|
+
createElementVNode("path", {
|
|
3195
|
+
d: "M 0.5 15.5 L 0.5 0.5 L 19.5 0.5 L 19.5 15.5 L 8.5 15.5 L 6.5 19.5 L 4.5 15.5 Z",
|
|
3196
|
+
fill: __props.color,
|
|
3197
|
+
opacity: __props.opacity,
|
|
3198
|
+
stroke: lineColor.value,
|
|
3199
|
+
"stroke-width": "1",
|
|
3200
|
+
"stroke-linejoin": "miter"
|
|
3201
|
+
}, null, 8, _hoisted_2),
|
|
3202
|
+
createElementVNode("line", {
|
|
3203
|
+
x1: "2.5",
|
|
3204
|
+
y1: "4.25",
|
|
3205
|
+
x2: "17.5",
|
|
3206
|
+
y2: "4.25",
|
|
3207
|
+
stroke: lineColor.value,
|
|
3208
|
+
"stroke-width": "1"
|
|
3209
|
+
}, null, 8, _hoisted_3),
|
|
3210
|
+
createElementVNode("line", {
|
|
3211
|
+
x1: "2.5",
|
|
3212
|
+
y1: "8",
|
|
3213
|
+
x2: "17.5",
|
|
3214
|
+
y2: "8",
|
|
3215
|
+
stroke: lineColor.value,
|
|
3216
|
+
"stroke-width": "1"
|
|
3217
|
+
}, null, 8, _hoisted_4),
|
|
3218
|
+
createElementVNode("line", {
|
|
3219
|
+
x1: "2.5",
|
|
3220
|
+
y1: "11.75",
|
|
3221
|
+
x2: "17.5",
|
|
3222
|
+
y2: "11.75",
|
|
3223
|
+
stroke: lineColor.value,
|
|
3224
|
+
"stroke-width": "1"
|
|
3225
|
+
}, null, 8, _hoisted_5)
|
|
3226
|
+
])) : createCommentVNode("", true)
|
|
3227
|
+
], 36);
|
|
2398
3228
|
};
|
|
2399
|
-
|
|
3229
|
+
}
|
|
3230
|
+
});
|
|
3231
|
+
const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
3232
|
+
__name: "text-renderer",
|
|
3233
|
+
props: {
|
|
3234
|
+
annotation: {},
|
|
3235
|
+
currentObject: {},
|
|
3236
|
+
isSelected: { type: Boolean },
|
|
3237
|
+
isEditing: { type: Boolean },
|
|
3238
|
+
scale: {},
|
|
3239
|
+
pageIndex: {},
|
|
3240
|
+
documentId: {},
|
|
3241
|
+
onClick: { type: Function },
|
|
3242
|
+
appearanceActive: { type: Boolean }
|
|
3243
|
+
},
|
|
3244
|
+
setup(__props) {
|
|
3245
|
+
return (_ctx, _cache) => {
|
|
3246
|
+
return openBlock(), createBlock(_sfc_main$7, {
|
|
3247
|
+
isSelected: __props.isSelected,
|
|
3248
|
+
color: __props.currentObject.strokeColor ?? __props.currentObject.color,
|
|
3249
|
+
opacity: __props.currentObject.opacity,
|
|
3250
|
+
onClick: __props.onClick,
|
|
3251
|
+
appearanceActive: __props.appearanceActive
|
|
3252
|
+
}, null, 8, ["isSelected", "color", "opacity", "onClick", "appearanceActive"]);
|
|
3253
|
+
};
|
|
3254
|
+
}
|
|
3255
|
+
});
|
|
3256
|
+
const builtInRenderers = [
|
|
3257
|
+
createRenderer({
|
|
3258
|
+
id: "ink",
|
|
3259
|
+
matches: (a) => a.type === PdfAnnotationSubtype.INK,
|
|
3260
|
+
component: _sfc_main$z,
|
|
3261
|
+
interactionDefaults: { isDraggable: true, isResizable: true, isRotatable: true }
|
|
3262
|
+
}),
|
|
3263
|
+
createRenderer({
|
|
3264
|
+
id: "square",
|
|
3265
|
+
matches: (a) => a.type === PdfAnnotationSubtype.SQUARE,
|
|
3266
|
+
component: _sfc_main$x,
|
|
3267
|
+
interactionDefaults: { isDraggable: true, isResizable: true, isRotatable: true }
|
|
3268
|
+
}),
|
|
3269
|
+
createRenderer({
|
|
3270
|
+
id: "circle",
|
|
3271
|
+
matches: (a) => a.type === PdfAnnotationSubtype.CIRCLE,
|
|
3272
|
+
component: _sfc_main$v,
|
|
3273
|
+
interactionDefaults: { isDraggable: true, isResizable: true, isRotatable: true }
|
|
3274
|
+
}),
|
|
3275
|
+
createRenderer({
|
|
3276
|
+
id: "line",
|
|
3277
|
+
matches: (a) => a.type === PdfAnnotationSubtype.LINE,
|
|
3278
|
+
component: _sfc_main$t,
|
|
3279
|
+
vertexConfig: {
|
|
3280
|
+
extractVertices: (a) => [a.linePoints.start, a.linePoints.end],
|
|
3281
|
+
transformAnnotation: (a, v) => ({
|
|
3282
|
+
...a,
|
|
3283
|
+
linePoints: { start: v[0], end: v[1] }
|
|
3284
|
+
})
|
|
3285
|
+
},
|
|
3286
|
+
interactionDefaults: { isDraggable: true, isResizable: false, isRotatable: true }
|
|
3287
|
+
}),
|
|
3288
|
+
createRenderer({
|
|
3289
|
+
id: "polyline",
|
|
3290
|
+
matches: (a) => a.type === PdfAnnotationSubtype.POLYLINE,
|
|
3291
|
+
component: _sfc_main$r,
|
|
3292
|
+
vertexConfig: {
|
|
3293
|
+
extractVertices: (a) => a.vertices,
|
|
3294
|
+
transformAnnotation: (a, vertices) => ({ ...a, vertices })
|
|
3295
|
+
},
|
|
3296
|
+
interactionDefaults: { isDraggable: true, isResizable: false, isRotatable: true }
|
|
3297
|
+
}),
|
|
3298
|
+
createRenderer({
|
|
3299
|
+
id: "polygon",
|
|
3300
|
+
matches: (a) => a.type === PdfAnnotationSubtype.POLYGON,
|
|
3301
|
+
component: _sfc_main$p,
|
|
3302
|
+
vertexConfig: {
|
|
3303
|
+
extractVertices: (a) => a.vertices,
|
|
3304
|
+
transformAnnotation: (a, vertices) => ({ ...a, vertices })
|
|
3305
|
+
},
|
|
3306
|
+
interactionDefaults: { isDraggable: true, isResizable: false, isRotatable: true }
|
|
3307
|
+
}),
|
|
3308
|
+
createRenderer({
|
|
3309
|
+
id: "highlight",
|
|
3310
|
+
matches: (a) => a.type === PdfAnnotationSubtype.HIGHLIGHT,
|
|
3311
|
+
component: _sfc_main$g,
|
|
3312
|
+
zIndex: 0,
|
|
3313
|
+
interactionDefaults: { isDraggable: false, isResizable: false, isRotatable: false },
|
|
3314
|
+
containerStyle: (a) => ({
|
|
3315
|
+
mixBlendMode: blendModeToCss(a.blendMode ?? PdfBlendMode.Multiply)
|
|
3316
|
+
})
|
|
3317
|
+
}),
|
|
3318
|
+
createRenderer({
|
|
3319
|
+
id: "underline",
|
|
3320
|
+
matches: (a) => a.type === PdfAnnotationSubtype.UNDERLINE,
|
|
3321
|
+
component: _sfc_main$e,
|
|
3322
|
+
zIndex: 0,
|
|
3323
|
+
interactionDefaults: { isDraggable: false, isResizable: false, isRotatable: false }
|
|
3324
|
+
}),
|
|
3325
|
+
createRenderer({
|
|
3326
|
+
id: "strikeout",
|
|
3327
|
+
matches: (a) => a.type === PdfAnnotationSubtype.STRIKEOUT,
|
|
3328
|
+
component: _sfc_main$c,
|
|
3329
|
+
zIndex: 0,
|
|
3330
|
+
interactionDefaults: { isDraggable: false, isResizable: false, isRotatable: false }
|
|
3331
|
+
}),
|
|
3332
|
+
createRenderer({
|
|
3333
|
+
id: "squiggly",
|
|
3334
|
+
matches: (a) => a.type === PdfAnnotationSubtype.SQUIGGLY,
|
|
3335
|
+
component: _sfc_main$a,
|
|
3336
|
+
zIndex: 0,
|
|
3337
|
+
interactionDefaults: { isDraggable: false, isResizable: false, isRotatable: false }
|
|
3338
|
+
}),
|
|
3339
|
+
createRenderer({
|
|
3340
|
+
id: "text",
|
|
3341
|
+
matches: (a) => a.type === PdfAnnotationSubtype.TEXT && !a.inReplyToId,
|
|
3342
|
+
component: _sfc_main$6,
|
|
3343
|
+
interactionDefaults: { isDraggable: true, isResizable: false, isRotatable: false }
|
|
3344
|
+
}),
|
|
3345
|
+
createRenderer({
|
|
3346
|
+
id: "caret",
|
|
3347
|
+
matches: (a) => a.type === PdfAnnotationSubtype.CARET,
|
|
3348
|
+
component: _sfc_main$8,
|
|
3349
|
+
interactionDefaults: { isDraggable: false, isResizable: false, isRotatable: false }
|
|
3350
|
+
}),
|
|
3351
|
+
createRenderer({
|
|
3352
|
+
id: "freeText",
|
|
3353
|
+
matches: (a) => a.type === PdfAnnotationSubtype.FREETEXT,
|
|
3354
|
+
component: _sfc_main$n,
|
|
3355
|
+
interactionDefaults: { isDraggable: true, isResizable: true, isRotatable: true },
|
|
3356
|
+
isDraggable: (toolDraggable, { isEditing }) => toolDraggable && !isEditing,
|
|
3357
|
+
onDoubleClick: (id, setEditingId) => setEditingId(id)
|
|
3358
|
+
}),
|
|
3359
|
+
createRenderer({
|
|
3360
|
+
id: "stamp",
|
|
3361
|
+
matches: (a) => a.type === PdfAnnotationSubtype.STAMP,
|
|
3362
|
+
component: _sfc_main$k,
|
|
3363
|
+
useAppearanceStream: false,
|
|
3364
|
+
interactionDefaults: { isDraggable: true, isResizable: true, isRotatable: true }
|
|
3365
|
+
}),
|
|
3366
|
+
createRenderer({
|
|
3367
|
+
id: "link",
|
|
3368
|
+
matches: (a) => a.type === PdfAnnotationSubtype.LINK,
|
|
3369
|
+
component: _sfc_main$i,
|
|
3370
|
+
interactionDefaults: { isDraggable: false, isResizable: false, isRotatable: false },
|
|
3371
|
+
useAppearanceStream: false,
|
|
3372
|
+
selectOverride: (e, annotation, helpers) => {
|
|
2400
3373
|
e.stopPropagation();
|
|
2401
|
-
|
|
2402
|
-
selectionProvides.value.clear();
|
|
3374
|
+
helpers.clearSelection();
|
|
2403
3375
|
if (annotation.object.inReplyToId) {
|
|
2404
|
-
const
|
|
2405
|
-
|
|
3376
|
+
const parent = helpers.allAnnotations.find(
|
|
3377
|
+
(a) => a.object.id === annotation.object.inReplyToId
|
|
3378
|
+
);
|
|
2406
3379
|
if (parent) {
|
|
2407
|
-
|
|
3380
|
+
helpers.selectAnnotation(parent.object.pageIndex, parent.object.id);
|
|
2408
3381
|
return;
|
|
2409
3382
|
}
|
|
2410
3383
|
}
|
|
2411
|
-
|
|
3384
|
+
helpers.selectAnnotation(helpers.pageIndex, annotation.object.id);
|
|
3385
|
+
},
|
|
3386
|
+
hideSelectionMenu: (a) => !!a.inReplyToId
|
|
3387
|
+
})
|
|
3388
|
+
];
|
|
3389
|
+
const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
3390
|
+
__name: "annotations",
|
|
3391
|
+
props: {
|
|
3392
|
+
documentId: {},
|
|
3393
|
+
pageIndex: {},
|
|
3394
|
+
scale: {},
|
|
3395
|
+
rotation: {},
|
|
3396
|
+
pageWidth: {},
|
|
3397
|
+
pageHeight: {},
|
|
3398
|
+
resizeUi: {},
|
|
3399
|
+
vertexUi: {},
|
|
3400
|
+
rotationUi: {},
|
|
3401
|
+
selectionOutlineColor: {},
|
|
3402
|
+
selectionOutline: {},
|
|
3403
|
+
groupSelectionOutline: {},
|
|
3404
|
+
selectionMenu: { type: Function },
|
|
3405
|
+
groupSelectionMenu: { type: Function },
|
|
3406
|
+
annotationRenderers: {}
|
|
3407
|
+
},
|
|
3408
|
+
setup(__props) {
|
|
3409
|
+
const props = __props;
|
|
3410
|
+
const { provides: annotationCapability } = useAnnotationCapability();
|
|
3411
|
+
const { provides: selectionProvides } = useSelectionCapability();
|
|
3412
|
+
const annotations = shallowRef([]);
|
|
3413
|
+
const allSelectedIds = shallowRef([]);
|
|
3414
|
+
const { register } = usePointerHandlers({
|
|
3415
|
+
documentId: () => props.documentId,
|
|
3416
|
+
pageIndex: props.pageIndex
|
|
3417
|
+
});
|
|
3418
|
+
const editingId = ref(null);
|
|
3419
|
+
const appearanceMap = shallowRef({});
|
|
3420
|
+
let prevScale = props.scale;
|
|
3421
|
+
const annotationProvides = computed(
|
|
3422
|
+
() => annotationCapability.value ? annotationCapability.value.forDocument(props.documentId) : null
|
|
3423
|
+
);
|
|
3424
|
+
const isMultiSelected = computed(() => allSelectedIds.value.length > 1);
|
|
3425
|
+
const allRenderers = computed(() => {
|
|
3426
|
+
const external = props.annotationRenderers ?? [];
|
|
3427
|
+
const externalIds = new Set(external.map((r) => r.id));
|
|
3428
|
+
return [...external, ...builtInRenderers.filter((r) => !externalIds.has(r.id))];
|
|
3429
|
+
});
|
|
3430
|
+
const resolveRenderer = (annotation) => {
|
|
3431
|
+
return allRenderers.value.find((r) => r.matches(annotation.object)) ?? null;
|
|
2412
3432
|
};
|
|
2413
|
-
const
|
|
2414
|
-
if (
|
|
2415
|
-
|
|
2416
|
-
|
|
3433
|
+
const getAppearanceForAnnotation = (ta) => {
|
|
3434
|
+
if (ta.dictMode) return null;
|
|
3435
|
+
if (ta.object.rotation && ta.object.unrotatedRect) return null;
|
|
3436
|
+
const appearances = appearanceMap.value[ta.object.id];
|
|
3437
|
+
if (!(appearances == null ? void 0 : appearances.normal)) return null;
|
|
3438
|
+
return appearances;
|
|
2417
3439
|
};
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
if (
|
|
2422
|
-
|
|
3440
|
+
watch(
|
|
3441
|
+
[annotationProvides, () => props.pageIndex],
|
|
3442
|
+
([provides, pageIndex], _prev, onCleanup) => {
|
|
3443
|
+
if (!provides) {
|
|
3444
|
+
annotations.value = [];
|
|
3445
|
+
allSelectedIds.value = [];
|
|
3446
|
+
return;
|
|
2423
3447
|
}
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
3448
|
+
const syncState = (state) => {
|
|
3449
|
+
annotations.value = getAnnotationsByPageIndex(state, pageIndex);
|
|
3450
|
+
allSelectedIds.value = getSelectedAnnotationIds(state);
|
|
3451
|
+
};
|
|
3452
|
+
syncState(provides.getState());
|
|
3453
|
+
const off = provides.onStateChange(syncState);
|
|
3454
|
+
onCleanup(off);
|
|
3455
|
+
},
|
|
3456
|
+
{ immediate: true }
|
|
2429
3457
|
);
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
});
|
|
2457
|
-
});
|
|
2458
|
-
const areAllSelectedRotatable = computed(() => {
|
|
2459
|
-
if (selectedAnnotationsOnPage.value.length < 2) return false;
|
|
2460
|
-
return selectedAnnotationsOnPage.value.every((ta) => {
|
|
2461
|
-
var _a;
|
|
2462
|
-
const tool = (_a = annotationProvides.value) == null ? void 0 : _a.findToolForAnnotation(ta.object);
|
|
2463
|
-
const groupRotatable = resolveInteractionProp(
|
|
2464
|
-
tool == null ? void 0 : tool.interaction.isGroupRotatable,
|
|
2465
|
-
ta.object,
|
|
2466
|
-
true
|
|
2467
|
-
);
|
|
2468
|
-
const singleRotatable = resolveInteractionProp(tool == null ? void 0 : tool.interaction.isRotatable, ta.object, true);
|
|
2469
|
-
return (tool == null ? void 0 : tool.interaction.isGroupRotatable) !== void 0 ? groupRotatable : singleRotatable;
|
|
2470
|
-
});
|
|
2471
|
-
});
|
|
2472
|
-
const shouldLockGroupAspectRatio = computed(() => {
|
|
2473
|
-
if (selectedAnnotationsOnPage.value.length < 2) return false;
|
|
2474
|
-
return selectedAnnotationsOnPage.value.some((ta) => {
|
|
2475
|
-
var _a;
|
|
2476
|
-
const tool = (_a = annotationProvides.value) == null ? void 0 : _a.findToolForAnnotation(ta.object);
|
|
2477
|
-
const groupLock = resolveInteractionProp(
|
|
2478
|
-
tool == null ? void 0 : tool.interaction.lockGroupAspectRatio,
|
|
2479
|
-
ta.object,
|
|
2480
|
-
false
|
|
3458
|
+
watch(
|
|
3459
|
+
[annotationProvides, () => props.pageIndex, () => props.scale],
|
|
3460
|
+
([provides, pageIndex, scale], _prev, onCleanup) => {
|
|
3461
|
+
if (!provides) {
|
|
3462
|
+
appearanceMap.value = {};
|
|
3463
|
+
return;
|
|
3464
|
+
}
|
|
3465
|
+
if (prevScale !== scale) {
|
|
3466
|
+
provides.invalidatePageAppearances(pageIndex);
|
|
3467
|
+
prevScale = scale;
|
|
3468
|
+
}
|
|
3469
|
+
let cancelled = false;
|
|
3470
|
+
onCleanup(() => {
|
|
3471
|
+
cancelled = true;
|
|
3472
|
+
});
|
|
3473
|
+
const task = provides.getPageAppearances(pageIndex, {
|
|
3474
|
+
scaleFactor: scale,
|
|
3475
|
+
dpr: typeof window !== "undefined" ? window.devicePixelRatio : 1
|
|
3476
|
+
});
|
|
3477
|
+
task.wait(
|
|
3478
|
+
(map) => {
|
|
3479
|
+
if (!cancelled) appearanceMap.value = map;
|
|
3480
|
+
},
|
|
3481
|
+
() => {
|
|
3482
|
+
if (!cancelled) appearanceMap.value = {};
|
|
3483
|
+
}
|
|
2481
3484
|
);
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
const getTool = (annotation) => {
|
|
3485
|
+
},
|
|
3486
|
+
{ immediate: true }
|
|
3487
|
+
);
|
|
3488
|
+
const resolvedAnnotations = computed(
|
|
3489
|
+
() => annotations.value.map((annotation) => ({
|
|
3490
|
+
annotation,
|
|
3491
|
+
renderer: resolveRenderer(annotation)
|
|
3492
|
+
}))
|
|
3493
|
+
);
|
|
3494
|
+
const getFinalDraggable = (annotation, renderer) => {
|
|
2493
3495
|
var _a;
|
|
2494
|
-
|
|
3496
|
+
const tool = (_a = annotationProvides.value) == null ? void 0 : _a.findToolForAnnotation(annotation.object);
|
|
3497
|
+
const defaults = renderer.interactionDefaults;
|
|
3498
|
+
const isEditing = editingId.value === annotation.object.id;
|
|
3499
|
+
const resolvedDraggable = resolveInteractionProp(
|
|
3500
|
+
tool == null ? void 0 : tool.interaction.isDraggable,
|
|
3501
|
+
annotation.object,
|
|
3502
|
+
(defaults == null ? void 0 : defaults.isDraggable) ?? true
|
|
3503
|
+
);
|
|
3504
|
+
return renderer.isDraggable ? renderer.isDraggable(resolvedDraggable, { isEditing }) : resolvedDraggable;
|
|
2495
3505
|
};
|
|
2496
|
-
const
|
|
2497
|
-
var _a;
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
3506
|
+
const getResolvedResizable = (annotation, renderer) => {
|
|
3507
|
+
var _a, _b;
|
|
3508
|
+
const tool = (_a = annotationProvides.value) == null ? void 0 : _a.findToolForAnnotation(annotation.object);
|
|
3509
|
+
return resolveInteractionProp(
|
|
3510
|
+
tool == null ? void 0 : tool.interaction.isResizable,
|
|
3511
|
+
annotation.object,
|
|
3512
|
+
((_b = renderer.interactionDefaults) == null ? void 0 : _b.isResizable) ?? false
|
|
3513
|
+
);
|
|
2501
3514
|
};
|
|
2502
|
-
const
|
|
2503
|
-
var _a;
|
|
2504
|
-
|
|
2505
|
-
return resolveInteractionProp(
|
|
3515
|
+
const getResolvedLockAspectRatio = (annotation, renderer) => {
|
|
3516
|
+
var _a, _b;
|
|
3517
|
+
const tool = (_a = annotationProvides.value) == null ? void 0 : _a.findToolForAnnotation(annotation.object);
|
|
3518
|
+
return resolveInteractionProp(
|
|
3519
|
+
tool == null ? void 0 : tool.interaction.lockAspectRatio,
|
|
3520
|
+
annotation.object,
|
|
3521
|
+
((_b = renderer.interactionDefaults) == null ? void 0 : _b.lockAspectRatio) ?? false
|
|
3522
|
+
);
|
|
2506
3523
|
};
|
|
2507
|
-
const
|
|
2508
|
-
var _a;
|
|
2509
|
-
|
|
3524
|
+
const getResolvedRotatable = (annotation, renderer) => {
|
|
3525
|
+
var _a, _b;
|
|
3526
|
+
const tool = (_a = annotationProvides.value) == null ? void 0 : _a.findToolForAnnotation(annotation.object);
|
|
3527
|
+
return resolveInteractionProp(
|
|
3528
|
+
tool == null ? void 0 : tool.interaction.isRotatable,
|
|
3529
|
+
annotation.object,
|
|
3530
|
+
((_b = renderer.interactionDefaults) == null ? void 0 : _b.isRotatable) ?? false
|
|
3531
|
+
);
|
|
2510
3532
|
};
|
|
2511
|
-
const
|
|
3533
|
+
const getSelectionMenu = (annotation, renderer) => {
|
|
2512
3534
|
var _a;
|
|
2513
|
-
if (
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
const
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
|
|
2621
|
-
|
|
2622
|
-
|
|
2623
|
-
|
|
2624
|
-
|
|
2625
|
-
|
|
2626
|
-
|
|
2627
|
-
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
}, { ref_for: true }, containerProps.value), createSlots({
|
|
2675
|
-
default: withCtx(({ annotation: currentObject }) => [
|
|
2676
|
-
createVNode(_sfc_main$j, mergeProps({ ref_for: true }, currentObject, {
|
|
2677
|
-
isSelected: isSelected(annotation),
|
|
2678
|
-
scale: __props.scale,
|
|
2679
|
-
onClick: (e) => handleClick(e, annotation)
|
|
2680
|
-
}), null, 16, ["isSelected", "scale", "onClick"])
|
|
2681
|
-
]),
|
|
2682
|
-
"resize-handle": withCtx((slotProps) => [
|
|
2683
|
-
renderSlot(_ctx.$slots, "resize-handle", mergeProps({ ref_for: true }, slotProps))
|
|
2684
|
-
]),
|
|
2685
|
-
"vertex-handle": withCtx((slotProps) => [
|
|
2686
|
-
renderSlot(_ctx.$slots, "vertex-handle", mergeProps({ ref_for: true }, slotProps))
|
|
2687
|
-
]),
|
|
2688
|
-
"rotation-handle": withCtx((slotProps) => [
|
|
2689
|
-
renderSlot(_ctx.$slots, "rotation-handle", mergeProps({ ref_for: true }, slotProps))
|
|
2690
|
-
]),
|
|
2691
|
-
_: 2
|
|
2692
|
-
}, [
|
|
2693
|
-
!isMultiSelected.value ? {
|
|
2694
|
-
name: "selection-menu",
|
|
2695
|
-
fn: withCtx((slotProps) => [
|
|
2696
|
-
renderSlot(_ctx.$slots, "selection-menu", mergeProps({ ref_for: true }, slotProps))
|
|
2697
|
-
]),
|
|
2698
|
-
key: "0"
|
|
2699
|
-
} : void 0
|
|
2700
|
-
]), 1040, ["trackedAnnotation", "isSelected", "isDraggable", "isResizable", "isRotatable", "lockAspectRatio", "onSelect", "vertexConfig", "selectionMenu", "style"])) : unref(isLine)(annotation) ? (openBlock(), createBlock(_sfc_main$l, mergeProps({
|
|
2701
|
-
key: 4,
|
|
2702
|
-
trackedAnnotation: annotation,
|
|
2703
|
-
isSelected: showIndividualSelection(annotation),
|
|
2704
|
-
isDraggable: isDraggable(annotation),
|
|
2705
|
-
isResizable: isResizable(annotation),
|
|
2706
|
-
isRotatable: isRotatableFor(annotation, true),
|
|
2707
|
-
lockAspectRatio: lockAspectRatio(annotation),
|
|
2708
|
-
onSelect: (e) => handleClick(e, annotation),
|
|
2709
|
-
vertexConfig: getVertexConfig(annotation),
|
|
2710
|
-
selectionMenu: isMultiSelected.value ? void 0 : __props.selectionMenu,
|
|
2711
|
-
style: blendStyle(annotation)
|
|
2712
|
-
}, { ref_for: true }, containerProps.value), createSlots({
|
|
2713
|
-
default: withCtx(({ annotation: currentObject }) => [
|
|
2714
|
-
createVNode(_sfc_main$g, mergeProps({ ref_for: true }, currentObject, {
|
|
2715
|
-
isSelected: isSelected(annotation),
|
|
2716
|
-
scale: __props.scale,
|
|
2717
|
-
onClick: (e) => handleClick(e, annotation)
|
|
2718
|
-
}), null, 16, ["isSelected", "scale", "onClick"])
|
|
2719
|
-
]),
|
|
2720
|
-
"resize-handle": withCtx((slotProps) => [
|
|
2721
|
-
renderSlot(_ctx.$slots, "resize-handle", mergeProps({ ref_for: true }, slotProps))
|
|
2722
|
-
]),
|
|
2723
|
-
"vertex-handle": withCtx((slotProps) => [
|
|
2724
|
-
renderSlot(_ctx.$slots, "vertex-handle", mergeProps({ ref_for: true }, slotProps))
|
|
2725
|
-
]),
|
|
2726
|
-
"rotation-handle": withCtx((slotProps) => [
|
|
2727
|
-
renderSlot(_ctx.$slots, "rotation-handle", mergeProps({ ref_for: true }, slotProps))
|
|
2728
|
-
]),
|
|
2729
|
-
_: 2
|
|
2730
|
-
}, [
|
|
2731
|
-
!isMultiSelected.value ? {
|
|
2732
|
-
name: "selection-menu",
|
|
2733
|
-
fn: withCtx((slotProps) => [
|
|
2734
|
-
renderSlot(_ctx.$slots, "selection-menu", mergeProps({ ref_for: true }, slotProps))
|
|
2735
|
-
]),
|
|
2736
|
-
key: "0"
|
|
2737
|
-
} : void 0
|
|
2738
|
-
]), 1040, ["trackedAnnotation", "isSelected", "isDraggable", "isResizable", "isRotatable", "lockAspectRatio", "onSelect", "vertexConfig", "selectionMenu", "style"])) : unref(isPolyline)(annotation) ? (openBlock(), createBlock(_sfc_main$l, mergeProps({
|
|
2739
|
-
key: 5,
|
|
2740
|
-
trackedAnnotation: annotation,
|
|
2741
|
-
isSelected: showIndividualSelection(annotation),
|
|
2742
|
-
isDraggable: isDraggable(annotation),
|
|
2743
|
-
isResizable: isResizable(annotation),
|
|
2744
|
-
isRotatable: isRotatableFor(annotation, true),
|
|
2745
|
-
lockAspectRatio: lockAspectRatio(annotation),
|
|
2746
|
-
onSelect: (e) => handleClick(e, annotation),
|
|
2747
|
-
vertexConfig: getVertexConfig(annotation),
|
|
2748
|
-
selectionMenu: isMultiSelected.value ? void 0 : __props.selectionMenu,
|
|
2749
|
-
style: blendStyle(annotation)
|
|
2750
|
-
}, { ref_for: true }, containerProps.value), createSlots({
|
|
2751
|
-
default: withCtx(({ annotation: currentObject }) => [
|
|
2752
|
-
createVNode(_sfc_main$d, mergeProps({ ref_for: true }, currentObject, {
|
|
2753
|
-
isSelected: isSelected(annotation),
|
|
2754
|
-
scale: __props.scale,
|
|
2755
|
-
onClick: (e) => handleClick(e, annotation)
|
|
2756
|
-
}), null, 16, ["isSelected", "scale", "onClick"])
|
|
2757
|
-
]),
|
|
2758
|
-
"resize-handle": withCtx((slotProps) => [
|
|
2759
|
-
renderSlot(_ctx.$slots, "resize-handle", mergeProps({ ref_for: true }, slotProps))
|
|
2760
|
-
]),
|
|
2761
|
-
"vertex-handle": withCtx((slotProps) => [
|
|
2762
|
-
renderSlot(_ctx.$slots, "vertex-handle", mergeProps({ ref_for: true }, slotProps))
|
|
2763
|
-
]),
|
|
2764
|
-
"rotation-handle": withCtx((slotProps) => [
|
|
2765
|
-
renderSlot(_ctx.$slots, "rotation-handle", mergeProps({ ref_for: true }, slotProps))
|
|
2766
|
-
]),
|
|
2767
|
-
_: 2
|
|
2768
|
-
}, [
|
|
2769
|
-
!isMultiSelected.value ? {
|
|
2770
|
-
name: "selection-menu",
|
|
2771
|
-
fn: withCtx((slotProps) => [
|
|
2772
|
-
renderSlot(_ctx.$slots, "selection-menu", mergeProps({ ref_for: true }, slotProps))
|
|
2773
|
-
]),
|
|
2774
|
-
key: "0"
|
|
2775
|
-
} : void 0
|
|
2776
|
-
]), 1040, ["trackedAnnotation", "isSelected", "isDraggable", "isResizable", "isRotatable", "lockAspectRatio", "onSelect", "vertexConfig", "selectionMenu", "style"])) : unref(isPolygon)(annotation) ? (openBlock(), createBlock(_sfc_main$l, mergeProps({
|
|
2777
|
-
key: 6,
|
|
2778
|
-
trackedAnnotation: annotation,
|
|
2779
|
-
isSelected: showIndividualSelection(annotation),
|
|
2780
|
-
isDraggable: isDraggable(annotation),
|
|
2781
|
-
isResizable: isResizable(annotation),
|
|
2782
|
-
isRotatable: isRotatableFor(annotation, true),
|
|
2783
|
-
lockAspectRatio: lockAspectRatio(annotation),
|
|
2784
|
-
onSelect: (e) => handleClick(e, annotation),
|
|
2785
|
-
vertexConfig: getVertexConfig(annotation),
|
|
2786
|
-
selectionMenu: isMultiSelected.value ? void 0 : __props.selectionMenu,
|
|
2787
|
-
style: blendStyle(annotation)
|
|
2788
|
-
}, { ref_for: true }, containerProps.value), createSlots({
|
|
2789
|
-
default: withCtx(({ annotation: currentObject }) => [
|
|
2790
|
-
createVNode(_sfc_main$e, mergeProps({ ref_for: true }, currentObject, {
|
|
2791
|
-
isSelected: isSelected(annotation),
|
|
2792
|
-
scale: __props.scale,
|
|
2793
|
-
onClick: (e) => handleClick(e, annotation)
|
|
2794
|
-
}), null, 16, ["isSelected", "scale", "onClick"])
|
|
2795
|
-
]),
|
|
2796
|
-
"resize-handle": withCtx((slotProps) => [
|
|
2797
|
-
renderSlot(_ctx.$slots, "resize-handle", mergeProps({ ref_for: true }, slotProps))
|
|
2798
|
-
]),
|
|
2799
|
-
"vertex-handle": withCtx((slotProps) => [
|
|
2800
|
-
renderSlot(_ctx.$slots, "vertex-handle", mergeProps({ ref_for: true }, slotProps))
|
|
2801
|
-
]),
|
|
2802
|
-
"rotation-handle": withCtx((slotProps) => [
|
|
2803
|
-
renderSlot(_ctx.$slots, "rotation-handle", mergeProps({ ref_for: true }, slotProps))
|
|
2804
|
-
]),
|
|
2805
|
-
_: 2
|
|
2806
|
-
}, [
|
|
2807
|
-
!isMultiSelected.value ? {
|
|
2808
|
-
name: "selection-menu",
|
|
2809
|
-
fn: withCtx((slotProps) => [
|
|
2810
|
-
renderSlot(_ctx.$slots, "selection-menu", mergeProps({ ref_for: true }, slotProps))
|
|
2811
|
-
]),
|
|
2812
|
-
key: "0"
|
|
2813
|
-
} : void 0
|
|
2814
|
-
]), 1040, ["trackedAnnotation", "isSelected", "isDraggable", "isResizable", "isRotatable", "lockAspectRatio", "onSelect", "vertexConfig", "selectionMenu", "style"])) : unref(isFreeText)(annotation) ? (openBlock(), createBlock(_sfc_main$l, mergeProps({
|
|
2815
|
-
key: 7,
|
|
3535
|
+
if ((_a = renderer.hideSelectionMenu) == null ? void 0 : _a.call(renderer, annotation.object)) return void 0;
|
|
3536
|
+
if (isMultiSelected.value) return void 0;
|
|
3537
|
+
return props.selectionMenu;
|
|
3538
|
+
};
|
|
3539
|
+
const getOnSelect = (annotation, renderer) => {
|
|
3540
|
+
if (renderer.selectOverride) {
|
|
3541
|
+
const selectHelpers = {
|
|
3542
|
+
defaultSelect: handleClick,
|
|
3543
|
+
selectAnnotation: (pi, id) => {
|
|
3544
|
+
var _a;
|
|
3545
|
+
return (_a = annotationProvides.value) == null ? void 0 : _a.selectAnnotation(pi, id);
|
|
3546
|
+
},
|
|
3547
|
+
clearSelection: () => {
|
|
3548
|
+
var _a;
|
|
3549
|
+
return (_a = selectionProvides.value) == null ? void 0 : _a.clear();
|
|
3550
|
+
},
|
|
3551
|
+
allAnnotations: annotations.value,
|
|
3552
|
+
pageIndex: props.pageIndex
|
|
3553
|
+
};
|
|
3554
|
+
return (e) => renderer.selectOverride(e, annotation, selectHelpers);
|
|
3555
|
+
}
|
|
3556
|
+
return (e) => handleClick(e, annotation);
|
|
3557
|
+
};
|
|
3558
|
+
const handlePointerDown = (_pos, pe) => {
|
|
3559
|
+
if (pe.target === pe.currentTarget && annotationProvides.value) {
|
|
3560
|
+
annotationProvides.value.deselectAnnotation();
|
|
3561
|
+
editingId.value = null;
|
|
3562
|
+
}
|
|
3563
|
+
};
|
|
3564
|
+
const handleClick = (e, annotation) => {
|
|
3565
|
+
e.stopPropagation();
|
|
3566
|
+
if (annotationProvides.value && selectionProvides.value) {
|
|
3567
|
+
selectionProvides.value.clear();
|
|
3568
|
+
const isModifierPressed = "metaKey" in e ? e.metaKey || e.ctrlKey : false;
|
|
3569
|
+
if (isModifierPressed) {
|
|
3570
|
+
annotationProvides.value.toggleSelection(props.pageIndex, annotation.object.id);
|
|
3571
|
+
} else {
|
|
3572
|
+
annotationProvides.value.selectAnnotation(props.pageIndex, annotation.object.id);
|
|
3573
|
+
}
|
|
3574
|
+
if (annotation.object.id !== editingId.value) {
|
|
3575
|
+
editingId.value = null;
|
|
3576
|
+
}
|
|
3577
|
+
}
|
|
3578
|
+
};
|
|
3579
|
+
const setEditingId = (id) => {
|
|
3580
|
+
editingId.value = id;
|
|
3581
|
+
};
|
|
3582
|
+
const pointerHandlers = { onPointerDown: handlePointerDown };
|
|
3583
|
+
watch(
|
|
3584
|
+
annotationProvides,
|
|
3585
|
+
(provides, _prev, onCleanup) => {
|
|
3586
|
+
if (!provides) return;
|
|
3587
|
+
const unregister = register(pointerHandlers);
|
|
3588
|
+
if (unregister) {
|
|
3589
|
+
onCleanup(unregister);
|
|
3590
|
+
}
|
|
3591
|
+
},
|
|
3592
|
+
{ immediate: true }
|
|
3593
|
+
);
|
|
3594
|
+
const selectedAnnotationsOnPage = computed(
|
|
3595
|
+
() => annotations.value.filter((anno) => allSelectedIds.value.includes(anno.object.id))
|
|
3596
|
+
);
|
|
3597
|
+
const areAllSelectedDraggable = computed(() => {
|
|
3598
|
+
if (selectedAnnotationsOnPage.value.length < 2) return false;
|
|
3599
|
+
return selectedAnnotationsOnPage.value.every((ta) => {
|
|
3600
|
+
var _a;
|
|
3601
|
+
const tool = (_a = annotationProvides.value) == null ? void 0 : _a.findToolForAnnotation(ta.object);
|
|
3602
|
+
const groupDraggable = resolveInteractionProp(
|
|
3603
|
+
tool == null ? void 0 : tool.interaction.isGroupDraggable,
|
|
3604
|
+
ta.object,
|
|
3605
|
+
true
|
|
3606
|
+
);
|
|
3607
|
+
const singleDraggable = resolveInteractionProp(tool == null ? void 0 : tool.interaction.isDraggable, ta.object, true);
|
|
3608
|
+
return (tool == null ? void 0 : tool.interaction.isGroupDraggable) !== void 0 ? groupDraggable : singleDraggable;
|
|
3609
|
+
});
|
|
3610
|
+
});
|
|
3611
|
+
const areAllSelectedResizable = computed(() => {
|
|
3612
|
+
if (selectedAnnotationsOnPage.value.length < 2) return false;
|
|
3613
|
+
return selectedAnnotationsOnPage.value.every((ta) => {
|
|
3614
|
+
var _a;
|
|
3615
|
+
const tool = (_a = annotationProvides.value) == null ? void 0 : _a.findToolForAnnotation(ta.object);
|
|
3616
|
+
const groupResizable = resolveInteractionProp(
|
|
3617
|
+
tool == null ? void 0 : tool.interaction.isGroupResizable,
|
|
3618
|
+
ta.object,
|
|
3619
|
+
true
|
|
3620
|
+
);
|
|
3621
|
+
const singleResizable = resolveInteractionProp(tool == null ? void 0 : tool.interaction.isResizable, ta.object, true);
|
|
3622
|
+
return (tool == null ? void 0 : tool.interaction.isGroupResizable) !== void 0 ? groupResizable : singleResizable;
|
|
3623
|
+
});
|
|
3624
|
+
});
|
|
3625
|
+
const areAllSelectedRotatable = computed(() => {
|
|
3626
|
+
if (selectedAnnotationsOnPage.value.length < 2) return false;
|
|
3627
|
+
return selectedAnnotationsOnPage.value.every((ta) => {
|
|
3628
|
+
var _a;
|
|
3629
|
+
const tool = (_a = annotationProvides.value) == null ? void 0 : _a.findToolForAnnotation(ta.object);
|
|
3630
|
+
const groupRotatable = resolveInteractionProp(
|
|
3631
|
+
tool == null ? void 0 : tool.interaction.isGroupRotatable,
|
|
3632
|
+
ta.object,
|
|
3633
|
+
true
|
|
3634
|
+
);
|
|
3635
|
+
const singleRotatable = resolveInteractionProp(tool == null ? void 0 : tool.interaction.isRotatable, ta.object, true);
|
|
3636
|
+
return (tool == null ? void 0 : tool.interaction.isGroupRotatable) !== void 0 ? groupRotatable : singleRotatable;
|
|
3637
|
+
});
|
|
3638
|
+
});
|
|
3639
|
+
const shouldLockGroupAspectRatio = computed(() => {
|
|
3640
|
+
if (selectedAnnotationsOnPage.value.length < 2) return false;
|
|
3641
|
+
return selectedAnnotationsOnPage.value.some((ta) => {
|
|
3642
|
+
var _a;
|
|
3643
|
+
const tool = (_a = annotationProvides.value) == null ? void 0 : _a.findToolForAnnotation(ta.object);
|
|
3644
|
+
const groupLock = resolveInteractionProp(
|
|
3645
|
+
tool == null ? void 0 : tool.interaction.lockGroupAspectRatio,
|
|
3646
|
+
ta.object,
|
|
3647
|
+
false
|
|
3648
|
+
);
|
|
3649
|
+
const singleLock = resolveInteractionProp(tool == null ? void 0 : tool.interaction.lockAspectRatio, ta.object, false);
|
|
3650
|
+
return (tool == null ? void 0 : tool.interaction.lockGroupAspectRatio) !== void 0 ? groupLock : singleLock;
|
|
3651
|
+
});
|
|
3652
|
+
});
|
|
3653
|
+
const allSelectedOnSamePage = computed(() => {
|
|
3654
|
+
if (!annotationProvides.value) return false;
|
|
3655
|
+
if (allSelectedIds.value.length < 2) return false;
|
|
3656
|
+
const allSelected = annotationProvides.value.getSelectedAnnotations();
|
|
3657
|
+
return allSelected.every((ta) => ta.object.pageIndex === props.pageIndex);
|
|
3658
|
+
});
|
|
3659
|
+
const getOnDoubleClick = (renderer, annotation) => {
|
|
3660
|
+
if (!renderer.onDoubleClick) return void 0;
|
|
3661
|
+
return (e) => {
|
|
3662
|
+
e.stopPropagation();
|
|
3663
|
+
renderer.onDoubleClick(annotation.object.id, setEditingId);
|
|
3664
|
+
};
|
|
3665
|
+
};
|
|
3666
|
+
const getContainerStyle = (annotation, renderer) => {
|
|
3667
|
+
var _a;
|
|
3668
|
+
return ((_a = renderer.containerStyle) == null ? void 0 : _a.call(renderer, annotation.object)) ?? {
|
|
3669
|
+
mixBlendMode: blendModeToCss(annotation.object.blendMode ?? PdfBlendMode.Normal)
|
|
3670
|
+
};
|
|
3671
|
+
};
|
|
3672
|
+
const getAppearance = (annotation, renderer) => {
|
|
3673
|
+
var _a, _b;
|
|
3674
|
+
const tool = (_a = annotationProvides.value) == null ? void 0 : _a.findToolForAnnotation(annotation.object);
|
|
3675
|
+
const useAP = ((_b = tool == null ? void 0 : tool.behavior) == null ? void 0 : _b.useAppearanceStream) ?? renderer.useAppearanceStream ?? true;
|
|
3676
|
+
return useAP ? getAppearanceForAnnotation(annotation) : void 0;
|
|
3677
|
+
};
|
|
3678
|
+
const containerProps = computed(() => {
|
|
3679
|
+
const {
|
|
3680
|
+
selectionMenu: _sm,
|
|
3681
|
+
groupSelectionMenu: _gsm,
|
|
3682
|
+
groupSelectionOutline: _gso,
|
|
3683
|
+
annotationRenderers: _ar,
|
|
3684
|
+
...rest
|
|
3685
|
+
} = props;
|
|
3686
|
+
return rest;
|
|
3687
|
+
});
|
|
3688
|
+
return (_ctx, _cache) => {
|
|
3689
|
+
return openBlock(), createElementBlock(Fragment, null, [
|
|
3690
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(resolvedAnnotations.value, ({ annotation, renderer }) => {
|
|
3691
|
+
return openBlock(), createElementBlock(Fragment, {
|
|
3692
|
+
key: annotation.object.id
|
|
3693
|
+
}, [
|
|
3694
|
+
renderer ? (openBlock(), createBlock(_sfc_main$C, mergeProps({
|
|
3695
|
+
key: 0,
|
|
2816
3696
|
trackedAnnotation: annotation,
|
|
2817
|
-
isSelected:
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
vertexConfig:
|
|
2825
|
-
selectionMenu:
|
|
2826
|
-
|
|
3697
|
+
isSelected: allSelectedIds.value.includes(annotation.object.id),
|
|
3698
|
+
isEditing: editingId.value === annotation.object.id,
|
|
3699
|
+
isMultiSelected: isMultiSelected.value,
|
|
3700
|
+
isDraggable: getFinalDraggable(annotation, renderer),
|
|
3701
|
+
isResizable: getResolvedResizable(annotation, renderer),
|
|
3702
|
+
lockAspectRatio: getResolvedLockAspectRatio(annotation, renderer),
|
|
3703
|
+
isRotatable: getResolvedRotatable(annotation, renderer),
|
|
3704
|
+
vertexConfig: renderer.vertexConfig,
|
|
3705
|
+
selectionMenu: getSelectionMenu(annotation, renderer),
|
|
3706
|
+
onSelect: getOnSelect(annotation, renderer),
|
|
3707
|
+
onDoubleClick: getOnDoubleClick(renderer, annotation),
|
|
3708
|
+
zIndex: renderer.zIndex,
|
|
3709
|
+
style: getContainerStyle(annotation, renderer),
|
|
3710
|
+
appearance: getAppearance(annotation, renderer)
|
|
2827
3711
|
}, { ref_for: true }, containerProps.value), createSlots({
|
|
2828
|
-
default: withCtx(({ annotation: currentObject }) => [
|
|
2829
|
-
|
|
2830
|
-
|
|
3712
|
+
default: withCtx(({ annotation: currentObject, appearanceActive }) => [
|
|
3713
|
+
(openBlock(), createBlock(resolveDynamicComponent(renderer.component), {
|
|
3714
|
+
annotation,
|
|
3715
|
+
currentObject,
|
|
3716
|
+
isSelected: allSelectedIds.value.includes(annotation.object.id),
|
|
2831
3717
|
isEditing: editingId.value === annotation.object.id,
|
|
2832
|
-
annotation: { ...annotation, object: currentObject },
|
|
2833
|
-
pageIndex: __props.pageIndex,
|
|
2834
3718
|
scale: __props.scale,
|
|
2835
|
-
onClick: (e) => handleClick(e, annotation)
|
|
2836
|
-
}, null, 8, ["isSelected", "isEditing", "annotation", "pageIndex", "scale", "onClick"])
|
|
2837
|
-
]),
|
|
2838
|
-
"resize-handle": withCtx((slotProps) => [
|
|
2839
|
-
renderSlot(_ctx.$slots, "resize-handle", mergeProps({ ref_for: true }, slotProps))
|
|
2840
|
-
]),
|
|
2841
|
-
"vertex-handle": withCtx((slotProps) => [
|
|
2842
|
-
renderSlot(_ctx.$slots, "vertex-handle", mergeProps({ ref_for: true }, slotProps))
|
|
2843
|
-
]),
|
|
2844
|
-
"rotation-handle": withCtx((slotProps) => [
|
|
2845
|
-
renderSlot(_ctx.$slots, "rotation-handle", mergeProps({ ref_for: true }, slotProps))
|
|
2846
|
-
]),
|
|
2847
|
-
_: 2
|
|
2848
|
-
}, [
|
|
2849
|
-
!isMultiSelected.value ? {
|
|
2850
|
-
name: "selection-menu",
|
|
2851
|
-
fn: withCtx((slotProps) => [
|
|
2852
|
-
renderSlot(_ctx.$slots, "selection-menu", mergeProps({ ref_for: true }, slotProps))
|
|
2853
|
-
]),
|
|
2854
|
-
key: "0"
|
|
2855
|
-
} : void 0
|
|
2856
|
-
]), 1040, ["trackedAnnotation", "isSelected", "isDraggable", "isResizable", "isRotatable", "lockAspectRatio", "onSelect", "onDoubleClick", "vertexConfig", "selectionMenu", "style"])) : unref(isStamp)(annotation) ? (openBlock(), createBlock(_sfc_main$l, mergeProps({
|
|
2857
|
-
key: 8,
|
|
2858
|
-
trackedAnnotation: annotation,
|
|
2859
|
-
isSelected: showIndividualSelection(annotation),
|
|
2860
|
-
isDraggable: isDraggable(annotation),
|
|
2861
|
-
isResizable: isResizable(annotation),
|
|
2862
|
-
isRotatable: isRotatableFor(annotation, true),
|
|
2863
|
-
lockAspectRatio: lockAspectRatio(annotation),
|
|
2864
|
-
onSelect: (e) => handleClick(e, annotation),
|
|
2865
|
-
vertexConfig: getVertexConfig(annotation),
|
|
2866
|
-
selectionMenu: isMultiSelected.value ? void 0 : __props.selectionMenu,
|
|
2867
|
-
style: blendStyle(annotation)
|
|
2868
|
-
}, { ref_for: true }, containerProps.value), createSlots({
|
|
2869
|
-
default: withCtx(() => [
|
|
2870
|
-
createVNode(_sfc_main$a, {
|
|
2871
|
-
documentId: __props.documentId,
|
|
2872
|
-
isSelected: isSelected(annotation),
|
|
2873
|
-
annotation,
|
|
2874
3719
|
pageIndex: __props.pageIndex,
|
|
2875
|
-
|
|
2876
|
-
onClick: (
|
|
2877
|
-
|
|
3720
|
+
documentId: __props.documentId,
|
|
3721
|
+
onClick: getOnSelect(annotation, renderer),
|
|
3722
|
+
appearanceActive
|
|
3723
|
+
}, null, 8, ["annotation", "currentObject", "isSelected", "isEditing", "scale", "pageIndex", "documentId", "onClick", "appearanceActive"]))
|
|
2878
3724
|
]),
|
|
2879
3725
|
"resize-handle": withCtx((slotProps) => [
|
|
2880
3726
|
renderSlot(_ctx.$slots, "resize-handle", mergeProps({ ref_for: true }, slotProps))
|
|
@@ -2894,159 +3740,10 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
2894
3740
|
]),
|
|
2895
3741
|
key: "0"
|
|
2896
3742
|
} : void 0
|
|
2897
|
-
]), 1040, ["trackedAnnotation", "isSelected", "isDraggable", "isResizable", "isRotatable", "
|
|
2898
|
-
key: 9,
|
|
2899
|
-
trackedAnnotation: annotation,
|
|
2900
|
-
isSelected: showIndividualSelection(annotation),
|
|
2901
|
-
isDraggable: isDraggable(annotation),
|
|
2902
|
-
isResizable: isResizable(annotation),
|
|
2903
|
-
isRotatable: isRotatableFor(annotation, false),
|
|
2904
|
-
lockAspectRatio: lockAspectRatio(annotation),
|
|
2905
|
-
onSelect: (e) => handleClick(e, annotation),
|
|
2906
|
-
vertexConfig: getVertexConfig(annotation),
|
|
2907
|
-
selectionMenu: isMultiSelected.value ? void 0 : __props.selectionMenu,
|
|
2908
|
-
zIndex: 0,
|
|
2909
|
-
style: blendStyle(annotation)
|
|
2910
|
-
}, { ref_for: true }, containerProps.value), createSlots({
|
|
2911
|
-
default: withCtx(({ annotation: currentObject }) => [
|
|
2912
|
-
createVNode(_sfc_main$6, mergeProps({ ref_for: true }, currentObject, {
|
|
2913
|
-
scale: __props.scale,
|
|
2914
|
-
onClick: (e) => handleClick(e, annotation)
|
|
2915
|
-
}), null, 16, ["scale", "onClick"])
|
|
2916
|
-
]),
|
|
2917
|
-
_: 2
|
|
2918
|
-
}, [
|
|
2919
|
-
!isMultiSelected.value ? {
|
|
2920
|
-
name: "selection-menu",
|
|
2921
|
-
fn: withCtx((slotProps) => [
|
|
2922
|
-
renderSlot(_ctx.$slots, "selection-menu", mergeProps({ ref_for: true }, slotProps))
|
|
2923
|
-
]),
|
|
2924
|
-
key: "0"
|
|
2925
|
-
} : void 0
|
|
2926
|
-
]), 1040, ["trackedAnnotation", "isSelected", "isDraggable", "isResizable", "isRotatable", "lockAspectRatio", "onSelect", "vertexConfig", "selectionMenu", "style"])) : unref(isStrikeout)(annotation) ? (openBlock(), createBlock(_sfc_main$l, mergeProps({
|
|
2927
|
-
key: 10,
|
|
2928
|
-
trackedAnnotation: annotation,
|
|
2929
|
-
isSelected: showIndividualSelection(annotation),
|
|
2930
|
-
isDraggable: isDraggable(annotation),
|
|
2931
|
-
isResizable: isResizable(annotation),
|
|
2932
|
-
isRotatable: isRotatableFor(annotation, false),
|
|
2933
|
-
lockAspectRatio: lockAspectRatio(annotation),
|
|
2934
|
-
onSelect: (e) => handleClick(e, annotation),
|
|
2935
|
-
vertexConfig: getVertexConfig(annotation),
|
|
2936
|
-
selectionMenu: isMultiSelected.value ? void 0 : __props.selectionMenu,
|
|
2937
|
-
zIndex: 0,
|
|
2938
|
-
style: blendStyle(annotation)
|
|
2939
|
-
}, { ref_for: true }, containerProps.value), createSlots({
|
|
2940
|
-
default: withCtx(({ annotation: currentObject }) => [
|
|
2941
|
-
createVNode(_sfc_main$7, mergeProps({ ref_for: true }, currentObject, {
|
|
2942
|
-
scale: __props.scale,
|
|
2943
|
-
onClick: (e) => handleClick(e, annotation)
|
|
2944
|
-
}), null, 16, ["scale", "onClick"])
|
|
2945
|
-
]),
|
|
2946
|
-
_: 2
|
|
2947
|
-
}, [
|
|
2948
|
-
!isMultiSelected.value ? {
|
|
2949
|
-
name: "selection-menu",
|
|
2950
|
-
fn: withCtx((slotProps) => [
|
|
2951
|
-
renderSlot(_ctx.$slots, "selection-menu", mergeProps({ ref_for: true }, slotProps))
|
|
2952
|
-
]),
|
|
2953
|
-
key: "0"
|
|
2954
|
-
} : void 0
|
|
2955
|
-
]), 1040, ["trackedAnnotation", "isSelected", "isDraggable", "isResizable", "isRotatable", "lockAspectRatio", "onSelect", "vertexConfig", "selectionMenu", "style"])) : unref(isSquiggly)(annotation) ? (openBlock(), createBlock(_sfc_main$l, mergeProps({
|
|
2956
|
-
key: 11,
|
|
2957
|
-
trackedAnnotation: annotation,
|
|
2958
|
-
isSelected: showIndividualSelection(annotation),
|
|
2959
|
-
isDraggable: isDraggable(annotation),
|
|
2960
|
-
isResizable: isResizable(annotation),
|
|
2961
|
-
isRotatable: isRotatableFor(annotation, false),
|
|
2962
|
-
lockAspectRatio: lockAspectRatio(annotation),
|
|
2963
|
-
onSelect: (e) => handleClick(e, annotation),
|
|
2964
|
-
vertexConfig: getVertexConfig(annotation),
|
|
2965
|
-
selectionMenu: isMultiSelected.value ? void 0 : __props.selectionMenu,
|
|
2966
|
-
zIndex: 0,
|
|
2967
|
-
style: blendStyle(annotation)
|
|
2968
|
-
}, { ref_for: true }, containerProps.value), createSlots({
|
|
2969
|
-
default: withCtx(({ annotation: currentObject }) => [
|
|
2970
|
-
createVNode(_sfc_main$8, mergeProps({ ref_for: true }, currentObject, {
|
|
2971
|
-
scale: __props.scale,
|
|
2972
|
-
onClick: (e) => handleClick(e, annotation)
|
|
2973
|
-
}), null, 16, ["scale", "onClick"])
|
|
2974
|
-
]),
|
|
2975
|
-
_: 2
|
|
2976
|
-
}, [
|
|
2977
|
-
!isMultiSelected.value ? {
|
|
2978
|
-
name: "selection-menu",
|
|
2979
|
-
fn: withCtx((slotProps) => [
|
|
2980
|
-
renderSlot(_ctx.$slots, "selection-menu", mergeProps({ ref_for: true }, slotProps))
|
|
2981
|
-
]),
|
|
2982
|
-
key: "0"
|
|
2983
|
-
} : void 0
|
|
2984
|
-
]), 1040, ["trackedAnnotation", "isSelected", "isDraggable", "isResizable", "isRotatable", "lockAspectRatio", "onSelect", "vertexConfig", "selectionMenu", "style"])) : unref(isHighlight)(annotation) ? (openBlock(), createBlock(_sfc_main$l, mergeProps({
|
|
2985
|
-
key: 12,
|
|
2986
|
-
trackedAnnotation: annotation,
|
|
2987
|
-
isSelected: showIndividualSelection(annotation),
|
|
2988
|
-
isDraggable: isDraggable(annotation),
|
|
2989
|
-
isResizable: isResizable(annotation),
|
|
2990
|
-
isRotatable: isRotatableFor(annotation, false),
|
|
2991
|
-
lockAspectRatio: lockAspectRatio(annotation),
|
|
2992
|
-
onSelect: (e) => handleClick(e, annotation),
|
|
2993
|
-
vertexConfig: getVertexConfig(annotation),
|
|
2994
|
-
selectionMenu: isMultiSelected.value ? void 0 : __props.selectionMenu,
|
|
2995
|
-
zIndex: 0,
|
|
2996
|
-
style: blendStyle(annotation, unref(PdfBlendMode).Multiply)
|
|
2997
|
-
}, { ref_for: true }, containerProps.value), createSlots({
|
|
2998
|
-
default: withCtx(({ annotation: currentObject }) => [
|
|
2999
|
-
createVNode(_sfc_main$9, mergeProps({ ref_for: true }, currentObject, {
|
|
3000
|
-
scale: __props.scale,
|
|
3001
|
-
onClick: (e) => handleClick(e, annotation)
|
|
3002
|
-
}), null, 16, ["scale", "onClick"])
|
|
3003
|
-
]),
|
|
3004
|
-
_: 2
|
|
3005
|
-
}, [
|
|
3006
|
-
!isMultiSelected.value ? {
|
|
3007
|
-
name: "selection-menu",
|
|
3008
|
-
fn: withCtx((slotProps) => [
|
|
3009
|
-
renderSlot(_ctx.$slots, "selection-menu", mergeProps({ ref_for: true }, slotProps))
|
|
3010
|
-
]),
|
|
3011
|
-
key: "0"
|
|
3012
|
-
} : void 0
|
|
3013
|
-
]), 1040, ["trackedAnnotation", "isSelected", "isDraggable", "isResizable", "isRotatable", "lockAspectRatio", "onSelect", "vertexConfig", "selectionMenu", "style"])) : unref(isLink)(annotation) ? (openBlock(), createBlock(_sfc_main$l, mergeProps({
|
|
3014
|
-
key: 13,
|
|
3015
|
-
trackedAnnotation: annotation,
|
|
3016
|
-
isSelected: showIndividualSelection(annotation),
|
|
3017
|
-
isMultiSelected: isMultiSelected.value,
|
|
3018
|
-
isDraggable: false,
|
|
3019
|
-
isResizable: false,
|
|
3020
|
-
isRotatable: false,
|
|
3021
|
-
lockAspectRatio: false,
|
|
3022
|
-
onSelect: (e) => handleLinkClick(e, annotation),
|
|
3023
|
-
selectionMenu: annotation.object.inReplyToId ? void 0 : isMultiSelected.value ? void 0 : __props.selectionMenu,
|
|
3024
|
-
style: blendStyle(annotation)
|
|
3025
|
-
}, { ref_for: true }, containerProps.value), createSlots({
|
|
3026
|
-
default: withCtx(({ annotation: currentObject }) => [
|
|
3027
|
-
createVNode(_sfc_main$f, mergeProps({ ref_for: true }, currentObject, {
|
|
3028
|
-
isSelected: isSelected(annotation),
|
|
3029
|
-
scale: __props.scale,
|
|
3030
|
-
onClick: (e) => handleLinkClick(e, annotation),
|
|
3031
|
-
hasIRT: !!annotation.object.inReplyToId
|
|
3032
|
-
}), null, 16, ["isSelected", "scale", "onClick", "hasIRT"])
|
|
3033
|
-
]),
|
|
3034
|
-
"resize-handle": withCtx((slotProps) => [
|
|
3035
|
-
renderSlot(_ctx.$slots, "resize-handle", mergeProps({ ref_for: true }, slotProps))
|
|
3036
|
-
]),
|
|
3037
|
-
_: 2
|
|
3038
|
-
}, [
|
|
3039
|
-
!isMultiSelected.value && !annotation.object.inReplyToId ? {
|
|
3040
|
-
name: "selection-menu",
|
|
3041
|
-
fn: withCtx((slotProps) => [
|
|
3042
|
-
renderSlot(_ctx.$slots, "selection-menu", mergeProps({ ref_for: true }, slotProps))
|
|
3043
|
-
]),
|
|
3044
|
-
key: "0"
|
|
3045
|
-
} : void 0
|
|
3046
|
-
]), 1040, ["trackedAnnotation", "isSelected", "isMultiSelected", "onSelect", "selectionMenu", "style"])) : createCommentVNode("", true)
|
|
3743
|
+
]), 1040, ["trackedAnnotation", "isSelected", "isEditing", "isMultiSelected", "isDraggable", "isResizable", "lockAspectRatio", "isRotatable", "vertexConfig", "selectionMenu", "onSelect", "onDoubleClick", "zIndex", "style", "appearance"])) : createCommentVNode("", true)
|
|
3047
3744
|
], 64);
|
|
3048
3745
|
}), 128)),
|
|
3049
|
-
allSelectedOnSamePage.value && selectedAnnotationsOnPage.value.length >= 2 ? (openBlock(), createBlock(_sfc_main$
|
|
3746
|
+
allSelectedOnSamePage.value && selectedAnnotationsOnPage.value.length >= 2 ? (openBlock(), createBlock(_sfc_main$B, {
|
|
3050
3747
|
key: 0,
|
|
3051
3748
|
documentId: __props.documentId,
|
|
3052
3749
|
pageIndex: __props.pageIndex,
|
|
@@ -3065,7 +3762,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
3065
3762
|
selectionOutline: __props.groupSelectionOutline ?? __props.selectionOutline,
|
|
3066
3763
|
groupSelectionMenu: __props.groupSelectionMenu
|
|
3067
3764
|
}, {
|
|
3068
|
-
"
|
|
3765
|
+
"selection-menu": withCtx((slotProps) => [
|
|
3069
3766
|
renderSlot(_ctx.$slots, "group-selection-menu", normalizeProps(guardReactiveProps(slotProps)))
|
|
3070
3767
|
]),
|
|
3071
3768
|
"resize-handle": withCtx((slotProps) => [
|
|
@@ -3129,25 +3826,25 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
3129
3826
|
inset: 0
|
|
3130
3827
|
})
|
|
3131
3828
|
}, [
|
|
3132
|
-
activeTool.value.defaults.type === unref(PdfAnnotationSubtype).HIGHLIGHT ? (openBlock(), createBlock(_sfc_main$
|
|
3829
|
+
activeTool.value.defaults.type === unref(PdfAnnotationSubtype).HIGHLIGHT ? (openBlock(), createBlock(_sfc_main$h, {
|
|
3133
3830
|
key: 0,
|
|
3134
3831
|
strokeColor: activeTool.value.defaults.strokeColor,
|
|
3135
3832
|
opacity: activeTool.value.defaults.opacity,
|
|
3136
3833
|
segmentRects: rects.value,
|
|
3137
3834
|
scale: __props.scale
|
|
3138
|
-
}, null, 8, ["strokeColor", "opacity", "segmentRects", "scale"])) : activeTool.value.defaults.type === unref(PdfAnnotationSubtype).UNDERLINE ? (openBlock(), createBlock(_sfc_main$
|
|
3835
|
+
}, null, 8, ["strokeColor", "opacity", "segmentRects", "scale"])) : activeTool.value.defaults.type === unref(PdfAnnotationSubtype).UNDERLINE ? (openBlock(), createBlock(_sfc_main$f, {
|
|
3139
3836
|
key: 1,
|
|
3140
3837
|
strokeColor: activeTool.value.defaults.strokeColor,
|
|
3141
3838
|
opacity: activeTool.value.defaults.opacity,
|
|
3142
3839
|
segmentRects: rects.value,
|
|
3143
3840
|
scale: __props.scale
|
|
3144
|
-
}, null, 8, ["strokeColor", "opacity", "segmentRects", "scale"])) : activeTool.value.defaults.type === unref(PdfAnnotationSubtype).STRIKEOUT ? (openBlock(), createBlock(_sfc_main$
|
|
3841
|
+
}, null, 8, ["strokeColor", "opacity", "segmentRects", "scale"])) : activeTool.value.defaults.type === unref(PdfAnnotationSubtype).STRIKEOUT ? (openBlock(), createBlock(_sfc_main$d, {
|
|
3145
3842
|
key: 2,
|
|
3146
3843
|
strokeColor: activeTool.value.defaults.strokeColor,
|
|
3147
3844
|
opacity: activeTool.value.defaults.opacity,
|
|
3148
3845
|
segmentRects: rects.value,
|
|
3149
3846
|
scale: __props.scale
|
|
3150
|
-
}, null, 8, ["strokeColor", "opacity", "segmentRects", "scale"])) : activeTool.value.defaults.type === unref(PdfAnnotationSubtype).SQUIGGLY ? (openBlock(), createBlock(_sfc_main$
|
|
3847
|
+
}, null, 8, ["strokeColor", "opacity", "segmentRects", "scale"])) : activeTool.value.defaults.type === unref(PdfAnnotationSubtype).SQUIGGLY ? (openBlock(), createBlock(_sfc_main$b, {
|
|
3151
3848
|
key: 3,
|
|
3152
3849
|
strokeColor: activeTool.value.defaults.strokeColor,
|
|
3153
3850
|
opacity: activeTool.value.defaults.opacity,
|
|
@@ -3179,27 +3876,27 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
3179
3876
|
return openBlock(), createElementBlock("div", {
|
|
3180
3877
|
style: normalizeStyle(style.value)
|
|
3181
3878
|
}, [
|
|
3182
|
-
__props.preview.type === unref(PdfAnnotationSubtype).CIRCLE ? (openBlock(), createBlock(unref(_sfc_main$
|
|
3879
|
+
__props.preview.type === unref(PdfAnnotationSubtype).CIRCLE ? (openBlock(), createBlock(unref(_sfc_main$w), mergeProps({
|
|
3183
3880
|
key: 0,
|
|
3184
3881
|
isSelected: false,
|
|
3185
3882
|
scale: __props.scale
|
|
3186
|
-
}, __props.preview.data), null, 16, ["scale"])) : __props.preview.type === unref(PdfAnnotationSubtype).SQUARE ? (openBlock(), createBlock(unref(_sfc_main$
|
|
3883
|
+
}, __props.preview.data), null, 16, ["scale"])) : __props.preview.type === unref(PdfAnnotationSubtype).SQUARE ? (openBlock(), createBlock(unref(_sfc_main$y), mergeProps({
|
|
3187
3884
|
key: 1,
|
|
3188
3885
|
isSelected: false,
|
|
3189
3886
|
scale: __props.scale
|
|
3190
|
-
}, __props.preview.data), null, 16, ["scale"])) : __props.preview.type === unref(PdfAnnotationSubtype).POLYGON ? (openBlock(), createBlock(unref(_sfc_main$
|
|
3887
|
+
}, __props.preview.data), null, 16, ["scale"])) : __props.preview.type === unref(PdfAnnotationSubtype).POLYGON ? (openBlock(), createBlock(unref(_sfc_main$q), mergeProps({
|
|
3191
3888
|
key: 2,
|
|
3192
3889
|
isSelected: false,
|
|
3193
3890
|
scale: __props.scale
|
|
3194
|
-
}, __props.preview.data), null, 16, ["scale"])) : __props.preview.type === unref(PdfAnnotationSubtype).POLYLINE ? (openBlock(), createBlock(unref(_sfc_main$
|
|
3891
|
+
}, __props.preview.data), null, 16, ["scale"])) : __props.preview.type === unref(PdfAnnotationSubtype).POLYLINE ? (openBlock(), createBlock(unref(_sfc_main$s), mergeProps({
|
|
3195
3892
|
key: 3,
|
|
3196
3893
|
isSelected: false,
|
|
3197
3894
|
scale: __props.scale
|
|
3198
|
-
}, __props.preview.data), null, 16, ["scale"])) : __props.preview.type === unref(PdfAnnotationSubtype).LINE ? (openBlock(), createBlock(unref(_sfc_main$
|
|
3895
|
+
}, __props.preview.data), null, 16, ["scale"])) : __props.preview.type === unref(PdfAnnotationSubtype).LINE ? (openBlock(), createBlock(unref(_sfc_main$u), mergeProps({
|
|
3199
3896
|
key: 4,
|
|
3200
3897
|
isSelected: false,
|
|
3201
3898
|
scale: __props.scale
|
|
3202
|
-
}, __props.preview.data), null, 16, ["scale"])) : __props.preview.type === unref(PdfAnnotationSubtype).INK ? (openBlock(), createBlock(unref(_sfc_main$
|
|
3899
|
+
}, __props.preview.data), null, 16, ["scale"])) : __props.preview.type === unref(PdfAnnotationSubtype).INK ? (openBlock(), createBlock(unref(_sfc_main$A), mergeProps({
|
|
3203
3900
|
key: 5,
|
|
3204
3901
|
isSelected: false,
|
|
3205
3902
|
scale: __props.scale
|
|
@@ -3317,45 +4014,6 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
3317
4014
|
};
|
|
3318
4015
|
}
|
|
3319
4016
|
});
|
|
3320
|
-
const RendererRegistryKey = Symbol(
|
|
3321
|
-
"AnnotationRendererRegistry"
|
|
3322
|
-
);
|
|
3323
|
-
function createRendererRegistry() {
|
|
3324
|
-
const renderers = shallowRef([]);
|
|
3325
|
-
return {
|
|
3326
|
-
register(entries) {
|
|
3327
|
-
const ids = new Set(entries.map((e) => e.id));
|
|
3328
|
-
renderers.value = [...renderers.value.filter((r) => !ids.has(r.id)), ...entries];
|
|
3329
|
-
return () => {
|
|
3330
|
-
renderers.value = renderers.value.filter((r) => !entries.some((e) => e.id === r.id));
|
|
3331
|
-
};
|
|
3332
|
-
},
|
|
3333
|
-
getAll() {
|
|
3334
|
-
return renderers.value;
|
|
3335
|
-
}
|
|
3336
|
-
};
|
|
3337
|
-
}
|
|
3338
|
-
function provideRendererRegistry() {
|
|
3339
|
-
const registry = createRendererRegistry();
|
|
3340
|
-
provide(RendererRegistryKey, registry);
|
|
3341
|
-
return registry;
|
|
3342
|
-
}
|
|
3343
|
-
function useRendererRegistry() {
|
|
3344
|
-
return inject(RendererRegistryKey, null);
|
|
3345
|
-
}
|
|
3346
|
-
function useRegisterRenderers(entries) {
|
|
3347
|
-
const registry = useRendererRegistry();
|
|
3348
|
-
if (!registry) return;
|
|
3349
|
-
const unregister = registry.register(entries);
|
|
3350
|
-
onUnmounted(unregister);
|
|
3351
|
-
}
|
|
3352
|
-
function createRenderer(entry) {
|
|
3353
|
-
return {
|
|
3354
|
-
id: entry.id,
|
|
3355
|
-
matches: entry.matches,
|
|
3356
|
-
component: markRaw(entry.component)
|
|
3357
|
-
};
|
|
3358
|
-
}
|
|
3359
4017
|
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
3360
4018
|
__name: "annotation-layer",
|
|
3361
4019
|
props: {
|
|
@@ -3489,29 +4147,30 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
3489
4147
|
});
|
|
3490
4148
|
const AnnotationPluginPackage = createPluginPackage(AnnotationPluginPackage$1).addWrapper(_sfc_main).build();
|
|
3491
4149
|
export {
|
|
3492
|
-
_sfc_main$
|
|
4150
|
+
_sfc_main$C as AnnotationContainer,
|
|
3493
4151
|
_sfc_main$1 as AnnotationLayer,
|
|
3494
4152
|
_sfc_main$2 as AnnotationPaintLayer,
|
|
3495
4153
|
AnnotationPluginPackage,
|
|
3496
4154
|
_sfc_main$5 as Annotations,
|
|
3497
|
-
_sfc_main$
|
|
3498
|
-
_sfc_main$
|
|
3499
|
-
_sfc_main$
|
|
3500
|
-
_sfc_main$
|
|
3501
|
-
_sfc_main$
|
|
3502
|
-
_sfc_main$
|
|
3503
|
-
_sfc_main$
|
|
3504
|
-
_sfc_main$
|
|
3505
|
-
_sfc_main$
|
|
4155
|
+
_sfc_main$w as Circle,
|
|
4156
|
+
_sfc_main$o as FreeText,
|
|
4157
|
+
_sfc_main$B as GroupSelectionBox,
|
|
4158
|
+
_sfc_main$h as Highlight,
|
|
4159
|
+
_sfc_main$A as Ink,
|
|
4160
|
+
_sfc_main$u as Line,
|
|
4161
|
+
_sfc_main$j as Link,
|
|
4162
|
+
_sfc_main$q as Polygon,
|
|
4163
|
+
_sfc_main$s as Polyline,
|
|
3506
4164
|
_sfc_main$3 as PreviewRenderer,
|
|
3507
|
-
_sfc_main$
|
|
4165
|
+
_sfc_main$m as RenderAnnotation,
|
|
3508
4166
|
_sfc_main as RendererRegistryProvider,
|
|
3509
|
-
_sfc_main$
|
|
3510
|
-
_sfc_main$
|
|
3511
|
-
_sfc_main$
|
|
3512
|
-
_sfc_main$
|
|
4167
|
+
_sfc_main$y as Square,
|
|
4168
|
+
_sfc_main$b as Squiggly,
|
|
4169
|
+
_sfc_main$l as Stamp,
|
|
4170
|
+
_sfc_main$d as Strikeout,
|
|
4171
|
+
_sfc_main$7 as Text,
|
|
3513
4172
|
_sfc_main$4 as TextMarkup,
|
|
3514
|
-
_sfc_main$
|
|
4173
|
+
_sfc_main$f as Underline,
|
|
3515
4174
|
createRenderer,
|
|
3516
4175
|
createRendererRegistry,
|
|
3517
4176
|
provideRendererRegistry,
|