@embedpdf/plugin-annotation 2.8.0 → 2.9.1
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 +829 -148
- package/dist/index.js.map +1 -1
- package/dist/lib/geometry/cloudy-border.d.ts +90 -0
- package/dist/lib/geometry/index.d.ts +1 -0
- package/dist/lib/handlers/types.d.ts +2 -1
- package/dist/lib/tools/default-tools.d.ts +43 -88
- package/dist/lib/tools/types.d.ts +34 -1
- package/dist/lib/types.d.ts +3 -0
- package/dist/preact/index.cjs +1 -1
- package/dist/preact/index.cjs.map +1 -1
- package/dist/preact/index.js +371 -242
- 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 +371 -242
- package/dist/react/index.js.map +1 -1
- package/dist/shared/components/annotation-container.d.ts +4 -2
- package/dist/shared/components/annotations/circle.d.ts +6 -2
- package/dist/shared/components/annotations/polygon.d.ts +3 -1
- package/dist/shared/components/annotations/square.d.ts +6 -2
- package/dist/shared/components/types.d.ts +6 -2
- package/dist/shared-preact/components/annotation-container.d.ts +4 -2
- package/dist/shared-preact/components/annotations/circle.d.ts +6 -2
- package/dist/shared-preact/components/annotations/polygon.d.ts +3 -1
- package/dist/shared-preact/components/annotations/square.d.ts +6 -2
- package/dist/shared-preact/components/types.d.ts +6 -2
- package/dist/shared-react/components/annotation-container.d.ts +4 -2
- package/dist/shared-react/components/annotations/circle.d.ts +6 -2
- package/dist/shared-react/components/annotations/polygon.d.ts +3 -1
- package/dist/shared-react/components/annotations/square.d.ts +6 -2
- package/dist/shared-react/components/types.d.ts +6 -2
- package/dist/svelte/components/annotations/Circle.svelte.d.ts +3 -1
- package/dist/svelte/components/annotations/Polygon.svelte.d.ts +1 -0
- package/dist/svelte/components/annotations/Square.svelte.d.ts +3 -1
- package/dist/svelte/components/types.d.ts +2 -1
- package/dist/svelte/context/types.d.ts +6 -2
- package/dist/svelte/index.cjs +1 -1
- package/dist/svelte/index.cjs.map +1 -1
- package/dist/svelte/index.js +525 -298
- package/dist/svelte/index.js.map +1 -1
- package/dist/vue/components/annotation-container.vue.d.ts +7 -6
- package/dist/vue/components/annotations/circle.vue.d.ts +5 -1
- package/dist/vue/components/annotations/polygon.vue.d.ts +2 -0
- package/dist/vue/components/annotations/square.vue.d.ts +5 -1
- package/dist/vue/components/annotations.vue.d.ts +8 -9
- package/dist/vue/context/types.d.ts +6 -2
- package/dist/vue/index.cjs +1 -1
- package/dist/vue/index.cjs.map +1 -1
- package/dist/vue/index.js +289 -135
- package/dist/vue/index.js.map +1 -1
- package/package.json +10 -10
package/dist/vue/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { createPluginPackage } from "@embedpdf/core";
|
|
2
|
-
import { AnnotationPlugin, initialDocumentState, inferRotationCenterFromRects, patching, resolveInteractionProp, getAnnotationsByPageIndex, getSelectedAnnotationIds, AnnotationPluginPackage as AnnotationPluginPackage$1 } from "@embedpdf/plugin-annotation";
|
|
2
|
+
import { AnnotationPlugin, initialDocumentState, inferRotationCenterFromRects, generateCloudyRectanglePath, generateCloudyEllipsePath, patching, generateCloudyPolygonPath, resolveInteractionProp, getAnnotationsByPageIndex, getSelectedAnnotationIds, AnnotationPluginPackage as AnnotationPluginPackage$1 } from "@embedpdf/plugin-annotation";
|
|
3
3
|
export * from "@embedpdf/plugin-annotation";
|
|
4
|
-
import { defineComponent, ref, watchEffect, openBlock, createElementBlock, normalizeStyle, createCommentVNode, toValue, watch, computed, shallowRef, toRaw, useSlots, createElementVNode, Fragment, unref,
|
|
4
|
+
import { defineComponent, ref, watchEffect, openBlock, createElementBlock, normalizeStyle, createCommentVNode, toValue, watch, computed, shallowRef, toRaw, useSlots, createElementVNode, renderSlot, createBlock, Fragment, unref, normalizeProps, mergeProps, renderList, withCtx, resolveDynamicComponent, Teleport, toDisplayString, markRaw, provide, inject, onUnmounted, onMounted, nextTick, createVNode, createSlots, guardReactiveProps } from "vue";
|
|
5
5
|
import { getCounterRotation } from "@embedpdf/utils";
|
|
6
6
|
import { useInteractionHandles, useDoublePressProps, CounterRotate, deepToRaw } from "@embedpdf/utils/vue";
|
|
7
7
|
import { useCapability, usePlugin, useDocumentPermissions, useDocumentState } from "@embedpdf/core/vue";
|
|
8
|
-
import { boundingRectOrEmpty, PdfAnnotationBorderStyle, PdfVerticalAlignment, textAlignmentToCss, standardFontCssProperties, ignore, PdfErrorCode, getContrastStrokeColor, PdfAnnotationSubtype, blendModeToCss
|
|
8
|
+
import { boundingRectOrEmpty, PdfAnnotationBorderStyle, PdfVerticalAlignment, textAlignmentToCss, standardFontCssProperties, ignore, PdfErrorCode, getContrastStrokeColor, PdfBlendMode, PdfAnnotationSubtype, blendModeToCss } from "@embedpdf/models";
|
|
9
9
|
import { usePointerHandlers } from "@embedpdf/plugin-interaction-manager/vue";
|
|
10
10
|
import { useSelectionCapability } from "@embedpdf/plugin-selection/vue";
|
|
11
11
|
const _hoisted_1$d = ["src"];
|
|
@@ -121,6 +121,7 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
|
|
|
121
121
|
resizeUi: {},
|
|
122
122
|
vertexUi: {},
|
|
123
123
|
rotationUi: {},
|
|
124
|
+
blendMode: {},
|
|
124
125
|
style: {}
|
|
125
126
|
},
|
|
126
127
|
setup(__props) {
|
|
@@ -509,7 +510,7 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
|
|
|
509
510
|
}
|
|
510
511
|
);
|
|
511
512
|
const contentsStyle = { display: "contents" };
|
|
512
|
-
const
|
|
513
|
+
const layerBaseStyle = computed(() => ({
|
|
513
514
|
position: "absolute",
|
|
514
515
|
left: `${currentObject.value.rect.origin.x * props.scale}px`,
|
|
515
516
|
top: `${currentObject.value.rect.origin.y * props.scale}px`,
|
|
@@ -517,8 +518,23 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
|
|
|
517
518
|
height: `${counterRot.value ? counterRot.value.height : aabbHeight.value}px`,
|
|
518
519
|
pointerEvents: "none",
|
|
519
520
|
zIndex: props.zIndex,
|
|
520
|
-
...counterRot.value ? { transform: counterRot.value.matrix, transformOrigin: "0 0" } : {}
|
|
521
|
-
|
|
521
|
+
...counterRot.value ? { transform: counterRot.value.matrix, transformOrigin: "0 0" } : {}
|
|
522
|
+
}));
|
|
523
|
+
const visualLayerStyle = computed(() => ({
|
|
524
|
+
...layerBaseStyle.value,
|
|
525
|
+
...props.blendMode ? { mixBlendMode: props.blendMode } : {},
|
|
526
|
+
...props.style
|
|
527
|
+
}));
|
|
528
|
+
const outerAABBStyle = computed(() => layerBaseStyle.value);
|
|
529
|
+
const visualInnerStyle = computed(() => ({
|
|
530
|
+
position: "absolute",
|
|
531
|
+
left: `${innerLeft.value}px`,
|
|
532
|
+
top: `${innerTop.value}px`,
|
|
533
|
+
width: `${innerWidth.value}px`,
|
|
534
|
+
height: `${innerHeight.value}px`,
|
|
535
|
+
transform: annotationRotation.value !== 0 ? `rotate(${annotationRotation.value}deg)` : void 0,
|
|
536
|
+
transformOrigin: innerTransformOrigin.value,
|
|
537
|
+
pointerEvents: props.isEditing ? "auto" : "none"
|
|
522
538
|
}));
|
|
523
539
|
const innerRotatedStyle = computed(() => ({
|
|
524
540
|
position: "absolute",
|
|
@@ -530,7 +546,7 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
|
|
|
530
546
|
transformOrigin: innerTransformOrigin.value,
|
|
531
547
|
outline: showOutline.value ? `${outlineWidth.value}px ${outlineStyle.value} ${outlineColor.value}` : "none",
|
|
532
548
|
outlineOffset: showOutline.value ? `${outlineOff.value}px` : "0px",
|
|
533
|
-
pointerEvents: props.isSelected && !props.isMultiSelected ? "auto" : "none",
|
|
549
|
+
pointerEvents: props.isSelected && !props.isMultiSelected && !props.isEditing ? "auto" : "none",
|
|
534
550
|
touchAction: "none",
|
|
535
551
|
cursor: props.isSelected && effectiveIsDraggable.value ? "move" : "default"
|
|
536
552
|
}));
|
|
@@ -630,6 +646,23 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
|
|
|
630
646
|
"data-no-interaction": "",
|
|
631
647
|
style: contentsStyle
|
|
632
648
|
}, [
|
|
649
|
+
createElementVNode("div", {
|
|
650
|
+
style: normalizeStyle(visualLayerStyle.value)
|
|
651
|
+
}, [
|
|
652
|
+
createElementVNode("div", {
|
|
653
|
+
style: normalizeStyle(visualInnerStyle.value)
|
|
654
|
+
}, [
|
|
655
|
+
renderSlot(_ctx.$slots, "default", {
|
|
656
|
+
annotation: childObject.value,
|
|
657
|
+
appearanceActive: apActive.value
|
|
658
|
+
}),
|
|
659
|
+
((_a = __props.appearance) == null ? void 0 : _a.normal) ? (openBlock(), createBlock(_sfc_main$D, {
|
|
660
|
+
key: 0,
|
|
661
|
+
appearance: __props.appearance.normal,
|
|
662
|
+
style: normalizeStyle({ display: apActive.value ? "block" : "none" })
|
|
663
|
+
}, null, 8, ["appearance", "style"])) : createCommentVNode("", true)
|
|
664
|
+
], 4)
|
|
665
|
+
], 4),
|
|
633
666
|
createElementVNode("div", {
|
|
634
667
|
style: normalizeStyle(outerAABBStyle.value)
|
|
635
668
|
}, [
|
|
@@ -691,16 +724,7 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
|
|
|
691
724
|
], 16))
|
|
692
725
|
], 32)) : createCommentVNode("", true),
|
|
693
726
|
createElementVNode("div", mergeProps({ ...effectiveIsDraggable.value && __props.isSelected ? unref(dragProps) : {}, ...unref(doubleProps) }, { style: innerRotatedStyle.value }), [
|
|
694
|
-
|
|
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 }) => {
|
|
727
|
+
__props.isSelected && effectiveIsResizable.value && !rotationActive.value ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(unref(resize), ({ key, style, ...handle }) => {
|
|
704
728
|
return openBlock(), createElementBlock(Fragment, { key }, [
|
|
705
729
|
unref(slots)["resize-handle"] ? renderSlot(_ctx.$slots, "resize-handle", mergeProps({
|
|
706
730
|
key: 0,
|
|
@@ -717,7 +741,7 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
|
|
|
717
741
|
}), null, 16))
|
|
718
742
|
], 64);
|
|
719
743
|
}), 128)) : createCommentVNode("", true),
|
|
720
|
-
__props.isSelected && unref(permissions).canModifyAnnotations && !__props.isMultiSelected && !rotationActive.value && unref(vertices).length > 0 ? (openBlock(true), createElementBlock(Fragment, { key:
|
|
744
|
+
__props.isSelected && unref(permissions).canModifyAnnotations && !__props.isMultiSelected && !rotationActive.value && unref(vertices).length > 0 ? (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(unref(vertices), ({ key, style, ...vertex }) => {
|
|
721
745
|
return openBlock(), createElementBlock(Fragment, { key }, [
|
|
722
746
|
unref(slots)["vertex-handle"] ? renderSlot(_ctx.$slots, "vertex-handle", mergeProps({
|
|
723
747
|
key: 0,
|
|
@@ -1367,7 +1391,7 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
|
|
|
1367
1391
|
}), 128)) : createCommentVNode("", true)
|
|
1368
1392
|
], 16)
|
|
1369
1393
|
], 4),
|
|
1370
|
-
shouldShowMenu.value ? (openBlock(), createBlock(unref(CounterRotate), {
|
|
1394
|
+
shouldShowMenu.value && !rotationActive.value ? (openBlock(), createBlock(unref(CounterRotate), {
|
|
1371
1395
|
key: 0,
|
|
1372
1396
|
rect: menuRect.value,
|
|
1373
1397
|
rotation: __props.rotation
|
|
@@ -1435,6 +1459,7 @@ function createRenderer(entry) {
|
|
|
1435
1459
|
component: markRaw(entry.component),
|
|
1436
1460
|
vertexConfig: entry.vertexConfig,
|
|
1437
1461
|
zIndex: entry.zIndex,
|
|
1462
|
+
defaultBlendMode: entry.defaultBlendMode,
|
|
1438
1463
|
containerStyle: entry.containerStyle,
|
|
1439
1464
|
interactionDefaults: entry.interactionDefaults,
|
|
1440
1465
|
useAppearanceStream: entry.useAppearanceStream,
|
|
@@ -1557,8 +1582,10 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
|
|
|
1557
1582
|
}
|
|
1558
1583
|
});
|
|
1559
1584
|
const _hoisted_1$9 = ["width", "height", "viewBox"];
|
|
1560
|
-
const _hoisted_2$7 = ["
|
|
1561
|
-
const _hoisted_3$7 = ["x", "y", "width", "height", "
|
|
1585
|
+
const _hoisted_2$7 = ["d", "stroke-width"];
|
|
1586
|
+
const _hoisted_3$7 = ["x", "y", "width", "height", "stroke-width"];
|
|
1587
|
+
const _hoisted_4$6 = ["d", "fill", "opacity"];
|
|
1588
|
+
const _hoisted_5$5 = ["x", "y", "width", "height", "fill", "opacity"];
|
|
1562
1589
|
const __default__$c = { inheritAttrs: false };
|
|
1563
1590
|
const _sfc_main$y = /* @__PURE__ */ defineComponent({
|
|
1564
1591
|
...__default__$c,
|
|
@@ -1574,11 +1601,14 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
|
|
|
1574
1601
|
rect: {},
|
|
1575
1602
|
scale: {},
|
|
1576
1603
|
onClick: {},
|
|
1577
|
-
appearanceActive: { type: Boolean, default: false }
|
|
1604
|
+
appearanceActive: { type: Boolean, default: false },
|
|
1605
|
+
cloudyBorderIntensity: {},
|
|
1606
|
+
rectangleDifferences: {}
|
|
1578
1607
|
},
|
|
1579
1608
|
setup(__props) {
|
|
1580
1609
|
const MIN_HIT_AREA_SCREEN_PX = 20;
|
|
1581
1610
|
const props = __props;
|
|
1611
|
+
const isCloudy = computed(() => (props.cloudyBorderIntensity ?? 0) > 0);
|
|
1582
1612
|
const geometry = computed(() => {
|
|
1583
1613
|
const outerW = props.rect.size.width;
|
|
1584
1614
|
const outerH = props.rect.size.height;
|
|
@@ -1591,8 +1621,17 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
|
|
|
1591
1621
|
y: props.strokeWidth / 2
|
|
1592
1622
|
};
|
|
1593
1623
|
});
|
|
1594
|
-
const
|
|
1595
|
-
|
|
1624
|
+
const cloudyPath = computed(() => {
|
|
1625
|
+
if (!isCloudy.value) return null;
|
|
1626
|
+
return generateCloudyRectanglePath(
|
|
1627
|
+
{ x: 0, y: 0, width: props.rect.size.width, height: props.rect.size.height },
|
|
1628
|
+
props.rectangleDifferences,
|
|
1629
|
+
props.cloudyBorderIntensity,
|
|
1630
|
+
props.strokeWidth
|
|
1631
|
+
);
|
|
1632
|
+
});
|
|
1633
|
+
const svgWidth = computed(() => props.rect.size.width * props.scale);
|
|
1634
|
+
const svgHeight = computed(() => props.rect.size.height * props.scale);
|
|
1596
1635
|
const hitStrokeWidth = computed(
|
|
1597
1636
|
() => Math.max(props.strokeWidth, MIN_HIT_AREA_SCREEN_PX / props.scale)
|
|
1598
1637
|
);
|
|
@@ -1608,14 +1647,12 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
|
|
|
1608
1647
|
}),
|
|
1609
1648
|
width: svgWidth.value,
|
|
1610
1649
|
height: svgHeight.value,
|
|
1611
|
-
viewBox: `0 0 ${
|
|
1650
|
+
viewBox: `0 0 ${__props.rect.size.width} ${__props.rect.size.height}`,
|
|
1612
1651
|
overflow: "visible"
|
|
1613
1652
|
}, [
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
width: geometry.value.width,
|
|
1618
|
-
height: geometry.value.height,
|
|
1653
|
+
isCloudy.value && cloudyPath.value ? (openBlock(), createElementBlock("path", {
|
|
1654
|
+
key: 0,
|
|
1655
|
+
d: cloudyPath.value.path,
|
|
1619
1656
|
fill: "transparent",
|
|
1620
1657
|
stroke: "transparent",
|
|
1621
1658
|
"stroke-width": hitStrokeWidth.value,
|
|
@@ -1625,24 +1662,52 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
|
|
|
1625
1662
|
cursor: __props.isSelected ? "move" : "pointer",
|
|
1626
1663
|
pointerEvents: __props.isSelected ? "none" : __props.color === "transparent" ? "visibleStroke" : "visible"
|
|
1627
1664
|
})
|
|
1628
|
-
}, null, 44, _hoisted_2$7),
|
|
1629
|
-
|
|
1630
|
-
key: 0,
|
|
1665
|
+
}, null, 44, _hoisted_2$7)) : (openBlock(), createElementBlock("rect", {
|
|
1666
|
+
key: 1,
|
|
1631
1667
|
x: geometry.value.x,
|
|
1632
1668
|
y: geometry.value.y,
|
|
1633
1669
|
width: geometry.value.width,
|
|
1634
1670
|
height: geometry.value.height,
|
|
1635
|
-
fill:
|
|
1636
|
-
|
|
1671
|
+
fill: "transparent",
|
|
1672
|
+
stroke: "transparent",
|
|
1673
|
+
"stroke-width": hitStrokeWidth.value,
|
|
1674
|
+
onPointerdown: _cache[1] || (_cache[1] = //@ts-ignore
|
|
1675
|
+
(...args) => __props.onClick && __props.onClick(...args)),
|
|
1637
1676
|
style: normalizeStyle({
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
strokeWidth: __props.strokeWidth,
|
|
1641
|
-
...__props.strokeStyle === unref(PdfAnnotationBorderStyle).DASHED && {
|
|
1642
|
-
strokeDasharray: (_a = __props.strokeDashArray) == null ? void 0 : _a.join(",")
|
|
1643
|
-
}
|
|
1677
|
+
cursor: __props.isSelected ? "move" : "pointer",
|
|
1678
|
+
pointerEvents: __props.isSelected ? "none" : __props.color === "transparent" ? "visibleStroke" : "visible"
|
|
1644
1679
|
})
|
|
1645
|
-
}, null,
|
|
1680
|
+
}, null, 44, _hoisted_3$7)),
|
|
1681
|
+
!__props.appearanceActive ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
|
|
1682
|
+
isCloudy.value && cloudyPath.value ? (openBlock(), createElementBlock("path", {
|
|
1683
|
+
key: 0,
|
|
1684
|
+
d: cloudyPath.value.path,
|
|
1685
|
+
fill: __props.color,
|
|
1686
|
+
opacity: __props.opacity,
|
|
1687
|
+
style: normalizeStyle({
|
|
1688
|
+
pointerEvents: "none",
|
|
1689
|
+
stroke: __props.strokeColor ?? __props.color,
|
|
1690
|
+
strokeWidth: __props.strokeWidth,
|
|
1691
|
+
strokeLinejoin: "round"
|
|
1692
|
+
})
|
|
1693
|
+
}, null, 12, _hoisted_4$6)) : (openBlock(), createElementBlock("rect", {
|
|
1694
|
+
key: 1,
|
|
1695
|
+
x: geometry.value.x,
|
|
1696
|
+
y: geometry.value.y,
|
|
1697
|
+
width: geometry.value.width,
|
|
1698
|
+
height: geometry.value.height,
|
|
1699
|
+
fill: __props.color,
|
|
1700
|
+
opacity: __props.opacity,
|
|
1701
|
+
style: normalizeStyle({
|
|
1702
|
+
pointerEvents: "none",
|
|
1703
|
+
stroke: __props.strokeColor ?? __props.color,
|
|
1704
|
+
strokeWidth: __props.strokeWidth,
|
|
1705
|
+
...__props.strokeStyle === unref(PdfAnnotationBorderStyle).DASHED && {
|
|
1706
|
+
strokeDasharray: (_a = __props.strokeDashArray) == null ? void 0 : _a.join(",")
|
|
1707
|
+
}
|
|
1708
|
+
})
|
|
1709
|
+
}, null, 12, _hoisted_5$5))
|
|
1710
|
+
], 64)) : createCommentVNode("", true)
|
|
1646
1711
|
], 12, _hoisted_1$9);
|
|
1647
1712
|
};
|
|
1648
1713
|
}
|
|
@@ -1672,8 +1737,10 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
|
|
|
1672
1737
|
}
|
|
1673
1738
|
});
|
|
1674
1739
|
const _hoisted_1$8 = ["width", "height", "viewBox"];
|
|
1675
|
-
const _hoisted_2$6 = ["
|
|
1676
|
-
const _hoisted_3$6 = ["cx", "cy", "rx", "ry", "
|
|
1740
|
+
const _hoisted_2$6 = ["d", "stroke-width"];
|
|
1741
|
+
const _hoisted_3$6 = ["cx", "cy", "rx", "ry", "stroke-width"];
|
|
1742
|
+
const _hoisted_4$5 = ["d", "fill", "opacity"];
|
|
1743
|
+
const _hoisted_5$4 = ["cx", "cy", "rx", "ry", "fill", "opacity"];
|
|
1677
1744
|
const __default__$b = { inheritAttrs: false };
|
|
1678
1745
|
const _sfc_main$w = /* @__PURE__ */ defineComponent({
|
|
1679
1746
|
...__default__$b,
|
|
@@ -1689,11 +1756,14 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
|
|
|
1689
1756
|
rect: {},
|
|
1690
1757
|
scale: {},
|
|
1691
1758
|
onClick: {},
|
|
1692
|
-
appearanceActive: { type: Boolean, default: false }
|
|
1759
|
+
appearanceActive: { type: Boolean, default: false },
|
|
1760
|
+
cloudyBorderIntensity: {},
|
|
1761
|
+
rectangleDifferences: {}
|
|
1693
1762
|
},
|
|
1694
1763
|
setup(__props) {
|
|
1695
1764
|
const MIN_HIT_AREA_SCREEN_PX = 20;
|
|
1696
1765
|
const props = __props;
|
|
1766
|
+
const isCloudy = computed(() => (props.cloudyBorderIntensity ?? 0) > 0);
|
|
1697
1767
|
const geometry = computed(() => {
|
|
1698
1768
|
const outerW = props.rect.size.width;
|
|
1699
1769
|
const outerH = props.rect.size.height;
|
|
@@ -1708,6 +1778,15 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
|
|
|
1708
1778
|
ry: innerH / 2
|
|
1709
1779
|
};
|
|
1710
1780
|
});
|
|
1781
|
+
const cloudyPath = computed(() => {
|
|
1782
|
+
if (!isCloudy.value) return null;
|
|
1783
|
+
return generateCloudyEllipsePath(
|
|
1784
|
+
{ x: 0, y: 0, width: props.rect.size.width, height: props.rect.size.height },
|
|
1785
|
+
props.rectangleDifferences,
|
|
1786
|
+
props.cloudyBorderIntensity,
|
|
1787
|
+
props.strokeWidth
|
|
1788
|
+
);
|
|
1789
|
+
});
|
|
1711
1790
|
const svgWidth = computed(() => geometry.value.width * props.scale);
|
|
1712
1791
|
const svgHeight = computed(() => geometry.value.height * props.scale);
|
|
1713
1792
|
const hitStrokeWidth = computed(
|
|
@@ -1728,11 +1807,9 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
|
|
|
1728
1807
|
viewBox: `0 0 ${geometry.value.width} ${geometry.value.height}`,
|
|
1729
1808
|
overflow: "visible"
|
|
1730
1809
|
}, [
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
rx: geometry.value.rx,
|
|
1735
|
-
ry: geometry.value.ry,
|
|
1810
|
+
isCloudy.value && cloudyPath.value ? (openBlock(), createElementBlock("path", {
|
|
1811
|
+
key: 0,
|
|
1812
|
+
d: cloudyPath.value.path,
|
|
1736
1813
|
fill: "transparent",
|
|
1737
1814
|
stroke: "transparent",
|
|
1738
1815
|
"stroke-width": hitStrokeWidth.value,
|
|
@@ -1742,24 +1819,52 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
|
|
|
1742
1819
|
cursor: __props.isSelected ? "move" : "pointer",
|
|
1743
1820
|
pointerEvents: __props.isSelected ? "none" : __props.color === "transparent" ? "visibleStroke" : "visible"
|
|
1744
1821
|
})
|
|
1745
|
-
}, null, 44, _hoisted_2$6),
|
|
1746
|
-
|
|
1747
|
-
key: 0,
|
|
1822
|
+
}, null, 44, _hoisted_2$6)) : (openBlock(), createElementBlock("ellipse", {
|
|
1823
|
+
key: 1,
|
|
1748
1824
|
cx: geometry.value.cx,
|
|
1749
1825
|
cy: geometry.value.cy,
|
|
1750
1826
|
rx: geometry.value.rx,
|
|
1751
1827
|
ry: geometry.value.ry,
|
|
1752
|
-
fill:
|
|
1753
|
-
|
|
1828
|
+
fill: "transparent",
|
|
1829
|
+
stroke: "transparent",
|
|
1830
|
+
"stroke-width": hitStrokeWidth.value,
|
|
1831
|
+
onPointerdown: _cache[1] || (_cache[1] = //@ts-ignore
|
|
1832
|
+
(...args) => __props.onClick && __props.onClick(...args)),
|
|
1754
1833
|
style: normalizeStyle({
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
strokeWidth: __props.strokeWidth,
|
|
1758
|
-
...__props.strokeStyle === unref(PdfAnnotationBorderStyle).DASHED && {
|
|
1759
|
-
strokeDasharray: (_a = __props.strokeDashArray) == null ? void 0 : _a.join(",")
|
|
1760
|
-
}
|
|
1834
|
+
cursor: __props.isSelected ? "move" : "pointer",
|
|
1835
|
+
pointerEvents: __props.isSelected ? "none" : __props.color === "transparent" ? "visibleStroke" : "visible"
|
|
1761
1836
|
})
|
|
1762
|
-
}, null,
|
|
1837
|
+
}, null, 44, _hoisted_3$6)),
|
|
1838
|
+
!__props.appearanceActive ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
|
|
1839
|
+
isCloudy.value && cloudyPath.value ? (openBlock(), createElementBlock("path", {
|
|
1840
|
+
key: 0,
|
|
1841
|
+
d: cloudyPath.value.path,
|
|
1842
|
+
fill: __props.color,
|
|
1843
|
+
opacity: __props.opacity,
|
|
1844
|
+
style: normalizeStyle({
|
|
1845
|
+
pointerEvents: "none",
|
|
1846
|
+
stroke: __props.strokeColor ?? __props.color,
|
|
1847
|
+
strokeWidth: __props.strokeWidth,
|
|
1848
|
+
strokeLinejoin: "round"
|
|
1849
|
+
})
|
|
1850
|
+
}, null, 12, _hoisted_4$5)) : (openBlock(), createElementBlock("ellipse", {
|
|
1851
|
+
key: 1,
|
|
1852
|
+
cx: geometry.value.cx,
|
|
1853
|
+
cy: geometry.value.cy,
|
|
1854
|
+
rx: geometry.value.rx,
|
|
1855
|
+
ry: geometry.value.ry,
|
|
1856
|
+
fill: __props.color,
|
|
1857
|
+
opacity: __props.opacity,
|
|
1858
|
+
style: normalizeStyle({
|
|
1859
|
+
pointerEvents: "none",
|
|
1860
|
+
stroke: __props.strokeColor ?? __props.color,
|
|
1861
|
+
strokeWidth: __props.strokeWidth,
|
|
1862
|
+
...__props.strokeStyle === unref(PdfAnnotationBorderStyle).DASHED && {
|
|
1863
|
+
strokeDasharray: (_a = __props.strokeDashArray) == null ? void 0 : _a.join(",")
|
|
1864
|
+
}
|
|
1865
|
+
})
|
|
1866
|
+
}, null, 12, _hoisted_5$4))
|
|
1867
|
+
], 64)) : createCommentVNode("", true)
|
|
1763
1868
|
], 12, _hoisted_1$8);
|
|
1764
1869
|
};
|
|
1765
1870
|
}
|
|
@@ -1793,7 +1898,7 @@ const _hoisted_2$5 = ["x1", "y1", "x2", "y2", "stroke-width"];
|
|
|
1793
1898
|
const _hoisted_3$5 = ["d", "transform", "stroke-width"];
|
|
1794
1899
|
const _hoisted_4$4 = ["d", "transform", "stroke-width"];
|
|
1795
1900
|
const _hoisted_5$3 = ["x1", "y1", "x2", "y2", "opacity"];
|
|
1796
|
-
const _hoisted_6$
|
|
1901
|
+
const _hoisted_6$2 = ["d", "transform", "stroke", "fill"];
|
|
1797
1902
|
const _hoisted_7$1 = ["d", "transform", "stroke", "fill"];
|
|
1798
1903
|
const __default__$a = { inheritAttrs: false };
|
|
1799
1904
|
const _sfc_main$u = /* @__PURE__ */ defineComponent({
|
|
@@ -1934,7 +2039,7 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
|
|
|
1934
2039
|
strokeDasharray: (_b = __props.strokeDashArray) == null ? void 0 : _b.join(",")
|
|
1935
2040
|
}
|
|
1936
2041
|
})
|
|
1937
|
-
}, null, 12, _hoisted_6$
|
|
2042
|
+
}, null, 12, _hoisted_6$2)) : createCommentVNode("", true),
|
|
1938
2043
|
endings.value.end ? (openBlock(), createElementBlock("path", {
|
|
1939
2044
|
key: 1,
|
|
1940
2045
|
d: endings.value.end.d,
|
|
@@ -1984,7 +2089,7 @@ const _hoisted_2$4 = ["d", "stroke-width"];
|
|
|
1984
2089
|
const _hoisted_3$4 = ["d", "transform", "stroke-width"];
|
|
1985
2090
|
const _hoisted_4$3 = ["d", "transform", "stroke-width"];
|
|
1986
2091
|
const _hoisted_5$2 = ["d", "opacity"];
|
|
1987
|
-
const _hoisted_6 = ["d", "transform", "stroke", "fill"];
|
|
2092
|
+
const _hoisted_6$1 = ["d", "transform", "stroke", "fill"];
|
|
1988
2093
|
const _hoisted_7 = ["d", "transform", "stroke", "fill"];
|
|
1989
2094
|
const __default__$9 = { inheritAttrs: false };
|
|
1990
2095
|
const _sfc_main$s = /* @__PURE__ */ defineComponent({
|
|
@@ -2139,7 +2244,7 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
|
|
|
2139
2244
|
strokeDasharray: (_b = __props.strokeDashArray) == null ? void 0 : _b.join(",")
|
|
2140
2245
|
}
|
|
2141
2246
|
})
|
|
2142
|
-
}, null, 12, _hoisted_6)) : createCommentVNode("", true),
|
|
2247
|
+
}, null, 12, _hoisted_6$1)) : createCommentVNode("", true),
|
|
2143
2248
|
endings.value.end ? (openBlock(), createElementBlock("path", {
|
|
2144
2249
|
key: 1,
|
|
2145
2250
|
d: endings.value.end.d,
|
|
@@ -2187,8 +2292,9 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
|
|
|
2187
2292
|
const _hoisted_1$5 = ["width", "height", "viewBox"];
|
|
2188
2293
|
const _hoisted_2$3 = ["d", "stroke-width"];
|
|
2189
2294
|
const _hoisted_3$3 = ["d", "opacity"];
|
|
2190
|
-
const _hoisted_4$2 = ["d"];
|
|
2191
|
-
const _hoisted_5$1 = ["
|
|
2295
|
+
const _hoisted_4$2 = ["d", "opacity"];
|
|
2296
|
+
const _hoisted_5$1 = ["d"];
|
|
2297
|
+
const _hoisted_6 = ["x", "y", "width", "height", "fill", "stroke", "stroke-width"];
|
|
2192
2298
|
const __default__$8 = { inheritAttrs: false };
|
|
2193
2299
|
const _sfc_main$q = /* @__PURE__ */ defineComponent({
|
|
2194
2300
|
...__default__$8,
|
|
@@ -2207,11 +2313,13 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
|
|
|
2207
2313
|
onClick: {},
|
|
2208
2314
|
currentVertex: {},
|
|
2209
2315
|
handleSize: { default: 14 },
|
|
2210
|
-
appearanceActive: { type: Boolean, default: false }
|
|
2316
|
+
appearanceActive: { type: Boolean, default: false },
|
|
2317
|
+
cloudyBorderIntensity: {}
|
|
2211
2318
|
},
|
|
2212
2319
|
setup(__props) {
|
|
2213
2320
|
const MIN_HIT_AREA_SCREEN_PX = 20;
|
|
2214
2321
|
const props = __props;
|
|
2322
|
+
const isCloudy = computed(() => (props.cloudyBorderIntensity ?? 0) > 0);
|
|
2215
2323
|
const allPoints = computed(
|
|
2216
2324
|
() => props.currentVertex ? [...props.vertices, props.currentVertex] : props.vertices
|
|
2217
2325
|
);
|
|
@@ -2227,6 +2335,15 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
|
|
|
2227
2335
|
const isPreview = !!props.currentVertex;
|
|
2228
2336
|
return (`M ${first.x} ${first.y} ` + rest.map((p) => `L ${p.x} ${p.y}`).join(" ") + (isPreview ? "" : " Z")).trim();
|
|
2229
2337
|
});
|
|
2338
|
+
const cloudyPath = computed(() => {
|
|
2339
|
+
if (!isCloudy.value || allPoints.value.length < 3) return null;
|
|
2340
|
+
return generateCloudyPolygonPath(
|
|
2341
|
+
allPoints.value,
|
|
2342
|
+
props.rect.origin,
|
|
2343
|
+
props.cloudyBorderIntensity,
|
|
2344
|
+
props.strokeWidth
|
|
2345
|
+
);
|
|
2346
|
+
});
|
|
2230
2347
|
const isPreviewing = computed(() => props.currentVertex && props.vertices.length > 0);
|
|
2231
2348
|
const width = computed(() => props.rect.size.width * props.scale);
|
|
2232
2349
|
const height = computed(() => props.rect.size.height * props.scale);
|
|
@@ -2249,7 +2366,7 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
|
|
|
2249
2366
|
viewBox: `0 0 ${__props.rect.size.width} ${__props.rect.size.height}`
|
|
2250
2367
|
}, [
|
|
2251
2368
|
createElementVNode("path", {
|
|
2252
|
-
d: pathData.value,
|
|
2369
|
+
d: isCloudy.value && cloudyPath.value ? cloudyPath.value.path : pathData.value,
|
|
2253
2370
|
fill: "transparent",
|
|
2254
2371
|
stroke: "transparent",
|
|
2255
2372
|
"stroke-width": hitStrokeWidth.value,
|
|
@@ -2263,45 +2380,58 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
|
|
|
2263
2380
|
})
|
|
2264
2381
|
}, null, 44, _hoisted_2$3),
|
|
2265
2382
|
!__props.appearanceActive ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
2266
|
-
|
|
2267
|
-
|
|
2383
|
+
isCloudy.value && cloudyPath.value ? (openBlock(), createElementBlock("path", {
|
|
2384
|
+
key: 0,
|
|
2385
|
+
d: cloudyPath.value.path,
|
|
2268
2386
|
opacity: __props.opacity,
|
|
2269
2387
|
style: normalizeStyle({
|
|
2270
|
-
fill: __props.
|
|
2388
|
+
fill: __props.color,
|
|
2271
2389
|
stroke: __props.strokeColor ?? __props.color,
|
|
2272
2390
|
strokeWidth: __props.strokeWidth,
|
|
2273
2391
|
pointerEvents: "none",
|
|
2274
|
-
|
|
2275
|
-
strokeLinejoin: "miter",
|
|
2276
|
-
...__props.strokeStyle === unref(PdfAnnotationBorderStyle).DASHED && {
|
|
2277
|
-
strokeDasharray: (_a = __props.strokeDashArray) == null ? void 0 : _a.join(",")
|
|
2278
|
-
}
|
|
2392
|
+
strokeLinejoin: "round"
|
|
2279
2393
|
})
|
|
2280
|
-
}, null, 12, _hoisted_3$3),
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2394
|
+
}, null, 12, _hoisted_3$3)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
2395
|
+
createElementVNode("path", {
|
|
2396
|
+
d: pathData.value,
|
|
2397
|
+
opacity: __props.opacity,
|
|
2398
|
+
style: normalizeStyle({
|
|
2399
|
+
fill: __props.currentVertex ? "none" : __props.color,
|
|
2400
|
+
stroke: __props.strokeColor ?? __props.color,
|
|
2401
|
+
strokeWidth: __props.strokeWidth,
|
|
2402
|
+
pointerEvents: "none",
|
|
2403
|
+
strokeLinecap: "butt",
|
|
2404
|
+
strokeLinejoin: "miter",
|
|
2405
|
+
...__props.strokeStyle === unref(PdfAnnotationBorderStyle).DASHED && {
|
|
2406
|
+
strokeDasharray: (_a = __props.strokeDashArray) == null ? void 0 : _a.join(",")
|
|
2407
|
+
}
|
|
2408
|
+
})
|
|
2409
|
+
}, null, 12, _hoisted_4$2),
|
|
2410
|
+
isPreviewing.value && localPts.value.length > 1 ? (openBlock(), createElementBlock("path", {
|
|
2411
|
+
key: 0,
|
|
2412
|
+
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}`,
|
|
2413
|
+
fill: "none",
|
|
2414
|
+
style: normalizeStyle({
|
|
2415
|
+
stroke: __props.strokeColor,
|
|
2416
|
+
strokeWidth: __props.strokeWidth,
|
|
2417
|
+
strokeDasharray: "4,4",
|
|
2418
|
+
opacity: 0.7,
|
|
2419
|
+
pointerEvents: "none"
|
|
2420
|
+
})
|
|
2421
|
+
}, null, 12, _hoisted_5$1)) : createCommentVNode("", true),
|
|
2422
|
+
isPreviewing.value && localPts.value.length >= 2 ? (openBlock(), createElementBlock("rect", {
|
|
2423
|
+
key: 1,
|
|
2424
|
+
x: localPts.value[0].x - __props.handleSize / __props.scale / 2,
|
|
2425
|
+
y: localPts.value[0].y - __props.handleSize / __props.scale / 2,
|
|
2426
|
+
width: __props.handleSize / __props.scale,
|
|
2427
|
+
height: __props.handleSize / __props.scale,
|
|
2428
|
+
fill: __props.strokeColor,
|
|
2429
|
+
opacity: 0.4,
|
|
2286
2430
|
stroke: __props.strokeColor,
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
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)
|
|
2431
|
+
"stroke-width": __props.strokeWidth / 2,
|
|
2432
|
+
style: { "pointer-events": "none" }
|
|
2433
|
+
}, null, 8, _hoisted_6)) : createCommentVNode("", true)
|
|
2434
|
+
], 64))
|
|
2305
2435
|
], 64)) : createCommentVNode("", true)
|
|
2306
2436
|
], 12, _hoisted_1$5);
|
|
2307
2437
|
};
|
|
@@ -2368,28 +2498,35 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
|
|
|
2368
2498
|
});
|
|
2369
2499
|
watch(
|
|
2370
2500
|
() => props.isEditing,
|
|
2371
|
-
(editing) => {
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2501
|
+
async (editing) => {
|
|
2502
|
+
var _a, _b;
|
|
2503
|
+
if (!editing) return;
|
|
2504
|
+
await nextTick();
|
|
2505
|
+
if (!editorRef.value) return;
|
|
2506
|
+
editingRef.value = true;
|
|
2507
|
+
const editor = editorRef.value;
|
|
2508
|
+
editor.focus();
|
|
2509
|
+
const tool = (_a = annotationProvides.value) == null ? void 0 : _a.findToolForAnnotation(props.annotation.object);
|
|
2510
|
+
const isDefaultContent = ((_b = tool == null ? void 0 : tool.defaults) == null ? void 0 : _b.contents) != null && props.annotation.object.contents === tool.defaults.contents;
|
|
2511
|
+
const selection = window.getSelection();
|
|
2512
|
+
if (selection) {
|
|
2513
|
+
const range = document.createRange();
|
|
2514
|
+
range.selectNodeContents(editor);
|
|
2515
|
+
if (!isDefaultContent) {
|
|
2380
2516
|
range.collapse(false);
|
|
2381
|
-
selection.removeAllRanges();
|
|
2382
|
-
selection.addRange(range);
|
|
2383
2517
|
}
|
|
2518
|
+
selection.removeAllRanges();
|
|
2519
|
+
selection.addRange(range);
|
|
2384
2520
|
}
|
|
2385
|
-
}
|
|
2521
|
+
},
|
|
2522
|
+
{ immediate: true }
|
|
2386
2523
|
);
|
|
2387
2524
|
const handleBlur = () => {
|
|
2388
2525
|
if (!editingRef.value) return;
|
|
2389
2526
|
editingRef.value = false;
|
|
2390
2527
|
if (!annotationProvides.value || !editorRef.value) return;
|
|
2391
2528
|
annotationProvides.value.updateAnnotation(props.pageIndex, props.annotation.object.id, {
|
|
2392
|
-
contents: editorRef.value.innerText
|
|
2529
|
+
contents: editorRef.value.innerText.replace(/\u00A0/g, " ")
|
|
2393
2530
|
});
|
|
2394
2531
|
};
|
|
2395
2532
|
const editorStyle = computed(() => {
|
|
@@ -2699,7 +2836,10 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
|
|
|
2699
2836
|
width: width.value,
|
|
2700
2837
|
height: height.value,
|
|
2701
2838
|
fill: "transparent",
|
|
2702
|
-
onPointerdown: _cache[0] || (_cache[0] = ($event) =>
|
|
2839
|
+
onPointerdown: _cache[0] || (_cache[0] = ($event) => {
|
|
2840
|
+
var _a;
|
|
2841
|
+
return __props.hasIRT ? void 0 : (_a = __props.onClick) == null ? void 0 : _a.call(__props, $event);
|
|
2842
|
+
}),
|
|
2703
2843
|
style: normalizeStyle({
|
|
2704
2844
|
cursor: hitAreaCursor.value,
|
|
2705
2845
|
pointerEvents: hitAreaPointerEvents.value
|
|
@@ -3311,9 +3451,7 @@ const builtInRenderers = [
|
|
|
3311
3451
|
component: _sfc_main$g,
|
|
3312
3452
|
zIndex: 0,
|
|
3313
3453
|
interactionDefaults: { isDraggable: false, isResizable: false, isRotatable: false },
|
|
3314
|
-
|
|
3315
|
-
mixBlendMode: blendModeToCss(a.blendMode ?? PdfBlendMode.Multiply)
|
|
3316
|
-
})
|
|
3454
|
+
defaultBlendMode: PdfBlendMode.Multiply
|
|
3317
3455
|
}),
|
|
3318
3456
|
createRenderer({
|
|
3319
3457
|
id: "underline",
|
|
@@ -3452,6 +3590,12 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
3452
3590
|
syncState(provides.getState());
|
|
3453
3591
|
const off = provides.onStateChange(syncState);
|
|
3454
3592
|
onCleanup(off);
|
|
3593
|
+
const offEvent = provides.onAnnotationEvent((event) => {
|
|
3594
|
+
if (event.type === "create" && event.editAfterCreate) {
|
|
3595
|
+
editingId.value = event.annotation.id;
|
|
3596
|
+
}
|
|
3597
|
+
});
|
|
3598
|
+
onCleanup(offEvent);
|
|
3455
3599
|
},
|
|
3456
3600
|
{ immediate: true }
|
|
3457
3601
|
);
|
|
@@ -3557,6 +3701,9 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
3557
3701
|
};
|
|
3558
3702
|
const handlePointerDown = (_pos, pe) => {
|
|
3559
3703
|
if (pe.target === pe.currentTarget && annotationProvides.value) {
|
|
3704
|
+
if (editingId.value && annotations.value.some((a) => a.object.id === editingId.value)) {
|
|
3705
|
+
pe.stopImmediatePropagation();
|
|
3706
|
+
}
|
|
3560
3707
|
annotationProvides.value.deselectAnnotation();
|
|
3561
3708
|
editingId.value = null;
|
|
3562
3709
|
}
|
|
@@ -3663,11 +3810,10 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
3663
3810
|
renderer.onDoubleClick(annotation.object.id, setEditingId);
|
|
3664
3811
|
};
|
|
3665
3812
|
};
|
|
3666
|
-
const
|
|
3667
|
-
|
|
3668
|
-
|
|
3669
|
-
|
|
3670
|
-
};
|
|
3813
|
+
const getBlendMode = (annotation, renderer) => {
|
|
3814
|
+
return blendModeToCss(
|
|
3815
|
+
annotation.object.blendMode ?? renderer.defaultBlendMode ?? PdfBlendMode.Normal
|
|
3816
|
+
);
|
|
3671
3817
|
};
|
|
3672
3818
|
const getAppearance = (annotation, renderer) => {
|
|
3673
3819
|
var _a, _b;
|
|
@@ -3688,6 +3834,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
3688
3834
|
return (_ctx, _cache) => {
|
|
3689
3835
|
return openBlock(), createElementBlock(Fragment, null, [
|
|
3690
3836
|
(openBlock(true), createElementBlock(Fragment, null, renderList(resolvedAnnotations.value, ({ annotation, renderer }) => {
|
|
3837
|
+
var _a;
|
|
3691
3838
|
return openBlock(), createElementBlock(Fragment, {
|
|
3692
3839
|
key: annotation.object.id
|
|
3693
3840
|
}, [
|
|
@@ -3706,7 +3853,8 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
3706
3853
|
onSelect: getOnSelect(annotation, renderer),
|
|
3707
3854
|
onDoubleClick: getOnDoubleClick(renderer, annotation),
|
|
3708
3855
|
zIndex: renderer.zIndex,
|
|
3709
|
-
|
|
3856
|
+
blendMode: getBlendMode(annotation, renderer),
|
|
3857
|
+
style: (_a = renderer.containerStyle) == null ? void 0 : _a.call(renderer, annotation.object),
|
|
3710
3858
|
appearance: getAppearance(annotation, renderer)
|
|
3711
3859
|
}, { ref_for: true }, containerProps.value), createSlots({
|
|
3712
3860
|
default: withCtx(({ annotation: currentObject, appearanceActive }) => [
|
|
@@ -3740,7 +3888,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
3740
3888
|
]),
|
|
3741
3889
|
key: "0"
|
|
3742
3890
|
} : void 0
|
|
3743
|
-
]), 1040, ["trackedAnnotation", "isSelected", "isEditing", "isMultiSelected", "isDraggable", "isResizable", "lockAspectRatio", "isRotatable", "vertexConfig", "selectionMenu", "onSelect", "onDoubleClick", "zIndex", "style", "appearance"])) : createCommentVNode("", true)
|
|
3891
|
+
]), 1040, ["trackedAnnotation", "isSelected", "isEditing", "isMultiSelected", "isDraggable", "isResizable", "lockAspectRatio", "isRotatable", "vertexConfig", "selectionMenu", "onSelect", "onDoubleClick", "zIndex", "blendMode", "style", "appearance"])) : createCommentVNode("", true)
|
|
3744
3892
|
], 64);
|
|
3745
3893
|
}), 128)),
|
|
3746
3894
|
allSelectedOnSamePage.value && selectedAnnotationsOnPage.value.length >= 2 ? (openBlock(), createBlock(_sfc_main$B, {
|
|
@@ -3863,15 +4011,21 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
3863
4011
|
},
|
|
3864
4012
|
setup(__props) {
|
|
3865
4013
|
const props = __props;
|
|
3866
|
-
const style = computed(() =>
|
|
3867
|
-
|
|
3868
|
-
|
|
3869
|
-
|
|
3870
|
-
|
|
3871
|
-
|
|
3872
|
-
|
|
3873
|
-
|
|
3874
|
-
|
|
4014
|
+
const style = computed(() => {
|
|
4015
|
+
const base = {
|
|
4016
|
+
position: "absolute",
|
|
4017
|
+
left: `${props.preview.bounds.origin.x * props.scale}px`,
|
|
4018
|
+
top: `${props.preview.bounds.origin.y * props.scale}px`,
|
|
4019
|
+
width: `${props.preview.bounds.size.width * props.scale}px`,
|
|
4020
|
+
height: `${props.preview.bounds.size.height * props.scale}px`,
|
|
4021
|
+
pointerEvents: "none",
|
|
4022
|
+
zIndex: 10
|
|
4023
|
+
};
|
|
4024
|
+
if (props.preview.type === PdfAnnotationSubtype.INK) {
|
|
4025
|
+
base.mixBlendMode = blendModeToCss(props.preview.data.blendMode ?? PdfBlendMode.Normal);
|
|
4026
|
+
}
|
|
4027
|
+
return base;
|
|
4028
|
+
});
|
|
3875
4029
|
return (_ctx, _cache) => {
|
|
3876
4030
|
return openBlock(), createElementBlock("div", {
|
|
3877
4031
|
style: normalizeStyle(style.value)
|