vue-data-ui 3.25.4 → 3.25.5
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/README.md +13 -13
- package/dist/{ColorPicker-ZJrR3Olp.js → ColorPicker-Bn3MY7eL.js} +101 -99
- package/dist/{NonSvgPenAndPaper-DS84BAOx.js → NonSvgPenAndPaper-KXRhcsxM.js} +1 -1
- package/dist/{PackageVersion-5SWftabm.js → PackageVersion-M2Ws-VwJ.js} +1 -1
- package/dist/{PenAndPaper-B_SdRSKH.js → PenAndPaper-BgH3m_LP.js} +19 -3
- package/dist/components/vue-ui-3d-bar.js +1 -1
- package/dist/components/vue-ui-accordion.js +1 -1
- package/dist/components/vue-ui-age-pyramid.js +1 -1
- package/dist/components/vue-ui-annotator.js +1 -1
- package/dist/components/vue-ui-bullet.js +1 -1
- package/dist/components/vue-ui-bump.js +1 -1
- package/dist/components/vue-ui-candlestick.js +1 -1
- package/dist/components/vue-ui-carousel-table.js +1 -1
- package/dist/components/vue-ui-chestnut.js +1 -1
- package/dist/components/vue-ui-chord.js +1 -1
- package/dist/components/vue-ui-circle-pack.js +1 -1
- package/dist/components/vue-ui-cursor.js +1 -1
- package/dist/components/vue-ui-dag.js +1 -1
- package/dist/components/vue-ui-dashboard.js +1 -1
- package/dist/components/vue-ui-digits.js +1 -1
- package/dist/components/vue-ui-donut-evolution.js +1 -1
- package/dist/components/vue-ui-donut.js +1 -1
- package/dist/components/vue-ui-dumbbell.js +1 -1
- package/dist/components/vue-ui-flow.js +1 -1
- package/dist/components/vue-ui-funnel.js +1 -1
- package/dist/components/vue-ui-galaxy.js +1 -1
- package/dist/components/vue-ui-gauge.js +1 -1
- package/dist/components/vue-ui-geo.js +1 -1
- package/dist/components/vue-ui-gizmo.js +1 -1
- package/dist/components/vue-ui-heatmap.js +1 -1
- package/dist/components/vue-ui-hill.js +1 -1
- package/dist/components/vue-ui-history-plot.js +1 -1
- package/dist/components/vue-ui-horizontal-bar.js +1 -1
- package/dist/components/vue-ui-kpi.js +1 -1
- package/dist/components/vue-ui-label.js +1 -1
- package/dist/components/vue-ui-mini-loader.js +1 -1
- package/dist/components/vue-ui-molecule.js +1 -1
- package/dist/components/vue-ui-mood-radar.js +1 -1
- package/dist/components/vue-ui-nested-donuts.js +1 -1
- package/dist/components/vue-ui-onion.js +1 -1
- package/dist/components/vue-ui-parallel-coordinate-plot.js +1 -1
- package/dist/components/vue-ui-quadrant.js +1 -1
- package/dist/components/vue-ui-quick-chart.js +1 -1
- package/dist/components/vue-ui-radar.js +1 -1
- package/dist/components/vue-ui-rating.js +1 -1
- package/dist/components/vue-ui-relation-circle.js +1 -1
- package/dist/components/vue-ui-ridgeline.js +1 -1
- package/dist/components/vue-ui-rings.js +1 -1
- package/dist/components/vue-ui-scatter.js +1 -1
- package/dist/components/vue-ui-skeleton.js +1 -1
- package/dist/components/vue-ui-smiley.js +1 -1
- package/dist/components/vue-ui-spark-trend.js +1 -1
- package/dist/components/vue-ui-sparkbar.js +1 -1
- package/dist/components/vue-ui-sparkgauge.js +1 -1
- package/dist/components/vue-ui-sparkhistogram.js +1 -1
- package/dist/components/vue-ui-sparkline.js +1 -1
- package/dist/components/vue-ui-sparkstackbar.js +1 -1
- package/dist/components/vue-ui-stackbar.js +1 -1
- package/dist/components/vue-ui-stackline.js +1 -1
- package/dist/components/vue-ui-strip-plot.js +1 -1
- package/dist/components/vue-ui-table-heatmap.js +1 -1
- package/dist/components/vue-ui-table-sparkline.js +1 -1
- package/dist/components/vue-ui-table.js +1 -1
- package/dist/components/vue-ui-thermometer.js +1 -1
- package/dist/components/vue-ui-timer.js +1 -1
- package/dist/components/vue-ui-tiremarks.js +1 -1
- package/dist/components/vue-ui-treemap.js +1 -1
- package/dist/components/vue-ui-vertical-bar.js +1 -1
- package/dist/components/vue-ui-waffle.js +1 -1
- package/dist/components/vue-ui-wheel.js +1 -1
- package/dist/components/vue-ui-word-cloud.js +1 -1
- package/dist/components/vue-ui-world.js +1 -1
- package/dist/components/vue-ui-xy-canvas.js +1 -1
- package/dist/components/vue-ui-xy.js +1 -1
- package/dist/{package-DmsdiyeS.js → package-ta2JoIjx.js} +1 -1
- package/dist/{render-common-zoPh9a78.js → render-common-bvOuxfN3.js} +1 -1
- package/dist/ssr/vue-ui-donut.js +1 -1
- package/dist/ssr/vue-ui-xy.js +1 -1
- package/dist/ssr.js +2 -2
- package/dist/style.css +1 -1
- package/dist/types/vue-data-ui.d.ts +70 -1
- package/dist/types/vue-ui-annotator.d.ts +58 -2
- package/dist/{useConfig-CyCVHo81.js → useConfig-C_mX5pOZ.js} +1329 -1313
- package/dist/{useObjectBindings-ByORl1rV.js → useObjectBindings-uXpBcVyo.js} +1 -1
- package/dist/utils.js +1 -1
- package/dist/{vue-data-ui-DTj71yB7.js → vue-data-ui-BjdCpsRV.js} +69 -69
- package/dist/vue-data-ui.js +70 -70
- package/dist/{vue-ui-3d-bar-CH8SpxS2.js → vue-ui-3d-bar-C0aLR6lw.js} +6 -4
- package/dist/{vue-ui-accordion-D4zsdacF.js → vue-ui-accordion-DRf3NQyH.js} +1 -1
- package/dist/{vue-ui-age-pyramid-B9MUVi75.js → vue-ui-age-pyramid-DUcB3lYs.js} +6 -4
- package/dist/vue-ui-annotator-DZ0O8Xa5.js +3325 -0
- package/dist/{vue-ui-bullet-n8KNnDwh.js → vue-ui-bullet-DIOCMF2H.js} +6 -4
- package/dist/{vue-ui-bump-BkOtQNWe.js → vue-ui-bump-DoHnD1Xy.js} +6 -4
- package/dist/{vue-ui-candlestick-Bxlvqk49.js → vue-ui-candlestick-Cf8TYPl5.js} +6 -4
- package/dist/{vue-ui-carousel-table-CRgbs7jR.js → vue-ui-carousel-table-k1cBJ1i1.js} +2 -2
- package/dist/{vue-ui-chestnut-ByDKbkG9.js → vue-ui-chestnut-BMAuaeif.js} +7 -5
- package/dist/{vue-ui-chord-DQRBgVOx.js → vue-ui-chord-DCe2iPjk.js} +7 -5
- package/dist/{vue-ui-circle-pack-CBBc0HOe.js → vue-ui-circle-pack-Eb5hS_z3.js} +7 -5
- package/dist/{vue-ui-cursor-BHyXRadA.js → vue-ui-cursor-CQWLyEx0.js} +2 -2
- package/dist/{vue-ui-dag-CyVqaLbF.js → vue-ui-dag-BqlsutMj.js} +6 -4
- package/dist/{vue-ui-dashboard-7I-7wvCP.js → vue-ui-dashboard-Be3MmkgS.js} +73 -71
- package/dist/{vue-ui-digits-BBL8uERO.js → vue-ui-digits-BqdfbcKX.js} +2 -2
- package/dist/{vue-ui-donut-DfiocufT.js → vue-ui-donut-CuQVKuZa.js} +6 -4
- package/dist/{vue-ui-donut-evolution-BoqO8By2.js → vue-ui-donut-evolution-DckruxZ9.js} +6 -4
- package/dist/{vue-ui-donut-DcgUuefk.js → vue-ui-donut-gzGZ42uH.js} +2 -2
- package/dist/{vue-ui-dumbbell-7M_oUQdi.js → vue-ui-dumbbell-BYU-hh2E.js} +6 -4
- package/dist/{vue-ui-flow-CoylrfnO.js → vue-ui-flow-DLRcNDLc.js} +7 -5
- package/dist/{vue-ui-funnel-DaBYHWIC.js → vue-ui-funnel-DjoqNN1U.js} +7 -5
- package/dist/{vue-ui-galaxy-BIebStQ3.js → vue-ui-galaxy-BhR4IOra.js} +6 -4
- package/dist/{vue-ui-gauge-CwdTmiRP.js → vue-ui-gauge-Cq161Kwp.js} +6 -4
- package/dist/{vue-ui-geo-jR4P4pbt.js → vue-ui-geo-Ca8kPYr-.js} +6 -4
- package/dist/{vue-ui-gizmo-D6W86s9o.js → vue-ui-gizmo-wUqHJICb.js} +2 -2
- package/dist/{vue-ui-heatmap-DXYlGwqR.js → vue-ui-heatmap-Bl5ymvi9.js} +8 -6
- package/dist/{vue-ui-hill-fFq7pm-g.js → vue-ui-hill-D6Y9Xy2K.js} +6 -4
- package/dist/{vue-ui-history-plot-CgIELoD2.js → vue-ui-history-plot-CvVjsdCL.js} +6 -4
- package/dist/{vue-ui-horizontal-bar-D3Sft4kp.js → vue-ui-horizontal-bar-3on3-H3B.js} +8 -6
- package/dist/{vue-ui-kpi-fzLsKlyE.js → vue-ui-kpi-CUpRRIUf.js} +2 -2
- package/dist/{vue-ui-label-BSgLalWD.js → vue-ui-label-DR2qUZOG.js} +1 -1
- package/dist/{vue-ui-mini-loader-BL2odRfu.js → vue-ui-mini-loader-D8W-fERs.js} +1 -1
- package/dist/{vue-ui-molecule-DeHWkkhy.js → vue-ui-molecule-BExVLLgE.js} +2 -2
- package/dist/{vue-ui-mood-radar-bvGx6XgG.js → vue-ui-mood-radar-TW251icr.js} +6 -4
- package/dist/{vue-ui-nested-donuts-CeAV2xPk.js → vue-ui-nested-donuts-CWzJKr3S.js} +6 -4
- package/dist/{vue-ui-onion-B7oFulsQ.js → vue-ui-onion-VaYZQK5i.js} +6 -4
- package/dist/{vue-ui-parallel-coordinate-plot-B_QJ4N9o.js → vue-ui-parallel-coordinate-plot-RM25bxtf.js} +6 -4
- package/dist/{vue-ui-quadrant-DrKnz37q.js → vue-ui-quadrant-Dmtwow7n.js} +6 -4
- package/dist/{vue-ui-quick-chart-BFscCR59.js → vue-ui-quick-chart-Cswm3_eI.js} +6 -4
- package/dist/{vue-ui-radar-Bzx69q8f.js → vue-ui-radar-C3GYthqu.js} +6 -4
- package/dist/{vue-ui-rating-CimC9FQ9.js → vue-ui-rating-CBdDXL80.js} +1 -1
- package/dist/{vue-ui-relation-circle-DIQYyDGb.js → vue-ui-relation-circle-BA0qy0kp.js} +9 -7
- package/dist/{vue-ui-ridgeline-CPEnM45x.js → vue-ui-ridgeline-C5skjBTe.js} +468 -459
- package/dist/{vue-ui-rings-qPL5Iwji.js → vue-ui-rings-BJ8yEQMw.js} +6 -4
- package/dist/{vue-ui-scatter-BB0ClTsU.js → vue-ui-scatter-DXg8ESgr.js} +6 -4
- package/dist/{vue-ui-skeleton-zmbcOVEf.js → vue-ui-skeleton-D_u8EWeW.js} +2 -2
- package/dist/{vue-ui-smiley-DzPkCMN-.js → vue-ui-smiley-DQOp87rr.js} +1 -1
- package/dist/{vue-ui-spark-trend-Ciq7-k_q.js → vue-ui-spark-trend-CjCufXof.js} +2 -2
- package/dist/{vue-ui-sparkbar-D1M7-naP.js → vue-ui-sparkbar-BniEM15a.js} +2 -2
- package/dist/{vue-ui-sparkgauge-rsqaeR_n.js → vue-ui-sparkgauge-BtyCrqTQ.js} +2 -2
- package/dist/{vue-ui-sparkhistogram-C4WXt2Ni.js → vue-ui-sparkhistogram-DQdn3PW1.js} +2 -2
- package/dist/{vue-ui-sparkline-Dv7XrEzO.js → vue-ui-sparkline-9qkNNZG6.js} +2 -2
- package/dist/{vue-ui-sparkstackbar-DDOXdeV-.js → vue-ui-sparkstackbar-BXQlOdOk.js} +2 -2
- package/dist/{vue-ui-stackbar-C_hMnOLb.js → vue-ui-stackbar-CkjicNDv.js} +6 -4
- package/dist/{vue-ui-stackline-BHGi63lD.js → vue-ui-stackline-BB1IZta8.js} +6 -4
- package/dist/{vue-ui-strip-plot-Cygpn-l8.js → vue-ui-strip-plot-DGLGuH6e.js} +6 -4
- package/dist/{vue-ui-table-BQna1wL6.js → vue-ui-table-BXz_HY2g.js} +3 -3
- package/dist/{vue-ui-table-heatmap-Dv_ZKKm3.js → vue-ui-table-heatmap-XmDK1aHJ.js} +1 -1
- package/dist/{vue-ui-table-sparkline-BCuimtk6.js → vue-ui-table-sparkline-MTEw3imE.js} +2 -2
- package/dist/{vue-ui-thermometer-DytlLJ32.js → vue-ui-thermometer-CLx3SPRv.js} +9 -7
- package/dist/{vue-ui-timer-CvHP4HoW.js → vue-ui-timer-BDWUNb6t.js} +2 -2
- package/dist/{vue-ui-tiremarks-BvjdZwgh.js → vue-ui-tiremarks-DoaypTC-.js} +6 -4
- package/dist/{vue-ui-treemap-C5OpqzSc.js → vue-ui-treemap-Bv7PgpiC.js} +7 -5
- package/dist/{vue-ui-waffle-B7T_Zzan.js → vue-ui-waffle-z2DhvSAx.js} +6 -4
- package/dist/{vue-ui-wheel-D1B0k7IW.js → vue-ui-wheel-DYLBJuFb.js} +9 -7
- package/dist/{vue-ui-word-cloud-C4pX6jop.js → vue-ui-word-cloud-CbpEhSdL.js} +6 -4
- package/dist/{vue-ui-world-D0_2upjg.js → vue-ui-world-C2atz4Xm.js} +6 -4
- package/dist/{vue-ui-xy-Ck41KYqF.js → vue-ui-xy-B3DQ6t46.js} +7 -5
- package/dist/{vue-ui-xy-D_5FfaH-.js → vue-ui-xy-CpA0W6zM.js} +2 -2
- package/dist/{vue-ui-xy-canvas-B_8Mu19r.js → vue-ui-xy-canvas-CJefORWc.js} +3 -3
- package/package.json +1 -1
- package/dist/vue-ui-annotator-CmlcWPIm.js +0 -2886
|
@@ -0,0 +1,3325 @@
|
|
|
1
|
+
import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
|
|
2
|
+
import { C as t, It as n, Zt as r, q as i } from "./lib-Dql7cqyA.js";
|
|
3
|
+
import { n as a, t as o } from "./useHints-Dq_w2E8B.js";
|
|
4
|
+
import { t as s } from "./useConfig-C_mX5pOZ.js";
|
|
5
|
+
import { t as c } from "./usePrinter-DISD7q5m.js";
|
|
6
|
+
import { t as l } from "./dom-to-png-C6cQJ5Hq.js";
|
|
7
|
+
import { t as ee } from "./_plugin-vue_export-helper-B3ysoDQm.js";
|
|
8
|
+
import { t as u } from "./BaseIcon-t83PDe9k.js";
|
|
9
|
+
import { t as te } from "./vue-ui-accordion-DRf3NQyH.js";
|
|
10
|
+
import { t as ne } from "./ColorPicker-Bn3MY7eL.js";
|
|
11
|
+
import { Fragment as re, Teleport as ie, computed as ae, createBlock as d, createCommentVNode as f, createElementBlock as p, createElementVNode as m, createTextVNode as h, createVNode as oe, guardReactiveProps as se, nextTick as ce, normalizeClass as g, normalizeProps as le, normalizeStyle as _, onBeforeUnmount as ue, onMounted as de, openBlock as v, ref as y, renderList as fe, renderSlot as b, toDisplayString as x, unref as pe, vModelCheckbox as me, vModelText as he, watch as ge, withCtx as S, withDirectives as _e, withModifiers as ve } from "vue";
|
|
12
|
+
//#region src/registerAnnotatorShortcuts.js
|
|
13
|
+
function ye(e) {
|
|
14
|
+
let t = (t) => e.isMacLike.value ? t.metaKey : t.ctrlKey, n = (e) => {
|
|
15
|
+
let t = e;
|
|
16
|
+
if (!t) return !1;
|
|
17
|
+
let n = (t.tagName || "").toLowerCase();
|
|
18
|
+
return t.isContentEditable || n === "input" || n === "textarea" || n === "select";
|
|
19
|
+
}, r = (t) => !!(!e.isSummaryOpen.value || n(t.target) || e.isWriting.value), i = () => {
|
|
20
|
+
e.isDeleteMode.value = !1, e.isMoveMode.value = !1, e.isResizeMode.value = !1, e.isSelectMode.value = !1, e.isDrawMode.value = !1, e.isTextMode.value = !1, e.activeShape.value = void 0, e.showCaret.value = !1;
|
|
21
|
+
}, a = (t) => {
|
|
22
|
+
switch (i(), t) {
|
|
23
|
+
case "m":
|
|
24
|
+
e.isMoveMode.value = !0;
|
|
25
|
+
break;
|
|
26
|
+
case "r":
|
|
27
|
+
e.isResizeMode.value = !0;
|
|
28
|
+
break;
|
|
29
|
+
case "d":
|
|
30
|
+
e.isDeleteMode.value = !0;
|
|
31
|
+
break;
|
|
32
|
+
case "g":
|
|
33
|
+
e.isSelectMode.value = !0, e.setShapeTo("group"), e.activeShape.value = "group";
|
|
34
|
+
break;
|
|
35
|
+
case "t": e.isTextMode.value = !0, e.isWriting.value = !1, e.showCaret.value = !1;
|
|
36
|
+
}
|
|
37
|
+
}, o = (t) => {
|
|
38
|
+
switch (t) {
|
|
39
|
+
case "c":
|
|
40
|
+
e.setShapeTo("circle");
|
|
41
|
+
break;
|
|
42
|
+
case "s":
|
|
43
|
+
e.setShapeTo("rect");
|
|
44
|
+
break;
|
|
45
|
+
case "a":
|
|
46
|
+
e.setShapeTo("arrow");
|
|
47
|
+
break;
|
|
48
|
+
case "l": e.setShapeTo("line");
|
|
49
|
+
}
|
|
50
|
+
}, s = (t, n) => {
|
|
51
|
+
let r = e.lastSelectedShape.value;
|
|
52
|
+
if (!r) return;
|
|
53
|
+
let i = (e, t) => {
|
|
54
|
+
typeof r[e] == "number" && (r[e] += t);
|
|
55
|
+
};
|
|
56
|
+
switch (r.type) {
|
|
57
|
+
case "rect":
|
|
58
|
+
case "circle":
|
|
59
|
+
case "text":
|
|
60
|
+
i("x", t), i("y", n);
|
|
61
|
+
break;
|
|
62
|
+
case "arrow": i("x", t), i("y", n), i("endX", t), i("endY", n);
|
|
63
|
+
}
|
|
64
|
+
}, c = () => {
|
|
65
|
+
let t = e.lastSelectedShape.value;
|
|
66
|
+
t && (e.shapes.value = e.shapes.value.filter((e) => e.id !== t.id), e.lastSelectedShape.value = void 0);
|
|
67
|
+
}, l = !1, ee = null, u = () => {
|
|
68
|
+
l || (l = !0, e.history?.value?.begin?.("nudge"));
|
|
69
|
+
}, te = () => {
|
|
70
|
+
l && (clearTimeout(ee), ee = setTimeout(() => {
|
|
71
|
+
l = !1, e.history?.value?.end?.();
|
|
72
|
+
}, 160));
|
|
73
|
+
}, ne = () => {
|
|
74
|
+
clearTimeout(ee), l && e.history?.value?.end?.(), l = !1;
|
|
75
|
+
}, re = (n) => {
|
|
76
|
+
if (t(n) && !n.shiftKey && n.key.toLowerCase() === "z") {
|
|
77
|
+
if (r(n)) return;
|
|
78
|
+
n.preventDefault(), e.undoLastShape?.();
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
if (t(n) && n.shiftKey && n.key.toLowerCase() === "z" || t(n) && n.key.toLowerCase() === "y") {
|
|
82
|
+
if (r(n)) return;
|
|
83
|
+
n.preventDefault(), typeof e.redoLastShape == "function" ? e.redoLastShape() : e.history?.value?.redo?.();
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
if (r(n)) return;
|
|
87
|
+
let l = n.key.toLowerCase();
|
|
88
|
+
if (l === "escape") {
|
|
89
|
+
n.preventDefault(), i();
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
if (l === "delete" || l === "backspace") {
|
|
93
|
+
n.preventDefault(), c();
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
if ([
|
|
97
|
+
"m",
|
|
98
|
+
"r",
|
|
99
|
+
"d",
|
|
100
|
+
"g",
|
|
101
|
+
"t"
|
|
102
|
+
].includes(l)) {
|
|
103
|
+
n.preventDefault(), a(l);
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
if ([
|
|
107
|
+
"c",
|
|
108
|
+
"a",
|
|
109
|
+
"l",
|
|
110
|
+
"s"
|
|
111
|
+
].includes(l)) {
|
|
112
|
+
n.preventDefault(), o(l);
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
if (n.key === "ArrowUp" || n.key === "ArrowDown" || n.key === "ArrowLeft" || n.key === "ArrowRight") {
|
|
116
|
+
n.preventDefault(), u();
|
|
117
|
+
let e = n.shiftKey ? 10 : 1;
|
|
118
|
+
n.key === "ArrowUp" && s(0, -e), n.key === "ArrowDown" && s(0, e), n.key === "ArrowLeft" && s(-e, 0), n.key === "ArrowRight" && s(e, 0), te();
|
|
119
|
+
}
|
|
120
|
+
}, ie = (e) => {
|
|
121
|
+
e.key.startsWith("Arrow") && te();
|
|
122
|
+
};
|
|
123
|
+
return window.addEventListener("keydown", re), window.addEventListener("keyup", ie), function() {
|
|
124
|
+
window.removeEventListener("keydown", re), window.removeEventListener("keyup", ie), ne();
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
//#endregion
|
|
128
|
+
//#region src/atoms/TeleportedTooltip.vue
|
|
129
|
+
var be = { class: "teleport-tooltip__inner" }, C = /*#__PURE__*/ ee({
|
|
130
|
+
__name: "TeleportedTooltip",
|
|
131
|
+
props: {
|
|
132
|
+
show: {
|
|
133
|
+
type: Boolean,
|
|
134
|
+
default: !1
|
|
135
|
+
},
|
|
136
|
+
x: {
|
|
137
|
+
type: Number,
|
|
138
|
+
required: !0
|
|
139
|
+
},
|
|
140
|
+
y: {
|
|
141
|
+
type: Number,
|
|
142
|
+
required: !0
|
|
143
|
+
},
|
|
144
|
+
placement: {
|
|
145
|
+
type: String,
|
|
146
|
+
default: "top"
|
|
147
|
+
},
|
|
148
|
+
styleObject: {
|
|
149
|
+
type: Object,
|
|
150
|
+
default() {
|
|
151
|
+
return {};
|
|
152
|
+
}
|
|
153
|
+
},
|
|
154
|
+
delay: {
|
|
155
|
+
type: Number,
|
|
156
|
+
default: 0
|
|
157
|
+
},
|
|
158
|
+
delayIn: {
|
|
159
|
+
type: Number,
|
|
160
|
+
default: 300
|
|
161
|
+
},
|
|
162
|
+
delayOut: {
|
|
163
|
+
type: Number,
|
|
164
|
+
default: 0
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
setup(e) {
|
|
168
|
+
let t = e, n = ae(() => t.delayIn ?? t.delay), r = ae(() => t.delayOut ?? t.delay), i = y(!1), a = null, o = null;
|
|
169
|
+
function s() {
|
|
170
|
+
a &&= (clearTimeout(a), null), o &&= (clearTimeout(o), null);
|
|
171
|
+
}
|
|
172
|
+
function c() {
|
|
173
|
+
s();
|
|
174
|
+
let e = Math.max(0, n.value || 0);
|
|
175
|
+
e === 0 ? i.value = !0 : a = setTimeout(() => {
|
|
176
|
+
i.value = !0, a = null;
|
|
177
|
+
}, e);
|
|
178
|
+
}
|
|
179
|
+
function l() {
|
|
180
|
+
s();
|
|
181
|
+
let e = Math.max(0, r.value || 0);
|
|
182
|
+
e === 0 ? i.value = !1 : o = setTimeout(() => {
|
|
183
|
+
i.value = !1, o = null;
|
|
184
|
+
}, e);
|
|
185
|
+
}
|
|
186
|
+
ge(() => t.show, (e) => {
|
|
187
|
+
e ? c() : l();
|
|
188
|
+
}, { immediate: !0 }), de(() => {
|
|
189
|
+
t.show && c();
|
|
190
|
+
}), ue(() => {
|
|
191
|
+
s();
|
|
192
|
+
});
|
|
193
|
+
let ee = ae(() => ({
|
|
194
|
+
position: "fixed",
|
|
195
|
+
zIndex: 2147483647,
|
|
196
|
+
top: `${t.y}px`,
|
|
197
|
+
left: `${t.x}px`,
|
|
198
|
+
transform: t.placement === "bottom" ? "translate(-50%, 8px)" : "translate(-50%, -100%)",
|
|
199
|
+
pointerEvents: "none",
|
|
200
|
+
...t.styleObject
|
|
201
|
+
}));
|
|
202
|
+
return (t, n) => (v(), d(ie, { to: "body" }, [i.value ? (v(), p("div", {
|
|
203
|
+
key: 0,
|
|
204
|
+
class: g(["teleport-tooltip", e.placement]),
|
|
205
|
+
style: _(ee.value),
|
|
206
|
+
role: "tooltip",
|
|
207
|
+
"aria-hidden": "false"
|
|
208
|
+
}, [m("div", be, [b(t.$slots, "default", {}, void 0, !0)])], 6)) : f("", !0)]));
|
|
209
|
+
}
|
|
210
|
+
}, [["__scopeId", "data-v-c292996f"]]), xe = /* @__PURE__ */ e({ default: () => Dt }), Se = { class: "vue-data-ui-component vue-ui-annotator" }, Ce = { "data-dom-to-png-ignore": "" }, we = ["id"], Te = ["id"], Ee = { class: "tool-selection" }, De = ["disabled"], Oe = ["disabled"], ke = ["disabled"], Ae = ["disabled"], je = ["disabled"], Me = ["disabled"], Ne = ["disabled"], Pe = ["disabled"], Fe = ["disabled"], Ie = {
|
|
211
|
+
class: "tool-selection",
|
|
212
|
+
style: { "margin-top": "6px" }
|
|
213
|
+
}, Le = {
|
|
214
|
+
viewBox: "0 0 12 12",
|
|
215
|
+
style: { width: "100%" }
|
|
216
|
+
}, Re = ["fill"], ze = { key: 0 }, Be = { class: "tool-input" }, Ve = ["checked"], He = {
|
|
217
|
+
viewBox: "0 0 12 12",
|
|
218
|
+
style: { width: "100%" }
|
|
219
|
+
}, Ue = ["fill"], We = { key: 1 }, Ge = { class: "tool-input" }, Ke = ["checked"], qe = {
|
|
220
|
+
viewBox: "0 0 24 24",
|
|
221
|
+
style: { width: "100%" }
|
|
222
|
+
}, Je = ["stroke"], Ye = { key: 2 }, Xe = { style: {
|
|
223
|
+
display: "flex",
|
|
224
|
+
"flex-direction": "column",
|
|
225
|
+
"align-items": "center",
|
|
226
|
+
"justify-content": "center"
|
|
227
|
+
} }, Ze = { class: "tool-input" }, Qe = { key: 3 }, $e = { style: {
|
|
228
|
+
display: "flex",
|
|
229
|
+
"flex-direction": "column",
|
|
230
|
+
"align-items": "center",
|
|
231
|
+
"justify-content": "center"
|
|
232
|
+
} }, et = { class: "tool-input" }, tt = ["checked"], nt = { key: 4 }, rt = { style: {
|
|
233
|
+
display: "flex",
|
|
234
|
+
"flex-direction": "column",
|
|
235
|
+
"align-items": "center",
|
|
236
|
+
"justify-content": "center"
|
|
237
|
+
} }, it = { class: "tool-input" }, at = { key: 5 }, ot = { key: 6 }, st = ["disabled"], ct = { key: 7 }, lt = ["disabled"], ut = { key: 8 }, dt = { key: 9 }, ft = { key: 10 }, pt = { key: 11 }, mt = {
|
|
238
|
+
style: {
|
|
239
|
+
display: "flex",
|
|
240
|
+
"flex-direction": "column",
|
|
241
|
+
"align-items": "center",
|
|
242
|
+
"justify-content": "center"
|
|
243
|
+
},
|
|
244
|
+
class: "tooltip"
|
|
245
|
+
}, ht = { style: {
|
|
246
|
+
display: "flex",
|
|
247
|
+
"flex-direction": "column",
|
|
248
|
+
"align-items": "start",
|
|
249
|
+
"justify-content": "center"
|
|
250
|
+
} }, gt = {
|
|
251
|
+
class: "tool-input",
|
|
252
|
+
style: { "font-variant-numeric": "tabular-nums" }
|
|
253
|
+
}, _t = ["id"], vt = [
|
|
254
|
+
"viewBox",
|
|
255
|
+
"width",
|
|
256
|
+
"height"
|
|
257
|
+
], yt = [
|
|
258
|
+
"width",
|
|
259
|
+
"height",
|
|
260
|
+
"pointer-events"
|
|
261
|
+
], bt = [
|
|
262
|
+
"innerHTML",
|
|
263
|
+
"onClick",
|
|
264
|
+
"onDblclick"
|
|
265
|
+
], xt = [
|
|
266
|
+
"x1",
|
|
267
|
+
"x2",
|
|
268
|
+
"y1",
|
|
269
|
+
"y2",
|
|
270
|
+
"stroke"
|
|
271
|
+
], St = [
|
|
272
|
+
"height",
|
|
273
|
+
"viewBox",
|
|
274
|
+
"width"
|
|
275
|
+
], Ct = ["cx", "cy"], wt = "annotations", Tt = "", Et = 450, Dt = /*#__PURE__*/ ee({
|
|
276
|
+
__name: "vue-ui-annotator",
|
|
277
|
+
props: {
|
|
278
|
+
config: {
|
|
279
|
+
type: Object,
|
|
280
|
+
default() {
|
|
281
|
+
return {};
|
|
282
|
+
}
|
|
283
|
+
},
|
|
284
|
+
dataset: {
|
|
285
|
+
type: Object,
|
|
286
|
+
default() {
|
|
287
|
+
return {
|
|
288
|
+
shapes: [],
|
|
289
|
+
lastSelectedShape: void 0
|
|
290
|
+
};
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
},
|
|
294
|
+
emits: ["toggleOpenState", "saveAnnotations"],
|
|
295
|
+
setup(e, { emit: ee }) {
|
|
296
|
+
let be = e, xe = ee, Dt = y(!1), Ot = y(!1);
|
|
297
|
+
de(() => Dt.value = !0);
|
|
298
|
+
let kt = y(i()), { isImaging: At, generateImage: jt } = c({
|
|
299
|
+
elementId: kt.value,
|
|
300
|
+
fileName: wt
|
|
301
|
+
}), w = y(void 0), Mt = y(1), T = y({
|
|
302
|
+
start: {
|
|
303
|
+
x: 0,
|
|
304
|
+
y: 0
|
|
305
|
+
},
|
|
306
|
+
end: {
|
|
307
|
+
x: 0,
|
|
308
|
+
y: 0
|
|
309
|
+
}
|
|
310
|
+
}), E = y(void 0), Nt = y(void 0), Pt = y(!1), Ft = y(!1), It = y(!1), D = y(!1), Lt = y(!1), Rt = y(!0), O = y(!1), zt = y(!1), Bt = y(!1), k = y(!1), Vt = y(!1), A = y(!1), j = y(!1), M = y(!1);
|
|
311
|
+
ge(M, async (e) => {
|
|
312
|
+
if (Ot.value = !1, !e) {
|
|
313
|
+
F.value = void 0, E.value = void 0, Nt.value = void 0, Wt.value = [], j.value = !1;
|
|
314
|
+
return;
|
|
315
|
+
}
|
|
316
|
+
await ce(), Ot.value = !0;
|
|
317
|
+
});
|
|
318
|
+
let N = y(!1), Ht = y(!1), P = y(!1), F = y(be.dataset?.lastSelectedShape ?? void 0), I = y({
|
|
319
|
+
x: 0,
|
|
320
|
+
y: 0
|
|
321
|
+
}), Ut = y(!0), Wt = y([]), L = y(be.dataset?.shapes || []);
|
|
322
|
+
y([]);
|
|
323
|
+
let Gt = y(Math.round(Math.random()) * 1e5), Kt = y(1e3), qt = y(1e3), R = y({
|
|
324
|
+
arrow: {
|
|
325
|
+
color: "grey",
|
|
326
|
+
filled: !0
|
|
327
|
+
},
|
|
328
|
+
circle: {
|
|
329
|
+
color: "grey",
|
|
330
|
+
filled: !1,
|
|
331
|
+
radius: 3,
|
|
332
|
+
strokeWidth: 2
|
|
333
|
+
},
|
|
334
|
+
rect: {
|
|
335
|
+
color: "grey",
|
|
336
|
+
filled: !1,
|
|
337
|
+
strokeWidth: 2,
|
|
338
|
+
height: 12,
|
|
339
|
+
width: 12
|
|
340
|
+
}
|
|
341
|
+
}), z = y(!1), Jt = y(1), Yt = y(void 0), Xt = y(1), Zt = y(1), B = y("start"), Qt = y(20), $t = y(100), en = n, V = y(null), tn = y(null), H = y(null), nn = y(null), rn = y(null), an = y(!1), on = y({
|
|
342
|
+
row: 0,
|
|
343
|
+
col: 0
|
|
344
|
+
}), U = y(null), W = y(!1), G = y(null), K = y({
|
|
345
|
+
x: 0,
|
|
346
|
+
y: 0
|
|
347
|
+
}), sn = y(null), q = y([]), cn = y(!1), ln = y(null), un = y({
|
|
348
|
+
undo: 0,
|
|
349
|
+
redo: 0
|
|
350
|
+
}), dn = y(null);
|
|
351
|
+
y(null), y(null);
|
|
352
|
+
let fn = y(null), J = ae(() => {
|
|
353
|
+
let e = s().vue_ui_annotator;
|
|
354
|
+
if (!Object.keys(be.config || {}).length) return e;
|
|
355
|
+
let n = r({
|
|
356
|
+
defaultConfig: e,
|
|
357
|
+
userConfig: be.config
|
|
358
|
+
});
|
|
359
|
+
return t(n);
|
|
360
|
+
}), pn = y(J.value.style.paletteColor);
|
|
361
|
+
a({
|
|
362
|
+
config: () => J.value,
|
|
363
|
+
dataset: () => [],
|
|
364
|
+
component: "VueUiAnnotator",
|
|
365
|
+
rules: [o.noHint]
|
|
366
|
+
});
|
|
367
|
+
let Y = ae(() => J.value.useCursorPointer), X = ae(() => {
|
|
368
|
+
let e = J.value.style.tooltips;
|
|
369
|
+
return {
|
|
370
|
+
backgroundColor: e.backgroundColor,
|
|
371
|
+
color: e.color,
|
|
372
|
+
border: e.border,
|
|
373
|
+
borderRadius: `${e.borderRadius}px`,
|
|
374
|
+
boxShadow: e.boxShadow
|
|
375
|
+
};
|
|
376
|
+
}), mn = ae(() => L.value.filter((e) => e.type !== "group" || Array.isArray(e.source) && e.source.length > 0).length > 1), hn = ae(() => en[$t.value > 98 ? 98 : $t.value]), gn = ae(() => {
|
|
377
|
+
switch (!0) {
|
|
378
|
+
case D.value: return "default";
|
|
379
|
+
case k.value: return "move";
|
|
380
|
+
case N.value: return "text";
|
|
381
|
+
case A.value: return "move";
|
|
382
|
+
default: return "";
|
|
383
|
+
}
|
|
384
|
+
}), _n = ae(() => L.value), vn = y(null);
|
|
385
|
+
function yn(e) {
|
|
386
|
+
return e ? !!(F.value && F.value.id === e.id) : !1;
|
|
387
|
+
}
|
|
388
|
+
function bn(e = "") {
|
|
389
|
+
let t = String(e).trim().split(/\s+/).map(Number).filter(Number.isFinite), n = [];
|
|
390
|
+
for (let e = 0; e + 1 < t.length; e += 2) n.push({
|
|
391
|
+
x: t[e],
|
|
392
|
+
y: t[e + 1]
|
|
393
|
+
});
|
|
394
|
+
return n;
|
|
395
|
+
}
|
|
396
|
+
function xn(e = []) {
|
|
397
|
+
return e.map(({ x: e, y: t }) => `${e} ${t}`).join(" ");
|
|
398
|
+
}
|
|
399
|
+
function Sn(e = "") {
|
|
400
|
+
let t = bn(e);
|
|
401
|
+
if (!t.length) return null;
|
|
402
|
+
let n = t.map((e) => e.x), r = t.map((e) => e.y), i = Math.min(...n), a = Math.max(...n), o = Math.min(...r), s = Math.max(...r);
|
|
403
|
+
return {
|
|
404
|
+
minX: i,
|
|
405
|
+
minY: o,
|
|
406
|
+
maxX: a,
|
|
407
|
+
maxY: s,
|
|
408
|
+
width: Math.max(1, a - i),
|
|
409
|
+
height: Math.max(1, s - o)
|
|
410
|
+
};
|
|
411
|
+
}
|
|
412
|
+
function Cn(e) {
|
|
413
|
+
if (!e || !M.value || !A.value || !F.value || F.value.id !== e.id) return "";
|
|
414
|
+
let t = J.value.style.color || "grey", n = J.value.style.backgroundColor || "rgba(255,255,255,0.95)", r = ({ handle: r, x: i, y: a, cursor: o = "nwse-resize" }) => `
|
|
415
|
+
<circle
|
|
416
|
+
data-dom-to-png-ignore
|
|
417
|
+
id="${e.id}"
|
|
418
|
+
data-resize-handle="${r}"
|
|
419
|
+
cx="${i}"
|
|
420
|
+
cy="${a}"
|
|
421
|
+
r="7"
|
|
422
|
+
fill="${n}"
|
|
423
|
+
stroke="${t}"
|
|
424
|
+
stroke-width="2"
|
|
425
|
+
pointer-events="all"
|
|
426
|
+
style="cursor:${o}"
|
|
427
|
+
/>
|
|
428
|
+
`;
|
|
429
|
+
if (e.type === "arrow") return `
|
|
430
|
+
${r({
|
|
431
|
+
handle: "arrow-start",
|
|
432
|
+
x: e.x,
|
|
433
|
+
y: e.y,
|
|
434
|
+
cursor: "move"
|
|
435
|
+
})}
|
|
436
|
+
${r({
|
|
437
|
+
handle: "arrow-end",
|
|
438
|
+
x: e.endX,
|
|
439
|
+
y: e.endY,
|
|
440
|
+
cursor: "move"
|
|
441
|
+
})}
|
|
442
|
+
`;
|
|
443
|
+
if (e.type === "line") {
|
|
444
|
+
let t = Sn(e.path);
|
|
445
|
+
return t ? r({
|
|
446
|
+
handle: "line-scale",
|
|
447
|
+
x: t.maxX,
|
|
448
|
+
y: t.maxY
|
|
449
|
+
}) : "";
|
|
450
|
+
}
|
|
451
|
+
if (e.type === "circle") {
|
|
452
|
+
let t = Math.max(1, Number(e.circleRadius) || 1), n = tn.value === "circle-radius" && H.value?.shapeId === e.id && H.value?.handlePoint ? H.value.handlePoint : null;
|
|
453
|
+
return r({
|
|
454
|
+
handle: "circle-radius",
|
|
455
|
+
x: n?.x ?? e.x + t,
|
|
456
|
+
y: n?.y ?? e.y,
|
|
457
|
+
cursor: "move"
|
|
458
|
+
});
|
|
459
|
+
}
|
|
460
|
+
if (e.type === "rect") {
|
|
461
|
+
let t = Number(e.x) || 0, n = Number(e.y) || 0, i = t + Math.max(0, Number(e.rectWidth) || 0), a = n + Math.max(0, Number(e.rectHeight) || 0);
|
|
462
|
+
return `
|
|
463
|
+
${r({
|
|
464
|
+
handle: "rect-nw",
|
|
465
|
+
x: t,
|
|
466
|
+
y: n,
|
|
467
|
+
cursor: "nwse-resize"
|
|
468
|
+
})}
|
|
469
|
+
${r({
|
|
470
|
+
handle: "rect-ne",
|
|
471
|
+
x: i,
|
|
472
|
+
y: n,
|
|
473
|
+
cursor: "nesw-resize"
|
|
474
|
+
})}
|
|
475
|
+
${r({
|
|
476
|
+
handle: "rect-se",
|
|
477
|
+
x: i,
|
|
478
|
+
y: a,
|
|
479
|
+
cursor: "nwse-resize"
|
|
480
|
+
})}
|
|
481
|
+
${r({
|
|
482
|
+
handle: "rect-sw",
|
|
483
|
+
x: t,
|
|
484
|
+
y: a,
|
|
485
|
+
cursor: "nesw-resize"
|
|
486
|
+
})}
|
|
487
|
+
`;
|
|
488
|
+
}
|
|
489
|
+
return e.type === "group" ? r({
|
|
490
|
+
handle: "group-scale",
|
|
491
|
+
x: e.x + e.rectWidth,
|
|
492
|
+
y: e.y + e.rectHeight
|
|
493
|
+
}) : "";
|
|
494
|
+
}
|
|
495
|
+
function wn(e) {
|
|
496
|
+
if (!e || e.type === "text" && P.value && nn.value === e.id) return "";
|
|
497
|
+
let t = yn(e) ? "initial" : "none";
|
|
498
|
+
switch (e.type) {
|
|
499
|
+
case "rect": return `
|
|
500
|
+
<rect
|
|
501
|
+
data-dom-to-png-ignore
|
|
502
|
+
style="stroke-dasharray: 10; display:${t}"
|
|
503
|
+
x="${e.x - 20}"
|
|
504
|
+
y="${e.y - 20}"
|
|
505
|
+
height="${e.rectHeight + 40}"
|
|
506
|
+
width="${e.rectWidth + 40}"
|
|
507
|
+
fill="transparent"
|
|
508
|
+
stroke="grey"
|
|
509
|
+
pointer-events="none"
|
|
510
|
+
/>
|
|
511
|
+
`;
|
|
512
|
+
case "circle": return `
|
|
513
|
+
<rect
|
|
514
|
+
data-dom-to-png-ignore
|
|
515
|
+
style="stroke-dasharray: 10; display:${t}"
|
|
516
|
+
x="${e.x - e.circleRadius - 20}"
|
|
517
|
+
y="${e.y - e.circleRadius - 20}"
|
|
518
|
+
height="${e.circleRadius * 2 + 40}"
|
|
519
|
+
width="${e.circleRadius * 2 + 40}"
|
|
520
|
+
fill="transparent"
|
|
521
|
+
stroke="grey"
|
|
522
|
+
pointer-events="none"
|
|
523
|
+
/>
|
|
524
|
+
`;
|
|
525
|
+
case "arrow": {
|
|
526
|
+
let n = Math.min(e.x, e.endX), r = Math.min(e.y, e.endY), i = Math.max(1, Math.abs(e.endX - e.x)), a = Math.max(1, Math.abs(e.endY - e.y));
|
|
527
|
+
return `
|
|
528
|
+
<rect
|
|
529
|
+
style="stroke-dasharray: 10; display:${t}"
|
|
530
|
+
x="${n - 20}"
|
|
531
|
+
y="${r - 20}"
|
|
532
|
+
height="${a + 40}"
|
|
533
|
+
width="${i + 40}"
|
|
534
|
+
fill="transparent"
|
|
535
|
+
stroke="grey"
|
|
536
|
+
pointer-events="none"
|
|
537
|
+
/>
|
|
538
|
+
`;
|
|
539
|
+
}
|
|
540
|
+
case "line": {
|
|
541
|
+
let n = Sn(e.path);
|
|
542
|
+
return n ? `
|
|
543
|
+
<rect
|
|
544
|
+
style="stroke-dasharray: 10; display:${t}"
|
|
545
|
+
x="${n.minX - 20}"
|
|
546
|
+
y="${n.minY - 20}"
|
|
547
|
+
height="${n.height + 40}"
|
|
548
|
+
width="${n.width + 40}"
|
|
549
|
+
fill="transparent"
|
|
550
|
+
stroke="grey"
|
|
551
|
+
pointer-events="none"
|
|
552
|
+
/>
|
|
553
|
+
` : "";
|
|
554
|
+
}
|
|
555
|
+
case "text": {
|
|
556
|
+
let n = vn.value ? Array.from(vn.value.getElementsByTagName("text")).find((t) => t.getAttribute("data-shape-id") === e.id) : null;
|
|
557
|
+
if (!n) return "";
|
|
558
|
+
let { x: r, y: i, width: a, height: o } = n.getBBox();
|
|
559
|
+
return `
|
|
560
|
+
<rect
|
|
561
|
+
style="stroke-dasharray: 10; display:${t}"
|
|
562
|
+
x="${r - 20}"
|
|
563
|
+
y="${i - 20}"
|
|
564
|
+
height="${o + 40}"
|
|
565
|
+
width="${a + 40}"
|
|
566
|
+
fill="transparent"
|
|
567
|
+
stroke="grey"
|
|
568
|
+
pointer-events="none"
|
|
569
|
+
/>
|
|
570
|
+
`;
|
|
571
|
+
}
|
|
572
|
+
default: return "";
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
function Tn(e, t = !1) {
|
|
576
|
+
switch (!0) {
|
|
577
|
+
case e.type === "circle": return `
|
|
578
|
+
<g id="${e.id}" style="display:${D.value ? "initial" : "none"};">
|
|
579
|
+
<circle id="${e.id}" cx="${e.x}" cy="${e.y}" r="12" fill="red"/>
|
|
580
|
+
<line stroke="white" stroke-width="2" id="${e.id}" x1="${e.x - 4}" y1="${e.y - 4}" x2="${e.x + 4}" y2="${e.y + 4}"/>
|
|
581
|
+
<line stroke="white" stroke-width="2" id="${e.id}" x1="${e.x + 4}" y1="${e.y - 4}" x2="${e.x - 4}" y2="${e.y + 4}"/>
|
|
582
|
+
</g>
|
|
583
|
+
`;
|
|
584
|
+
case e.type === "text":
|
|
585
|
+
let n, r = [
|
|
586
|
+
-8,
|
|
587
|
+
-12,
|
|
588
|
+
-4,
|
|
589
|
+
-12,
|
|
590
|
+
-4
|
|
591
|
+
];
|
|
592
|
+
switch (!0) {
|
|
593
|
+
case e.textAlign === "start":
|
|
594
|
+
n = t ? [
|
|
595
|
+
-20,
|
|
596
|
+
-24,
|
|
597
|
+
-16,
|
|
598
|
+
-16,
|
|
599
|
+
-24
|
|
600
|
+
] : [
|
|
601
|
+
-16,
|
|
602
|
+
-20,
|
|
603
|
+
-12,
|
|
604
|
+
-12,
|
|
605
|
+
-20
|
|
606
|
+
];
|
|
607
|
+
break;
|
|
608
|
+
case e.textAlign === "middle":
|
|
609
|
+
n = [
|
|
610
|
+
0,
|
|
611
|
+
-4,
|
|
612
|
+
4,
|
|
613
|
+
4,
|
|
614
|
+
-4
|
|
615
|
+
], r = [
|
|
616
|
+
-32,
|
|
617
|
+
-36,
|
|
618
|
+
-28,
|
|
619
|
+
-36,
|
|
620
|
+
-28
|
|
621
|
+
];
|
|
622
|
+
break;
|
|
623
|
+
case e.textAlign === "end":
|
|
624
|
+
n = [
|
|
625
|
+
16,
|
|
626
|
+
20,
|
|
627
|
+
12,
|
|
628
|
+
12,
|
|
629
|
+
20
|
|
630
|
+
];
|
|
631
|
+
break;
|
|
632
|
+
default: n = [
|
|
633
|
+
0,
|
|
634
|
+
0,
|
|
635
|
+
0
|
|
636
|
+
];
|
|
637
|
+
}
|
|
638
|
+
return `
|
|
639
|
+
<g id="${e.id}" style="display:${D.value ? "initial" : "none"};">
|
|
640
|
+
<circle id="${e.id}" cx="${e.x + n[0]}" cy="${e.y + r[0]}" r="12" fill="red"/>
|
|
641
|
+
<line stroke="white" stroke-width="2" id="${e.id}" x1="${e.x + n[1]}" y1="${e.y + r[1]}" x2="${e.x + n[2]}" y2="${e.y + r[2]}"/>
|
|
642
|
+
<line stroke="white" stroke-width="2" id="${e.id}" x1="${e.x + n[3]}" y1="${e.y + r[3]}" x2="${e.x + n[4]}" y2="${e.y + r[4]}"/>
|
|
643
|
+
</g>
|
|
644
|
+
`;
|
|
645
|
+
default: return `
|
|
646
|
+
<g id="${e.id}" style="display:${D.value ? "initial" : "none"};">
|
|
647
|
+
<circle id="${e.id}" cx="${e.x - 4}" cy="${e.y - 4}" r="12" fill="red"/>
|
|
648
|
+
<line stroke="white" stroke-width="2" id="${e.id}" x1="${e.x - 8}" y1="${e.y - 8}" x2="${e.x}" y2="${e.y}"/>
|
|
649
|
+
<line stroke="white" stroke-width="2" id="${e.id}" x1="${e.x}" y1="${e.y - 8}" x2="${e.x - 8}" y2="${e.y}"/>
|
|
650
|
+
</g>
|
|
651
|
+
`;
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
function En(e = "") {
|
|
655
|
+
return String(e).replace(/ /g, "\xA0");
|
|
656
|
+
}
|
|
657
|
+
function Dn(e) {
|
|
658
|
+
return String(e?.textContent ?? "").split(Tt).map(En);
|
|
659
|
+
}
|
|
660
|
+
function On(e, t) {
|
|
661
|
+
if (!e) return;
|
|
662
|
+
let n = t.length ? t : [""];
|
|
663
|
+
e.textContent = n.join(Tt), e.lines = Math.max(0, n.length - 1);
|
|
664
|
+
}
|
|
665
|
+
function kn(e = "") {
|
|
666
|
+
return String(e).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
667
|
+
}
|
|
668
|
+
function An(e = "") {
|
|
669
|
+
return kn(En(e)) || "​";
|
|
670
|
+
}
|
|
671
|
+
function jn(e, t, n = !1) {
|
|
672
|
+
let r = Dn(e), i = Math.max(1, r.length), a = r.reduce((e, t) => Math.max(e, t.length), 0), o = Math.max(24, a * e.fontSize * .7 + 16), s = e.textAlign === "middle" ? e.x - o / 2 : e.textAlign === "end" ? e.x - o : e.x, c = Math.max(e.fontSize * 1.2, e.fontSize * i);
|
|
673
|
+
return `
|
|
674
|
+
<g id="${e.id}">
|
|
675
|
+
<rect
|
|
676
|
+
id="${e.id}"
|
|
677
|
+
data-shape-hit-area="true"
|
|
678
|
+
x="${s - 8}"
|
|
679
|
+
y="${e.y - e.fontSize}"
|
|
680
|
+
height="${c + 8}"
|
|
681
|
+
width="${o + 16}"
|
|
682
|
+
fill="transparent"
|
|
683
|
+
pointer-events="all"
|
|
684
|
+
/>
|
|
685
|
+
<text
|
|
686
|
+
data-shape-id="${e.id}"
|
|
687
|
+
style="user-select:none;"
|
|
688
|
+
id="${e.id}"
|
|
689
|
+
x="${e.x}"
|
|
690
|
+
y="${e.y}"
|
|
691
|
+
text-anchor="${e.textAlign}"
|
|
692
|
+
font-size="${e.fontSize}"
|
|
693
|
+
fill="${e.color}"
|
|
694
|
+
font-weight="${e.isBold ? "bold" : "normal"}"
|
|
695
|
+
font-style="${e.isItalic ? "italic" : "normal"}"
|
|
696
|
+
text-decoration="${e.isUnderline ? "underline" : "none"}"
|
|
697
|
+
pointer-events="bounding-box"
|
|
698
|
+
>
|
|
699
|
+
${t.join("")}
|
|
700
|
+
</text>
|
|
701
|
+
${Tn(e, n)}
|
|
702
|
+
</g>
|
|
703
|
+
`;
|
|
704
|
+
}
|
|
705
|
+
let Mn = ae(() => _n.value.map((e) => {
|
|
706
|
+
switch (!0) {
|
|
707
|
+
case e && e.type === "arrow": {
|
|
708
|
+
let t = e.strokeWidth > 3 ? 5 : 10, n = e.strokeWidth > 3 ? 2.5 : 5, r = `marker_${e.id}`, i = Math.max(24, Number(e.strokeWidth || 1) + 24);
|
|
709
|
+
return {
|
|
710
|
+
html: `
|
|
711
|
+
<defs>
|
|
712
|
+
<marker
|
|
713
|
+
id="${r}"
|
|
714
|
+
markerWidth="${t}"
|
|
715
|
+
markerHeight="${t}"
|
|
716
|
+
refX="0"
|
|
717
|
+
refY="${n}"
|
|
718
|
+
orient="auto"
|
|
719
|
+
>
|
|
720
|
+
<polygon
|
|
721
|
+
points="0 0,${t} ${n}, 0 ${t}"
|
|
722
|
+
fill="${e.color}"
|
|
723
|
+
/>
|
|
724
|
+
</marker>
|
|
725
|
+
</defs>
|
|
726
|
+
<g id="${e.id}">
|
|
727
|
+
${wn(e)}
|
|
728
|
+
<path
|
|
729
|
+
id="${e.id}"
|
|
730
|
+
data-shape-hit-area="true"
|
|
731
|
+
d="M${e.x},${e.y} ${e.endX},${e.endY}"
|
|
732
|
+
fill="none"
|
|
733
|
+
stroke="transparent"
|
|
734
|
+
stroke-width="${i}"
|
|
735
|
+
pointer-events="stroke"
|
|
736
|
+
/>
|
|
737
|
+
<path
|
|
738
|
+
id="${e.id}"
|
|
739
|
+
data-shape-visible="true"
|
|
740
|
+
style="stroke-linecap: round !important; ${e.isDash ? `stroke-dasharray: ${e.strokeWidth * 3}` : ""}"
|
|
741
|
+
stroke="${e.color}"
|
|
742
|
+
d="M${e.x},${e.y} ${e.endX},${e.endY}"
|
|
743
|
+
stroke-width="${e.strokeWidth}"
|
|
744
|
+
fill="none"
|
|
745
|
+
pointer-events="stroke"
|
|
746
|
+
marker-end="url(#${r})"
|
|
747
|
+
/>
|
|
748
|
+
${Cn(e)}
|
|
749
|
+
${Tn(e)}
|
|
750
|
+
</g>
|
|
751
|
+
`,
|
|
752
|
+
id: e.id
|
|
753
|
+
};
|
|
754
|
+
}
|
|
755
|
+
case e && e.type === "circle": return {
|
|
756
|
+
html: `
|
|
757
|
+
<g id="${e.id}">
|
|
758
|
+
${wn(e)}
|
|
759
|
+
<circle
|
|
760
|
+
id="${e.id}"
|
|
761
|
+
cx="${e.x}"
|
|
762
|
+
cy="${e.y}"
|
|
763
|
+
r="${e.circleRadius ? e.circleRadius : Number.MIN_VALUE}"
|
|
764
|
+
fill="${e.isFilled ? e.color + e.alpha : "rgba(255,255,255,0.001)"}"
|
|
765
|
+
stroke="${e.color + e.alpha}"
|
|
766
|
+
stroke-width="${e.strokeWidth}"
|
|
767
|
+
style="${e.isDash ? `stroke-dasharray: ${e.strokeWidth * 3}` : ""}"
|
|
768
|
+
>
|
|
769
|
+
</circle>
|
|
770
|
+
${Cn(e)}
|
|
771
|
+
</g>
|
|
772
|
+
|
|
773
|
+
${Tn(e)}`,
|
|
774
|
+
id: e.id
|
|
775
|
+
};
|
|
776
|
+
case e && e.type === "group": return {
|
|
777
|
+
html: `<g id="${e.id}">
|
|
778
|
+
<rect
|
|
779
|
+
data-dom-to-png-ignore
|
|
780
|
+
id="${A.value ? "" : e.id}"
|
|
781
|
+
x="${e.x}"
|
|
782
|
+
y="${e.y}"
|
|
783
|
+
fill="transparent"
|
|
784
|
+
height="${e.rectHeight}"
|
|
785
|
+
width="${e.rectWidth}"
|
|
786
|
+
stroke="grey"
|
|
787
|
+
stroke-width="1"
|
|
788
|
+
style="rx:1 !important; ry:1 !important; ${e.isDash ? `stroke-dasharray: ${e.strokeWidth * 3}` : ""}; display:${j.value || D.value || yn(e) ? "initial" : "none"};"
|
|
789
|
+
/>
|
|
790
|
+
<g id="${e.id}">
|
|
791
|
+
${e.content ? e.content : ""}
|
|
792
|
+
</g>
|
|
793
|
+
${Cn(e)}
|
|
794
|
+
${Tn(e)}
|
|
795
|
+
</g> `,
|
|
796
|
+
id: e.id
|
|
797
|
+
};
|
|
798
|
+
case e && e.type === "rect": return {
|
|
799
|
+
html: `<g id="${e.id}">
|
|
800
|
+
${wn(e)}
|
|
801
|
+
<rect
|
|
802
|
+
id="${A.value ? "" : e.id}"
|
|
803
|
+
x="${e.x}"
|
|
804
|
+
y="${e.y}"
|
|
805
|
+
fill="${e.isFilled ? e.color + e.alpha : "rgba(255,255,255,0.001)"}"
|
|
806
|
+
height="${e.rectHeight}"
|
|
807
|
+
width="${e.rectWidth}"
|
|
808
|
+
stroke="${e.color + e.alpha}"
|
|
809
|
+
stroke-width="${e.strokeWidth}"
|
|
810
|
+
style="rx:1 !important; ry:1 !important; ${e.isDash ? `stroke-dasharray: ${e.strokeWidth * 3}` : ""}"
|
|
811
|
+
/>
|
|
812
|
+
${Cn(e)}
|
|
813
|
+
${Tn(e)}
|
|
814
|
+
</g> `,
|
|
815
|
+
id: e.id
|
|
816
|
+
};
|
|
817
|
+
case e && e.type === "line": {
|
|
818
|
+
let t = Math.max(24, Number(e.strokeWidth || 1) + 24);
|
|
819
|
+
return {
|
|
820
|
+
html: `
|
|
821
|
+
<g id="${e.id}">
|
|
822
|
+
${wn(e)}
|
|
823
|
+
<path
|
|
824
|
+
id="${e.id}"
|
|
825
|
+
data-shape-hit-area="true"
|
|
826
|
+
d="M${e.path ? e.path : ""}"
|
|
827
|
+
fill="none"
|
|
828
|
+
stroke="transparent"
|
|
829
|
+
stroke-width="${t}"
|
|
830
|
+
stroke-linecap="round"
|
|
831
|
+
stroke-linejoin="round"
|
|
832
|
+
pointer-events="stroke"
|
|
833
|
+
/>
|
|
834
|
+
<path
|
|
835
|
+
id="${e.id}"
|
|
836
|
+
data-shape-visible="true"
|
|
837
|
+
d="M${e.path ? e.path : ""}"
|
|
838
|
+
style="stroke:${e.color + e.alpha} !important; fill:none; stroke-width:${e.strokeWidth} !important; stroke-linecap: round !important; stroke-linejoin: round !important; ${e.isDash ? `stroke-dasharray: ${e.strokeWidth * 3}` : ""}"
|
|
839
|
+
pointer-events="stroke"
|
|
840
|
+
/>
|
|
841
|
+
${Cn(e)}
|
|
842
|
+
${Tn(e)}
|
|
843
|
+
</g>
|
|
844
|
+
`,
|
|
845
|
+
id: e.id
|
|
846
|
+
};
|
|
847
|
+
}
|
|
848
|
+
case e && e.type === "text": {
|
|
849
|
+
let t = Dn(e), n = [];
|
|
850
|
+
for (let r = 0; r < t.length; r += 1) n.push(`
|
|
851
|
+
${e.isBulletTextMode ? `<tspan
|
|
852
|
+
data-bullet-line="${r}"
|
|
853
|
+
x="${e.x - e.fontSize}"
|
|
854
|
+
y="${e.y + e.fontSize * r}"
|
|
855
|
+
id="${e.id}"
|
|
856
|
+
font-size="${e.fontSize / 2}"
|
|
857
|
+
>⬤</tspan>` : ""}
|
|
858
|
+
<tspan
|
|
859
|
+
data-text-line="${r}"
|
|
860
|
+
id="${e.id}"
|
|
861
|
+
x="${e.x}"
|
|
862
|
+
y="${e.y + e.fontSize * r}"
|
|
863
|
+
>${An(t[r])}</tspan>`);
|
|
864
|
+
return {
|
|
865
|
+
html: `
|
|
866
|
+
${wn(e)}
|
|
867
|
+
${jn(e, n, e.isBulletTextMode)}
|
|
868
|
+
`,
|
|
869
|
+
id: e.id
|
|
870
|
+
};
|
|
871
|
+
}
|
|
872
|
+
}
|
|
873
|
+
}));
|
|
874
|
+
function Z(e) {
|
|
875
|
+
if (e == null) return e;
|
|
876
|
+
try {
|
|
877
|
+
return typeof structuredClone == "function" ? structuredClone(e) : JSON.parse(JSON.stringify(e));
|
|
878
|
+
} catch {
|
|
879
|
+
return Array.isArray(e) ? e.map((e) => Z(e)) : typeof e == "object" ? Object.fromEntries(Object.entries(e).map(([e, t]) => [e, Z(t)])) : e;
|
|
880
|
+
}
|
|
881
|
+
}
|
|
882
|
+
function Nn(e = !1) {
|
|
883
|
+
if (!w.value || !Lt.value) return;
|
|
884
|
+
T.value.end = {
|
|
885
|
+
x: I.value.x,
|
|
886
|
+
y: I.value.y
|
|
887
|
+
};
|
|
888
|
+
let t;
|
|
889
|
+
L.value.length > 0 && E.value && (t = [...L.value].find((e) => e.id === E.value.id));
|
|
890
|
+
let n, r, i;
|
|
891
|
+
t && (n = t.x - T.value.end.x, r = t.y - T.value.end.y, i = Math.sqrt(n * n + r * r));
|
|
892
|
+
let a, o;
|
|
893
|
+
switch (e ? (a = Math.max(T.value.end.x, t.x), o = Math.min(T.value.end.x, t.x), Math.max(T.value.end.y, t.y), Math.min(T.value.end.y, t.y)) : (a = Math.max(T.value.end.x, T.value.start.x), o = Math.min(T.value.end.x, T.value.start.x), Math.max(T.value.end.y, T.value.start.y), Math.min(T.value.end.y, T.value.start.y)), !0) {
|
|
894
|
+
case w.value === "arrow":
|
|
895
|
+
L.value.at(-1).endX = T.value.end.x, L.value.at(-1).endY = T.value.end.y;
|
|
896
|
+
break;
|
|
897
|
+
case w.value === "circle":
|
|
898
|
+
L.value.at(-1).circleRadius = Rt.value ? Z(a - o) + 20 : i + 20;
|
|
899
|
+
break;
|
|
900
|
+
case w.value === "line":
|
|
901
|
+
L.value.at(-1).path += ` ${I.value.x} ${I.value.y} `;
|
|
902
|
+
break;
|
|
903
|
+
case ["rect", "group"].includes(w.value): L.value.at(-1).rectWidth = Z(T.value.end.x - L.value.at(-1).x) > 0 ? Z(T.value.end.x - L.value.at(-1).x) : 20, L.value.at(-1).rectHeight = Z(T.value.end.y - L.value.at(-1).y) > 0 ? Z(T.value.end.y - L.value.at(-1).y) : 20;
|
|
904
|
+
}
|
|
905
|
+
}
|
|
906
|
+
function Pn() {
|
|
907
|
+
if (!Lt.value) {
|
|
908
|
+
dn.value = null;
|
|
909
|
+
return;
|
|
910
|
+
}
|
|
911
|
+
Nn(), dn.value = requestAnimationFrame(Pn);
|
|
912
|
+
}
|
|
913
|
+
function Fn(e) {
|
|
914
|
+
let t = L.value.findIndex((t) => t.id === e);
|
|
915
|
+
if (t > -1 && t !== L.value.length - 1) {
|
|
916
|
+
let [e] = L.value.splice(t, 1);
|
|
917
|
+
L.value.push(e);
|
|
918
|
+
}
|
|
919
|
+
}
|
|
920
|
+
function In(e) {
|
|
921
|
+
let t = e;
|
|
922
|
+
for (; t && t !== vn.value;) {
|
|
923
|
+
let e = t.id;
|
|
924
|
+
if (e && L.value.some((t) => t.id === e)) return e;
|
|
925
|
+
t = t.parentElement;
|
|
926
|
+
}
|
|
927
|
+
return null;
|
|
928
|
+
}
|
|
929
|
+
function Ln(e) {
|
|
930
|
+
if (!M.value) return null;
|
|
931
|
+
let t = In(e?.target);
|
|
932
|
+
if (t) return t;
|
|
933
|
+
let n = vn.value?.querySelector(".annotator__glass");
|
|
934
|
+
if (!n) return null;
|
|
935
|
+
let r = e?.touches?.[0] || e?.changedTouches?.[0], i = r ? r.clientX : e?.clientX, a = r ? r.clientY : e?.clientY;
|
|
936
|
+
if (!Number.isFinite(i) || !Number.isFinite(a)) return null;
|
|
937
|
+
let o = n.style.pointerEvents;
|
|
938
|
+
n.style.pointerEvents = "none";
|
|
939
|
+
let s = document.elementFromPoint(i, a);
|
|
940
|
+
return n.style.pointerEvents = o || "all", In(s);
|
|
941
|
+
}
|
|
942
|
+
function Rn(e = {}) {
|
|
943
|
+
let { maxEntries: t = 200, maxBytes: n = 2e6 } = e, r = {
|
|
944
|
+
open: !1,
|
|
945
|
+
before: null,
|
|
946
|
+
undo: [],
|
|
947
|
+
redo: []
|
|
948
|
+
}, i = {
|
|
949
|
+
undo: 0,
|
|
950
|
+
redo: 0
|
|
951
|
+
}, a = (e) => typeof e == "string" ? e.length * 2 : 0, o = () => JSON.stringify({
|
|
952
|
+
shapes: Z(L.value),
|
|
953
|
+
lastSelectedShape: Z(F.value)
|
|
954
|
+
}), s = (e) => {
|
|
955
|
+
let t = JSON.parse(e);
|
|
956
|
+
L.value = t.shapes, F.value = t.lastSelectedShape?.id ? L.value.find((e) => e.id === t.lastSelectedShape.id) : void 0, E.value = F.value ? { id: F.value.id } : void 0, nn.value = null, rn.value = null, an.value = !1, P.value = !1, z.value = !1, U.value = null;
|
|
957
|
+
}, c = () => {
|
|
958
|
+
un.value.undo = r.undo.length, un.value.redo = r.redo.length;
|
|
959
|
+
}, l = (e, o) => {
|
|
960
|
+
let s = r[e];
|
|
961
|
+
for (s.push(o), i[e] += a(o); s.length > t || i[e] > n;) {
|
|
962
|
+
let t = s.shift();
|
|
963
|
+
i[e] -= a(t);
|
|
964
|
+
}
|
|
965
|
+
};
|
|
966
|
+
return {
|
|
967
|
+
begin() {
|
|
968
|
+
r.open || (r.open = !0, r.before = o());
|
|
969
|
+
},
|
|
970
|
+
end() {
|
|
971
|
+
r.open && (r.open = !1, o() !== r.before && (l("undo", r.before), r.redo.length = 0, i.redo = 0), r.before = null, c());
|
|
972
|
+
},
|
|
973
|
+
undo() {
|
|
974
|
+
let e = r.undo.pop();
|
|
975
|
+
if (!e) return;
|
|
976
|
+
i.undo -= a(e);
|
|
977
|
+
let t = o();
|
|
978
|
+
l("redo", t), s(e), c();
|
|
979
|
+
},
|
|
980
|
+
redo() {
|
|
981
|
+
let e = r.redo.pop();
|
|
982
|
+
if (!e) return;
|
|
983
|
+
i.redo -= a(e);
|
|
984
|
+
let t = o();
|
|
985
|
+
l("undo", t), s(e), c();
|
|
986
|
+
},
|
|
987
|
+
size() {
|
|
988
|
+
return {
|
|
989
|
+
undo: r.undo.length,
|
|
990
|
+
redo: r.redo.length,
|
|
991
|
+
approxBytes: {
|
|
992
|
+
undo: i.undo,
|
|
993
|
+
redo: i.redo
|
|
994
|
+
}
|
|
995
|
+
};
|
|
996
|
+
}
|
|
997
|
+
};
|
|
998
|
+
}
|
|
999
|
+
function zn() {
|
|
1000
|
+
if (!sn.value) return;
|
|
1001
|
+
let e = sn.value.getBoundingClientRect();
|
|
1002
|
+
K.value = {
|
|
1003
|
+
x: e.left + e.width / 2,
|
|
1004
|
+
y: e.top
|
|
1005
|
+
};
|
|
1006
|
+
}
|
|
1007
|
+
function Q(e, t, n = "top") {
|
|
1008
|
+
G.value = e, sn.value = t.currentTarget || t.target, zn(), W.value = !0, window.addEventListener("scroll", zn, !0), window.addEventListener("resize", zn, { passive: !0 });
|
|
1009
|
+
}
|
|
1010
|
+
function $() {
|
|
1011
|
+
W.value = !1, G.value = null, sn.value = null, window.removeEventListener("scroll", zn, !0), window.removeEventListener("resize", zn);
|
|
1012
|
+
}
|
|
1013
|
+
function Bn(e) {
|
|
1014
|
+
let t = In(e?.target) || E.value?.id || Nt.value, n = L.value.find((e) => e.id === t);
|
|
1015
|
+
if (!n) {
|
|
1016
|
+
V.value = null;
|
|
1017
|
+
return;
|
|
1018
|
+
}
|
|
1019
|
+
F.value = n, E.value = { id: n.id };
|
|
1020
|
+
let r = I.value.x, i = I.value.y;
|
|
1021
|
+
switch (n.type) {
|
|
1022
|
+
case "rect":
|
|
1023
|
+
case "circle":
|
|
1024
|
+
case "text":
|
|
1025
|
+
V.value = {
|
|
1026
|
+
dx: r - n.x,
|
|
1027
|
+
dy: i - n.y
|
|
1028
|
+
};
|
|
1029
|
+
break;
|
|
1030
|
+
case "arrow":
|
|
1031
|
+
V.value = {
|
|
1032
|
+
dx: r - n.x,
|
|
1033
|
+
dy: i - n.y,
|
|
1034
|
+
endDx: r - n.endX,
|
|
1035
|
+
endDy: i - n.endY
|
|
1036
|
+
};
|
|
1037
|
+
break;
|
|
1038
|
+
case "line":
|
|
1039
|
+
V.value = {
|
|
1040
|
+
startX: r,
|
|
1041
|
+
startY: i,
|
|
1042
|
+
path: n.path
|
|
1043
|
+
};
|
|
1044
|
+
break;
|
|
1045
|
+
case "group":
|
|
1046
|
+
V.value = {
|
|
1047
|
+
dx: r - (n.x || 0),
|
|
1048
|
+
dy: i - (n.y || 0)
|
|
1049
|
+
};
|
|
1050
|
+
break;
|
|
1051
|
+
default: V.value = {
|
|
1052
|
+
dx: 0,
|
|
1053
|
+
dy: 0
|
|
1054
|
+
};
|
|
1055
|
+
}
|
|
1056
|
+
}
|
|
1057
|
+
function Vn(e, t) {
|
|
1058
|
+
if (tn.value = t || null, H.value = null, e) {
|
|
1059
|
+
if (e.type === "line" && t === "line-scale") {
|
|
1060
|
+
let t = bn(e.path), n = Sn(e.path);
|
|
1061
|
+
if (!t.length || !n) return;
|
|
1062
|
+
H.value = {
|
|
1063
|
+
shapeId: e.id,
|
|
1064
|
+
points: t,
|
|
1065
|
+
bounds: n
|
|
1066
|
+
};
|
|
1067
|
+
return;
|
|
1068
|
+
}
|
|
1069
|
+
if (e.type === "rect" && t?.startsWith("rect-")) {
|
|
1070
|
+
let t = Number(e.x) || 0, n = Number(e.y) || 0, r = t + Math.max(0, Number(e.rectWidth) || 0), i = n + Math.max(0, Number(e.rectHeight) || 0);
|
|
1071
|
+
H.value = {
|
|
1072
|
+
shapeId: e.id,
|
|
1073
|
+
bounds: {
|
|
1074
|
+
left: t,
|
|
1075
|
+
top: n,
|
|
1076
|
+
right: r,
|
|
1077
|
+
bottom: i
|
|
1078
|
+
}
|
|
1079
|
+
};
|
|
1080
|
+
return;
|
|
1081
|
+
}
|
|
1082
|
+
if (e.type === "circle" && t === "circle-radius") {
|
|
1083
|
+
let t = Math.max(1, Number(e.circleRadius) || 1);
|
|
1084
|
+
H.value = {
|
|
1085
|
+
shapeId: e.id,
|
|
1086
|
+
anchor: {
|
|
1087
|
+
x: (Number(e.x) || 0) - t,
|
|
1088
|
+
y: Number(e.y) || 0
|
|
1089
|
+
},
|
|
1090
|
+
handlePoint: {
|
|
1091
|
+
x: (Number(e.x) || 0) + t,
|
|
1092
|
+
y: Number(e.y) || 0
|
|
1093
|
+
}
|
|
1094
|
+
};
|
|
1095
|
+
}
|
|
1096
|
+
}
|
|
1097
|
+
}
|
|
1098
|
+
function Hn(e) {
|
|
1099
|
+
let t = L.value.find((e) => e.id === F.value.id);
|
|
1100
|
+
switch (!0) {
|
|
1101
|
+
case e === "front":
|
|
1102
|
+
L.value = L.value.filter((e) => e.id !== t.id), L.value.push(t);
|
|
1103
|
+
break;
|
|
1104
|
+
case e === "back":
|
|
1105
|
+
L.value = L.value.filter((e) => e.id !== t.id), L.value = [t, ...L.value];
|
|
1106
|
+
break;
|
|
1107
|
+
default: return;
|
|
1108
|
+
}
|
|
1109
|
+
}
|
|
1110
|
+
function Un() {
|
|
1111
|
+
if (!F.value?.id) return;
|
|
1112
|
+
let e = {
|
|
1113
|
+
...F.value,
|
|
1114
|
+
id: `${F.value.id}_copy_${i()}`,
|
|
1115
|
+
x: F.value.x - 100 < 0 ? 1 : F.value.x - 100,
|
|
1116
|
+
y: F.value.y - 100 < 0 ? 1 : F.value.y - 100
|
|
1117
|
+
};
|
|
1118
|
+
L.value.push(e);
|
|
1119
|
+
}
|
|
1120
|
+
function Wn(e) {
|
|
1121
|
+
e && (e.color && (pn.value = e.color), Number.isFinite(Number(e.strokeWidth)) && (Mt.value = Number(e.strokeWidth)), "isDash" in e && (It.value = !!e.isDash), e.type === "circle" ? (R.value.circle.filled = !!e.isFilled, w.value = "circle") : e.type === "rect" ? (R.value.rect.filled = !!e.isFilled, w.value = "rect") : e.type === "arrow" ? w.value = "arrow" : e.type === "line" ? w.value = "line" : e.type === "text" && (B.value = e.textAlign || "start", Qt.value = Number(e.fontSize) || Qt.value, Pt.value = !!e.isBold, zt.value = !!e.isItalic, Ht.value = !!e.isUnderline, Ft.value = !!e.isBulletTextMode));
|
|
1122
|
+
}
|
|
1123
|
+
function Gn(e) {
|
|
1124
|
+
if (!M.value) {
|
|
1125
|
+
Nt.value = void 0;
|
|
1126
|
+
return;
|
|
1127
|
+
}
|
|
1128
|
+
e.preventDefault(), Ut.value = !1, Nt.value = In(e.target) || void 0;
|
|
1129
|
+
}
|
|
1130
|
+
function Kn() {
|
|
1131
|
+
let e = nn.value;
|
|
1132
|
+
if (!e || !vn.value || !P.value) {
|
|
1133
|
+
U.value = null;
|
|
1134
|
+
return;
|
|
1135
|
+
}
|
|
1136
|
+
ce(() => {
|
|
1137
|
+
if (!vn.value || !P.value || nn.value !== e) {
|
|
1138
|
+
U.value = null;
|
|
1139
|
+
return;
|
|
1140
|
+
}
|
|
1141
|
+
let t = L.value.find((t) => t.id === e);
|
|
1142
|
+
if (!t || t.type !== "text") {
|
|
1143
|
+
U.value = null;
|
|
1144
|
+
return;
|
|
1145
|
+
}
|
|
1146
|
+
let n = Array.from(vn.value.getElementsByTagName("text")).find((t) => t.getAttribute("data-shape-id") === e);
|
|
1147
|
+
if (!n) {
|
|
1148
|
+
U.value = null;
|
|
1149
|
+
return;
|
|
1150
|
+
}
|
|
1151
|
+
let r = Dn(t), i = Math.max(0, Math.min(on.value.row, r.length - 1)), a = r[i] || "", o = Math.max(0, Math.min(on.value.col, a.length)), s = a.slice(0, o), c = document.createElementNS("http://www.w3.org/2000/svg", "text");
|
|
1152
|
+
c.setAttribute("font-size", String(t.fontSize)), c.setAttribute("font-family", n.getAttribute("font-family") || "Helvetica"), c.setAttribute("font-weight", t.isBold ? "bold" : "normal"), c.setAttribute("font-style", t.isItalic ? "italic" : "normal"), c.setAttribute("visibility", "hidden"), c.setAttribute("pointer-events", "none"), vn.value.appendChild(c);
|
|
1153
|
+
let l = (e) => (c.textContent = e || "", typeof c.getComputedTextLength == "function" ? c.getComputedTextLength() : c.getBBox().width), ee = l(s), u = l(a);
|
|
1154
|
+
c.remove();
|
|
1155
|
+
let te = t.x;
|
|
1156
|
+
t.textAlign === "middle" ? te -= u / 2 : t.textAlign === "end" && (te -= u);
|
|
1157
|
+
let ne = t.y + t.fontSize * i;
|
|
1158
|
+
U.value = {
|
|
1159
|
+
x: te + ee,
|
|
1160
|
+
y1: ne - t.fontSize * .85,
|
|
1161
|
+
y2: ne + t.fontSize * .15,
|
|
1162
|
+
color: t.color || J.value.style.color
|
|
1163
|
+
};
|
|
1164
|
+
});
|
|
1165
|
+
}
|
|
1166
|
+
function qn(e, { isNew: t = !1 } = {}) {
|
|
1167
|
+
if (!e || e.type !== "text") return;
|
|
1168
|
+
if (P.value && nn.value === e.id) {
|
|
1169
|
+
let t = Dn(e), n = Math.max(0, t.length - 1);
|
|
1170
|
+
on.value = {
|
|
1171
|
+
row: n,
|
|
1172
|
+
col: (t[n] || "").length
|
|
1173
|
+
}, z.value = !0, Kn();
|
|
1174
|
+
return;
|
|
1175
|
+
}
|
|
1176
|
+
P.value && Jn(), t || q.value?.begin?.(), F.value = e, E.value = { id: e.id }, nn.value = e.id, rn.value = t ? null : Z(e), an.value = t;
|
|
1177
|
+
let n = Dn(e), r = Math.max(0, n.length - 1);
|
|
1178
|
+
on.value = {
|
|
1179
|
+
row: r,
|
|
1180
|
+
col: (n[r] || "").length
|
|
1181
|
+
}, Wn(e), N.value = !0, P.value = !0, z.value = !0, O.value = !1, w.value = void 0, U.value = null, Kn();
|
|
1182
|
+
}
|
|
1183
|
+
function Jn({ cancel: e = !1 } = {}) {
|
|
1184
|
+
let t = nn.value;
|
|
1185
|
+
if (!t) {
|
|
1186
|
+
P.value = !1, z.value = !1, U.value = null;
|
|
1187
|
+
return;
|
|
1188
|
+
}
|
|
1189
|
+
let n = L.value.find((e) => e.id === t);
|
|
1190
|
+
if (e) {
|
|
1191
|
+
if (an.value) L.value = L.value.filter((e) => e.id !== t), n = null;
|
|
1192
|
+
else if (rn.value) {
|
|
1193
|
+
let e = L.value.findIndex((e) => e.id === t);
|
|
1194
|
+
e !== -1 && (L.value[e] = Z(rn.value), n = L.value[e]);
|
|
1195
|
+
}
|
|
1196
|
+
} else n && Dn(n).every((e) => e.length === 0) && (L.value = L.value.filter((e) => e.id !== t), n = null);
|
|
1197
|
+
nn.value = null, rn.value = null, an.value = !1, on.value = {
|
|
1198
|
+
row: 0,
|
|
1199
|
+
col: 0
|
|
1200
|
+
}, P.value = !1, z.value = !1, U.value = null, q.value?.end?.(), n ? (F.value = n, E.value = { id: n.id }) : F.value?.id === t && (F.value = void 0, E.value = void 0);
|
|
1201
|
+
}
|
|
1202
|
+
function Yn() {
|
|
1203
|
+
if (P.value) {
|
|
1204
|
+
Jn();
|
|
1205
|
+
return;
|
|
1206
|
+
}
|
|
1207
|
+
let e = F.value;
|
|
1208
|
+
!e || e.type !== "text" || Dn(e).every((e) => e.length === 0) && (L.value = L.value.filter((t) => t.id !== e.id), F.value = L.value.at(-1));
|
|
1209
|
+
}
|
|
1210
|
+
function Xn() {
|
|
1211
|
+
q.value?.begin?.();
|
|
1212
|
+
let e = {
|
|
1213
|
+
id: `text_${i()}`,
|
|
1214
|
+
type: "text",
|
|
1215
|
+
lines: 0,
|
|
1216
|
+
x: I.value.x,
|
|
1217
|
+
y: I.value.y,
|
|
1218
|
+
textContent: "",
|
|
1219
|
+
fontSize: Z(Qt.value),
|
|
1220
|
+
textAlign: Z(B.value),
|
|
1221
|
+
isBold: Z(Pt.value),
|
|
1222
|
+
isItalic: Z(zt.value),
|
|
1223
|
+
isUnderline: Z(Ht.value),
|
|
1224
|
+
color: Z(pn.value),
|
|
1225
|
+
isBulletTextMode: Z(Ft.value)
|
|
1226
|
+
};
|
|
1227
|
+
L.value.push(e), F.value = e, E.value = { id: e.id }, qn(e, { isNew: !0 });
|
|
1228
|
+
}
|
|
1229
|
+
let Zn = 0;
|
|
1230
|
+
function Qn(e) {
|
|
1231
|
+
if (!(!M.value || D.value) && (e.preventDefault(), e.stopPropagation(), Nr(e), !In(e.target) && !(Date.now() < Zn))) {
|
|
1232
|
+
if (P.value && Jn(), N.value && !A.value) {
|
|
1233
|
+
Xn();
|
|
1234
|
+
return;
|
|
1235
|
+
}
|
|
1236
|
+
!O.value && !j.value && (F.value = void 0, E.value = void 0, Nt.value = void 0, k.value || (w.value = void 0)), z.value = !1, U.value = null;
|
|
1237
|
+
}
|
|
1238
|
+
}
|
|
1239
|
+
function $n(e) {
|
|
1240
|
+
!F.value || F.value.type !== "text" || (F.value.textAlign = e, B.value = e, Kn());
|
|
1241
|
+
}
|
|
1242
|
+
function er() {
|
|
1243
|
+
P.value && Jn(), q.value?.undo?.();
|
|
1244
|
+
}
|
|
1245
|
+
function tr() {
|
|
1246
|
+
P.value && Jn(), q.value?.redo?.();
|
|
1247
|
+
}
|
|
1248
|
+
function nr(e) {
|
|
1249
|
+
if (!P.value || !nn.value) return;
|
|
1250
|
+
let t = L.value.find((e) => e.id === nn.value);
|
|
1251
|
+
if (!t || t.type !== "text") {
|
|
1252
|
+
Jn();
|
|
1253
|
+
return;
|
|
1254
|
+
}
|
|
1255
|
+
let n = Dn(t);
|
|
1256
|
+
n.length || (n = [""]);
|
|
1257
|
+
let r = Math.max(0, Math.min(on.value.row, n.length - 1)), i = Math.max(0, Math.min(on.value.col, n[r].length)), a = !1, o = !1;
|
|
1258
|
+
if (e.key === "Escape") {
|
|
1259
|
+
e.preventDefault(), Jn({ cancel: !0 });
|
|
1260
|
+
return;
|
|
1261
|
+
}
|
|
1262
|
+
if (e.key === "Enter") {
|
|
1263
|
+
e.preventDefault();
|
|
1264
|
+
let t = n[r];
|
|
1265
|
+
n.splice(r, 1, t.slice(0, i), t.slice(i)), r += 1, i = 0, a = !0;
|
|
1266
|
+
} else if (e.key === "Backspace") {
|
|
1267
|
+
if (e.preventDefault(), i > 0) n[r] = n[r].slice(0, i - 1) + n[r].slice(i), --i, a = !0;
|
|
1268
|
+
else if (r > 0) {
|
|
1269
|
+
let e = n[r - 1].length;
|
|
1270
|
+
n[r - 1] += n[r], n.splice(r, 1), --r, i = e, a = !0;
|
|
1271
|
+
}
|
|
1272
|
+
} else if (e.key === "Delete") e.preventDefault(), i < n[r].length ? (n[r] = n[r].slice(0, i) + n[r].slice(i + 1), a = !0) : r < n.length - 1 && (n[r] += n[r + 1], n.splice(r + 1, 1), a = !0);
|
|
1273
|
+
else if (e.key === "ArrowLeft") e.preventDefault(), i > 0 ? --i : r > 0 && (--r, i = n[r].length), o = !0;
|
|
1274
|
+
else if (e.key === "ArrowRight") e.preventDefault(), i < n[r].length ? i += 1 : r < n.length - 1 && (r += 1, i = 0), o = !0;
|
|
1275
|
+
else if (e.key === "ArrowUp") e.preventDefault(), r > 0 && (--r, i = Math.min(i, n[r].length)), o = !0;
|
|
1276
|
+
else if (e.key === "ArrowDown") e.preventDefault(), r < n.length - 1 && (r += 1, i = Math.min(i, n[r].length)), o = !0;
|
|
1277
|
+
else if (e.key === "Home") e.preventDefault(), i = 0, o = !0;
|
|
1278
|
+
else if (e.key === "End") e.preventDefault(), i = n[r].length, o = !0;
|
|
1279
|
+
else if (e.key === "Tab") e.preventDefault(), n[r] = n[r].slice(0, i) + " " + n[r].slice(i), i += 4, a = !0;
|
|
1280
|
+
else if (e.key.length === 1 && !e.ctrlKey && !e.metaKey && !e.altKey) e.preventDefault(), n[r] = n[r].slice(0, i) + e.key + n[r].slice(i), i += e.key.length, a = !0;
|
|
1281
|
+
else return;
|
|
1282
|
+
a && (t.isBold = Z(Pt.value), t.isItalic = Z(zt.value), t.isUnderline = Z(Ht.value), On(t, n)), (a || o) && (on.value = {
|
|
1283
|
+
row: r,
|
|
1284
|
+
col: i
|
|
1285
|
+
}, z.value = !0, Kn());
|
|
1286
|
+
}
|
|
1287
|
+
function rr(e) {
|
|
1288
|
+
if (!e) return null;
|
|
1289
|
+
switch (e.type) {
|
|
1290
|
+
case "arrow": return {
|
|
1291
|
+
left: Math.min(e.x, e.endX),
|
|
1292
|
+
top: Math.min(e.y, e.endY),
|
|
1293
|
+
right: Math.max(e.x, e.endX),
|
|
1294
|
+
bottom: Math.max(e.y, e.endY)
|
|
1295
|
+
};
|
|
1296
|
+
case "circle": {
|
|
1297
|
+
let t = Math.max(0, Number(e.circleRadius) || 0);
|
|
1298
|
+
return {
|
|
1299
|
+
left: e.x - t,
|
|
1300
|
+
top: e.y - t,
|
|
1301
|
+
right: e.x + t,
|
|
1302
|
+
bottom: e.y + t
|
|
1303
|
+
};
|
|
1304
|
+
}
|
|
1305
|
+
case "rect":
|
|
1306
|
+
case "group": return {
|
|
1307
|
+
left: e.x,
|
|
1308
|
+
top: e.y,
|
|
1309
|
+
right: e.x + e.rectWidth,
|
|
1310
|
+
bottom: e.y + e.rectHeight
|
|
1311
|
+
};
|
|
1312
|
+
case "line": {
|
|
1313
|
+
let t = Sn(e.path);
|
|
1314
|
+
return t ? {
|
|
1315
|
+
left: t.minX,
|
|
1316
|
+
top: t.minY,
|
|
1317
|
+
right: t.maxX,
|
|
1318
|
+
bottom: t.maxY
|
|
1319
|
+
} : null;
|
|
1320
|
+
}
|
|
1321
|
+
case "text": return {
|
|
1322
|
+
left: e.x,
|
|
1323
|
+
top: e.y,
|
|
1324
|
+
right: e.x,
|
|
1325
|
+
bottom: e.y
|
|
1326
|
+
};
|
|
1327
|
+
default: return null;
|
|
1328
|
+
}
|
|
1329
|
+
}
|
|
1330
|
+
function ir(e, t) {
|
|
1331
|
+
let n = rr(e);
|
|
1332
|
+
if (!n) return !1;
|
|
1333
|
+
let r = Math.min(t.x, t.x + t.rectWidth), i = Math.min(t.y, t.y + t.rectHeight), a = Math.max(t.x, t.x + t.rectWidth), o = Math.max(t.y, t.y + t.rectHeight);
|
|
1334
|
+
return r <= n.left && i <= n.top && a >= n.right && o >= n.bottom;
|
|
1335
|
+
}
|
|
1336
|
+
function ar(e, t) {
|
|
1337
|
+
let n = Z(e), r = Number(t.x) || 0, i = Number(t.y) || 0;
|
|
1338
|
+
switch (n.type) {
|
|
1339
|
+
case "circle":
|
|
1340
|
+
case "rect":
|
|
1341
|
+
case "text":
|
|
1342
|
+
n.x = r + (Number(n.diffX) || 0), n.y = i + (Number(n.diffY) || 0);
|
|
1343
|
+
break;
|
|
1344
|
+
case "arrow":
|
|
1345
|
+
n.x = r + (Number(n.diffX) || 0), n.y = i + (Number(n.diffY) || 0), n.endX = r + (Number(n.diffEndX) || 0), n.endY = i + (Number(n.diffEndY) || 0);
|
|
1346
|
+
break;
|
|
1347
|
+
case "line": Array.isArray(n.diffPoints) && n.diffPoints.length && (n.path = xn(n.diffPoints.map((e) => ({
|
|
1348
|
+
x: r + e.x,
|
|
1349
|
+
y: i + e.y
|
|
1350
|
+
}))));
|
|
1351
|
+
}
|
|
1352
|
+
return n.id = n.oldId || n.id, delete n.diffX, delete n.diffY, delete n.diffEndX, delete n.diffEndY, delete n.diffPoints, n;
|
|
1353
|
+
}
|
|
1354
|
+
function or(e) {
|
|
1355
|
+
return e.type === "group" ? (e.source || []).flatMap((t) => t.type === "group" ? or(ar(t, e)) : [ar(t, e)]) : [Z(e)];
|
|
1356
|
+
}
|
|
1357
|
+
function sr(e, t) {
|
|
1358
|
+
let n = {
|
|
1359
|
+
...Z(e),
|
|
1360
|
+
id: t.id,
|
|
1361
|
+
oldId: e.oldId || e.id,
|
|
1362
|
+
diffX: (Number(e.x) || 0) - t.x,
|
|
1363
|
+
diffY: (Number(e.y) || 0) - t.y,
|
|
1364
|
+
diffEndX: Number.isFinite(Number(e.endX)) ? Number(e.endX) - t.x : 0,
|
|
1365
|
+
diffEndY: Number.isFinite(Number(e.endY)) ? Number(e.endY) - t.y : 0
|
|
1366
|
+
};
|
|
1367
|
+
return e.type === "line" && (n.diffPoints = bn(e.path).map((e) => ({
|
|
1368
|
+
x: e.x - t.x,
|
|
1369
|
+
y: e.y - t.y
|
|
1370
|
+
}))), n;
|
|
1371
|
+
}
|
|
1372
|
+
function cr() {
|
|
1373
|
+
if (Wt.value = [], w.value !== "group") return j.value = !1, L.value = L.value.filter((e) => e.type !== "group"), null;
|
|
1374
|
+
let e = L.value.at(-1);
|
|
1375
|
+
if (!e || e.type !== "group") return null;
|
|
1376
|
+
let t = L.value.filter((t) => t.id !== e.id && ir(t, e));
|
|
1377
|
+
if (t.length < 2) return L.value = L.value.filter((t) => t.id !== e.id), null;
|
|
1378
|
+
let n = t.flatMap((e) => or(e));
|
|
1379
|
+
Wt.value = n.map((t) => sr(t, e)), e.source = Wt.value, e.content = "";
|
|
1380
|
+
let r = new Set(t.map((e) => e.id));
|
|
1381
|
+
return L.value = L.value.filter((t) => t.id === e.id || !r.has(t.id)), lr(e), e;
|
|
1382
|
+
}
|
|
1383
|
+
function lr(e) {
|
|
1384
|
+
e.content = "";
|
|
1385
|
+
let t = e.x || 0, n = e.y || 0;
|
|
1386
|
+
(e.source || []).forEach((r) => {
|
|
1387
|
+
switch (r.type) {
|
|
1388
|
+
case "circle": {
|
|
1389
|
+
let i = t + r.diffX, a = n + r.diffY;
|
|
1390
|
+
e.content += `
|
|
1391
|
+
<circle
|
|
1392
|
+
id="${r.id}"
|
|
1393
|
+
cx="${i}"
|
|
1394
|
+
cy="${a}"
|
|
1395
|
+
r="${r.circleRadius ? r.circleRadius : Number.MIN_VALUE}"
|
|
1396
|
+
fill="${r.isFilled ? r.color + r.alpha : "rgba(255,255,255,0.001)"}"
|
|
1397
|
+
stroke="${r.color + r.alpha}"
|
|
1398
|
+
stroke-width="${r.strokeWidth}"
|
|
1399
|
+
style="${r.isDash ? `stroke-dasharray: ${r.strokeWidth * 3}` : ""}"
|
|
1400
|
+
/>
|
|
1401
|
+
`;
|
|
1402
|
+
break;
|
|
1403
|
+
}
|
|
1404
|
+
case "rect": {
|
|
1405
|
+
let i = t + r.diffX, a = n + r.diffY;
|
|
1406
|
+
e.content += `
|
|
1407
|
+
<rect
|
|
1408
|
+
id="${A.value ? "" : r.id}"
|
|
1409
|
+
x="${i}"
|
|
1410
|
+
y="${a}"
|
|
1411
|
+
fill="${r.isFilled ? r.color + r.alpha : "rgba(255,255,255,0.001)"}"
|
|
1412
|
+
height="${r.rectHeight}"
|
|
1413
|
+
width="${r.rectWidth}"
|
|
1414
|
+
stroke="${r.color + r.alpha}"
|
|
1415
|
+
stroke-width="${r.strokeWidth}"
|
|
1416
|
+
style="rx:1 !important; ry:1 !important; ${r.isDash ? `stroke-dasharray: ${r.strokeWidth * 3}` : ""}"
|
|
1417
|
+
/>
|
|
1418
|
+
`;
|
|
1419
|
+
break;
|
|
1420
|
+
}
|
|
1421
|
+
case "arrow": {
|
|
1422
|
+
let a = t + r.diffX, o = n + r.diffY, s = t + r.diffEndX, c = n + r.diffEndY, l = r.strokeWidth > 3 ? 5 : 10, ee = r.strokeWidth > 3 ? 2.5 : 5, u = `m_${r.id}_${i()}`;
|
|
1423
|
+
e.content += `
|
|
1424
|
+
<g id="${r.id}">
|
|
1425
|
+
<defs>
|
|
1426
|
+
<marker
|
|
1427
|
+
id="${u}"
|
|
1428
|
+
markerWidth="${l}"
|
|
1429
|
+
markerHeight="${l}"
|
|
1430
|
+
refX="0"
|
|
1431
|
+
refY="${ee}"
|
|
1432
|
+
orient="auto">
|
|
1433
|
+
<polygon points="0 0,${l} ${ee}, 0 ${l}" fill="${r.color}" />
|
|
1434
|
+
</marker>
|
|
1435
|
+
</defs>
|
|
1436
|
+
<path
|
|
1437
|
+
style="stroke-linecap: round !important; ${r.isDash ? `stroke-dasharray: ${r.strokeWidth * 3}` : ""}"
|
|
1438
|
+
stroke="${r.color}"
|
|
1439
|
+
id="${r.id}"
|
|
1440
|
+
d="M${a},${o} ${s},${c}"
|
|
1441
|
+
stroke-width="${r.strokeWidth}"
|
|
1442
|
+
marker-end="url(#${u})"
|
|
1443
|
+
/>
|
|
1444
|
+
</g>
|
|
1445
|
+
`;
|
|
1446
|
+
break;
|
|
1447
|
+
}
|
|
1448
|
+
case "line": {
|
|
1449
|
+
let i = xn(Array.isArray(r.diffPoints) && r.diffPoints.length ? r.diffPoints.map((e) => ({
|
|
1450
|
+
x: t + e.x,
|
|
1451
|
+
y: n + e.y
|
|
1452
|
+
})) : bn(r.path));
|
|
1453
|
+
e.content += `
|
|
1454
|
+
<path
|
|
1455
|
+
id="${r.id}"
|
|
1456
|
+
d="M${i}"
|
|
1457
|
+
style="stroke:${r.color + r.alpha} !important; fill:none; stroke-width:${r.strokeWidth} !important; stroke-linecap:round !important; stroke-linejoin:round !important; ${r.isDash ? `stroke-dasharray: ${r.strokeWidth * 3}` : ""}"
|
|
1458
|
+
/>
|
|
1459
|
+
`;
|
|
1460
|
+
break;
|
|
1461
|
+
}
|
|
1462
|
+
case "text": {
|
|
1463
|
+
let i = (r.textContent || "").split("").map((e, i) => `
|
|
1464
|
+
${r.isBulletTextMode ? `<tspan x="${t + r.diffX - r.fontSize}" y="${n + r.diffY + r.fontSize * i}" id="${r.id}" font-size="${r.fontSize / 2}">⬤</tspan>` : ""}
|
|
1465
|
+
<tspan id="${r.id}" x="${t + r.diffX}" y="${n + r.diffY + r.fontSize * i}">
|
|
1466
|
+
${e}
|
|
1467
|
+
</tspan>
|
|
1468
|
+
`).join("");
|
|
1469
|
+
e.content += `
|
|
1470
|
+
<g id="${r.id}">
|
|
1471
|
+
<text
|
|
1472
|
+
style="user-select:none; height:100px;"
|
|
1473
|
+
id="${r.id}"
|
|
1474
|
+
x="${t + r.diffX}"
|
|
1475
|
+
y="${n + r.diffY}"
|
|
1476
|
+
text-anchor="${r.textAlign}"
|
|
1477
|
+
font-size="${r.fontSize}"
|
|
1478
|
+
fill="${r.color}"
|
|
1479
|
+
font-weight="${r.isBold ? "bold" : "normal"}"
|
|
1480
|
+
font-style="${r.isItalic ? "italic" : "normal"}"
|
|
1481
|
+
text-decoration="${r.isUnderline ? "underline" : "none"}">
|
|
1482
|
+
${i}
|
|
1483
|
+
</text>
|
|
1484
|
+
</g>
|
|
1485
|
+
`;
|
|
1486
|
+
break;
|
|
1487
|
+
}
|
|
1488
|
+
}
|
|
1489
|
+
});
|
|
1490
|
+
}
|
|
1491
|
+
function ur(e) {
|
|
1492
|
+
e.relatedTarget && vn.value && vn.value.contains(e.relatedTarget) || (Ut.value = !0, Nt.value = void 0);
|
|
1493
|
+
}
|
|
1494
|
+
function dr() {
|
|
1495
|
+
if (Lt.value = !0, !w.value && !j.value || !Lt.value) return;
|
|
1496
|
+
Rt.value = !0, T.value.start = {
|
|
1497
|
+
x: I.value.x,
|
|
1498
|
+
y: I.value.y
|
|
1499
|
+
};
|
|
1500
|
+
let e = `${j.value ? "group" : w.value}_${i()}`;
|
|
1501
|
+
switch (!0) {
|
|
1502
|
+
case w.value === "arrow":
|
|
1503
|
+
L.value.push({
|
|
1504
|
+
id: e,
|
|
1505
|
+
x: I.value.x,
|
|
1506
|
+
y: I.value.y,
|
|
1507
|
+
endX: I.value.x,
|
|
1508
|
+
endY: I.value.y,
|
|
1509
|
+
type: w.value,
|
|
1510
|
+
color: Z(pn.value),
|
|
1511
|
+
strokeWidth: Z(Math.abs(Mt.value)),
|
|
1512
|
+
isDash: Z(It.value)
|
|
1513
|
+
}), F.value = L.value.at(-1);
|
|
1514
|
+
break;
|
|
1515
|
+
case w.value === "circle":
|
|
1516
|
+
L.value.push({
|
|
1517
|
+
alpha: R.value.circle.filled ? hn.value : "",
|
|
1518
|
+
id: e,
|
|
1519
|
+
color: Z(pn.value),
|
|
1520
|
+
isFilled: Z(R.value.circle.filled),
|
|
1521
|
+
circleRadius: Z(R.value.circle.radius),
|
|
1522
|
+
circleStrokeWidth: Z(R.value.circle.strokeWidth),
|
|
1523
|
+
type: w.value,
|
|
1524
|
+
x: I.value.x,
|
|
1525
|
+
y: I.value.y,
|
|
1526
|
+
strokeWidth: Z(Math.abs(Mt.value)),
|
|
1527
|
+
isDash: Z(It.value)
|
|
1528
|
+
}), F.value = L.value.at(-1);
|
|
1529
|
+
break;
|
|
1530
|
+
case w.value === "line":
|
|
1531
|
+
L.value.push({
|
|
1532
|
+
alpha: Z(hn.value),
|
|
1533
|
+
id: e,
|
|
1534
|
+
x: I.value.x,
|
|
1535
|
+
y: I.value.y,
|
|
1536
|
+
type: w.value,
|
|
1537
|
+
color: Z(pn.value),
|
|
1538
|
+
strokeWidth: Z(Math.abs(Mt.value)),
|
|
1539
|
+
isDash: Z(It.value),
|
|
1540
|
+
path: `${I.value.x} ${I.value.y}`
|
|
1541
|
+
}), F.value = L.value.at(-1);
|
|
1542
|
+
break;
|
|
1543
|
+
case w.value === "rect":
|
|
1544
|
+
L.value.push({
|
|
1545
|
+
alpha: R.value.rect.filled ? hn.value : "",
|
|
1546
|
+
id: e,
|
|
1547
|
+
color: Z(pn.value),
|
|
1548
|
+
isFilled: Z(R.value.rect.filled),
|
|
1549
|
+
rectStrokeWidth: Z(R.value.rect.strokeWidth),
|
|
1550
|
+
rectHeight: Z(R.value.rect.height),
|
|
1551
|
+
rectWidth: Z(R.value.rect.width),
|
|
1552
|
+
type: w.value,
|
|
1553
|
+
x: I.value.x,
|
|
1554
|
+
y: I.value.y,
|
|
1555
|
+
strokeWidth: Z(Math.abs(Mt.value)),
|
|
1556
|
+
isDash: Z(It.value)
|
|
1557
|
+
}), F.value = L.value.at(-1);
|
|
1558
|
+
break;
|
|
1559
|
+
case w.value === "group": L.value.push({
|
|
1560
|
+
alpha: 1,
|
|
1561
|
+
id: `group_${i()}`,
|
|
1562
|
+
x: I.value.x,
|
|
1563
|
+
y: I.value.y,
|
|
1564
|
+
isFilled: !1,
|
|
1565
|
+
rectHeight: Z(R.value.rect.height),
|
|
1566
|
+
rectWidth: Z(R.value.rect.width),
|
|
1567
|
+
rectStrokeWidth: 1,
|
|
1568
|
+
type: "group",
|
|
1569
|
+
color: "grey",
|
|
1570
|
+
strokeWidth: 1,
|
|
1571
|
+
isDash: !0,
|
|
1572
|
+
content: ""
|
|
1573
|
+
});
|
|
1574
|
+
}
|
|
1575
|
+
dn.value ||= requestAnimationFrame(Pn);
|
|
1576
|
+
}
|
|
1577
|
+
function fr(e) {
|
|
1578
|
+
if (!M.value) return;
|
|
1579
|
+
Nr(e);
|
|
1580
|
+
let t = Ln(e), n = t ? L.value.find((e) => e.id === t) : null;
|
|
1581
|
+
if (P.value && nn.value && t !== nn.value && Jn(), D.value) {
|
|
1582
|
+
Bt.value = !1;
|
|
1583
|
+
return;
|
|
1584
|
+
}
|
|
1585
|
+
if (n) {
|
|
1586
|
+
let t = Number.isFinite(e?.timeStamp) ? e.timeStamp : Date.now(), r = vr.id === n.id && t - vr.at >= 0 && t - vr.at <= Et;
|
|
1587
|
+
if (vr = r ? {
|
|
1588
|
+
id: null,
|
|
1589
|
+
at: 0
|
|
1590
|
+
} : {
|
|
1591
|
+
id: n.id,
|
|
1592
|
+
at: t
|
|
1593
|
+
}, r) {
|
|
1594
|
+
e.preventDefault(), e.stopPropagation(), Bt.value = !1, V.value = null, tn.value = null, H.value = null, _r(n);
|
|
1595
|
+
return;
|
|
1596
|
+
}
|
|
1597
|
+
} else vr = {
|
|
1598
|
+
id: null,
|
|
1599
|
+
at: 0
|
|
1600
|
+
};
|
|
1601
|
+
if (e.preventDefault(), e.stopPropagation(), Bt.value = !0, e.pointerId != null) {
|
|
1602
|
+
try {
|
|
1603
|
+
vn.value?.setPointerCapture?.(e.pointerId);
|
|
1604
|
+
} catch {}
|
|
1605
|
+
fn.value = e.pointerId;
|
|
1606
|
+
} else fn.value = null;
|
|
1607
|
+
if (O.value) {
|
|
1608
|
+
if (n) {
|
|
1609
|
+
Bt.value = !1, O.value = !1, F.value = n, E.value = { id: n.id }, Wn(n);
|
|
1610
|
+
return;
|
|
1611
|
+
}
|
|
1612
|
+
q.value?.begin?.(), dr();
|
|
1613
|
+
return;
|
|
1614
|
+
}
|
|
1615
|
+
if (j.value) {
|
|
1616
|
+
q.value?.begin?.(), dr();
|
|
1617
|
+
return;
|
|
1618
|
+
}
|
|
1619
|
+
if (k.value) {
|
|
1620
|
+
if (!n) {
|
|
1621
|
+
Bt.value = !1, E.value = void 0;
|
|
1622
|
+
return;
|
|
1623
|
+
}
|
|
1624
|
+
q.value?.begin?.(), Fn(n.id);
|
|
1625
|
+
let t = L.value.find((e) => e.id === n.id);
|
|
1626
|
+
F.value = t, E.value = { id: t.id }, Bn({ target: e.target });
|
|
1627
|
+
return;
|
|
1628
|
+
}
|
|
1629
|
+
if (A.value) {
|
|
1630
|
+
if (!n) {
|
|
1631
|
+
Bt.value = !1, E.value = void 0, V.value = null, tn.value = null, H.value = null;
|
|
1632
|
+
return;
|
|
1633
|
+
}
|
|
1634
|
+
let t = e.target?.getAttribute?.("data-resize-handle") || null;
|
|
1635
|
+
F.value = n, E.value = { id: n.id }, Wn(n), t ? (V.value = null, Vn(n, t)) : (tn.value = null, H.value = null, Bn(e)), q.value?.begin?.();
|
|
1636
|
+
}
|
|
1637
|
+
}
|
|
1638
|
+
function pr(e) {
|
|
1639
|
+
if (!e || !e.id || !V.value && (Bn({ target: { id: e.id } }), !V.value)) return;
|
|
1640
|
+
let t = I.value.x, n = I.value.y;
|
|
1641
|
+
switch (F.value = e, e.type) {
|
|
1642
|
+
case "arrow": {
|
|
1643
|
+
let { dx: r, dy: i, endDx: a, endDy: o } = V.value;
|
|
1644
|
+
e.x = t - r, e.y = n - i, e.endX = t - (a ?? r), e.endY = n - (o ?? i);
|
|
1645
|
+
break;
|
|
1646
|
+
}
|
|
1647
|
+
case "circle":
|
|
1648
|
+
case "rect":
|
|
1649
|
+
case "text": {
|
|
1650
|
+
let { dx: r, dy: i } = V.value;
|
|
1651
|
+
e.x = t - r, e.y = n - i;
|
|
1652
|
+
break;
|
|
1653
|
+
}
|
|
1654
|
+
case "line": {
|
|
1655
|
+
let { startX: r, startY: i, path: a } = V.value, o = t - r, s = n - i;
|
|
1656
|
+
e.path = xn(bn(a).map((e) => ({
|
|
1657
|
+
x: e.x + o,
|
|
1658
|
+
y: e.y + s
|
|
1659
|
+
})));
|
|
1660
|
+
let c = Sn(e.path);
|
|
1661
|
+
c && (e.x = c.minX, e.y = c.minY);
|
|
1662
|
+
break;
|
|
1663
|
+
}
|
|
1664
|
+
case "group": {
|
|
1665
|
+
let { dx: r, dy: i } = V.value;
|
|
1666
|
+
e.x = t - r, e.y = n - i, lr(e);
|
|
1667
|
+
break;
|
|
1668
|
+
}
|
|
1669
|
+
}
|
|
1670
|
+
}
|
|
1671
|
+
function mr() {
|
|
1672
|
+
let e = E.value?.id || Nt.value;
|
|
1673
|
+
if (!e) return;
|
|
1674
|
+
let t = L.value.find((t) => t.id === e);
|
|
1675
|
+
t && pr(t);
|
|
1676
|
+
}
|
|
1677
|
+
function hr() {
|
|
1678
|
+
let e = E.value?.id;
|
|
1679
|
+
if (!e) return;
|
|
1680
|
+
let t = L.value.find((t) => t.id === e);
|
|
1681
|
+
if (!t) return;
|
|
1682
|
+
let n = I.value.x, r = I.value.y;
|
|
1683
|
+
switch (w.value = t.type, F.value = t, t.type) {
|
|
1684
|
+
case "arrow":
|
|
1685
|
+
tn.value === "arrow-start" ? (t.x = n, t.y = r) : tn.value === "arrow-end" && (t.endX = n, t.endY = r);
|
|
1686
|
+
break;
|
|
1687
|
+
case "line": {
|
|
1688
|
+
if (tn.value !== "line-scale" || !H.value?.bounds || !H.value?.points) return;
|
|
1689
|
+
let { bounds: e, points: i } = H.value, a = Math.max(1, n - e.minX), o = Math.max(1, r - e.minY), s = a / Math.max(1, e.width), c = o / Math.max(1, e.height);
|
|
1690
|
+
t.path = xn(i.map((t) => ({
|
|
1691
|
+
x: e.minX + (t.x - e.minX) * s,
|
|
1692
|
+
y: e.minY + (t.y - e.minY) * c
|
|
1693
|
+
}))), t.x = e.minX, t.y = e.minY;
|
|
1694
|
+
break;
|
|
1695
|
+
}
|
|
1696
|
+
case "circle": {
|
|
1697
|
+
if (tn.value !== "circle-radius" || H.value?.shapeId !== t.id || !H.value?.anchor) return;
|
|
1698
|
+
let e = H.value.anchor, i = n, a = r, o = i - e.x, s = a - e.y, c = Math.hypot(o, s);
|
|
1699
|
+
if (c < 2) {
|
|
1700
|
+
if (c > 0) {
|
|
1701
|
+
let e = 2 / c;
|
|
1702
|
+
o *= e, s *= e;
|
|
1703
|
+
} else o = 2, s = 0;
|
|
1704
|
+
i = e.x + o, a = e.y + s, c = 2;
|
|
1705
|
+
}
|
|
1706
|
+
t.x = e.x + o / 2, t.y = e.y + s / 2, t.circleRadius = c / 2, H.value.handlePoint = {
|
|
1707
|
+
x: i,
|
|
1708
|
+
y: a
|
|
1709
|
+
};
|
|
1710
|
+
break;
|
|
1711
|
+
}
|
|
1712
|
+
case "rect": {
|
|
1713
|
+
let e = tn.value, i = H.value?.bounds;
|
|
1714
|
+
if (!e?.startsWith("rect-") || H.value?.shapeId !== t.id || !i) return;
|
|
1715
|
+
let a = i.left, o = i.top, s = i.right, c = i.bottom;
|
|
1716
|
+
switch (e) {
|
|
1717
|
+
case "rect-nw":
|
|
1718
|
+
a = Math.min(n, i.right - 20), o = Math.min(r, i.bottom - 20);
|
|
1719
|
+
break;
|
|
1720
|
+
case "rect-ne":
|
|
1721
|
+
s = Math.max(n, i.left + 20), o = Math.min(r, i.bottom - 20);
|
|
1722
|
+
break;
|
|
1723
|
+
case "rect-se":
|
|
1724
|
+
s = Math.max(n, i.left + 20), c = Math.max(r, i.top + 20);
|
|
1725
|
+
break;
|
|
1726
|
+
case "rect-sw":
|
|
1727
|
+
a = Math.min(n, i.right - 20), c = Math.max(r, i.top + 20);
|
|
1728
|
+
break;
|
|
1729
|
+
default: return;
|
|
1730
|
+
}
|
|
1731
|
+
t.x = a, t.y = o, t.rectWidth = s - a, t.rectHeight = c - o;
|
|
1732
|
+
break;
|
|
1733
|
+
}
|
|
1734
|
+
case "group":
|
|
1735
|
+
if (tn.value !== "group-scale") return;
|
|
1736
|
+
t.rectWidth = Math.max(20, n - t.x), t.rectHeight = Math.max(20, r - t.y);
|
|
1737
|
+
}
|
|
1738
|
+
}
|
|
1739
|
+
function gr(e) {
|
|
1740
|
+
if (!M.value || D.value) return;
|
|
1741
|
+
e.preventDefault(), e.stopPropagation(), Nr(e);
|
|
1742
|
+
let t = Ln(e);
|
|
1743
|
+
t && (Nt.value = t), k.value && Bt.value ? mr() : A.value && Bt.value && (tn.value ? hr() : mr());
|
|
1744
|
+
}
|
|
1745
|
+
function _r(e) {
|
|
1746
|
+
if (e) {
|
|
1747
|
+
if (P.value && nn.value !== e.id && Jn(), F.value = e, E.value = { id: e.id }, k.value = !1, D.value = !1, A.value = !0, j.value = !1, O.value = !1, e.type === "text") {
|
|
1748
|
+
w.value = void 0, Wn(e), qn(e);
|
|
1749
|
+
return;
|
|
1750
|
+
}
|
|
1751
|
+
N.value = !1, P.value = !1, z.value = !1, U.value = null, Wn(e);
|
|
1752
|
+
}
|
|
1753
|
+
}
|
|
1754
|
+
let vr = {
|
|
1755
|
+
id: null,
|
|
1756
|
+
at: 0
|
|
1757
|
+
}, yr = {
|
|
1758
|
+
id: null,
|
|
1759
|
+
at: 0
|
|
1760
|
+
};
|
|
1761
|
+
function br(e, t) {
|
|
1762
|
+
if (!M.value) return;
|
|
1763
|
+
let n = t || In(e.target);
|
|
1764
|
+
if (!n) return;
|
|
1765
|
+
yr = {
|
|
1766
|
+
id: null,
|
|
1767
|
+
at: 0
|
|
1768
|
+
};
|
|
1769
|
+
let r = L.value.find((e) => e.id === n);
|
|
1770
|
+
r && _r(r);
|
|
1771
|
+
}
|
|
1772
|
+
function xr(e, t) {
|
|
1773
|
+
if (!M.value) return;
|
|
1774
|
+
let n = t || In(e.target);
|
|
1775
|
+
if (!n) return;
|
|
1776
|
+
let r = L.value.find((e) => e.id === n);
|
|
1777
|
+
if (!r) return;
|
|
1778
|
+
let i = Number.isFinite(e?.timeStamp) ? e.timeStamp : Date.now(), a = yr.id === n && i - yr.at >= 0 && i - yr.at <= Et;
|
|
1779
|
+
if (yr = a ? {
|
|
1780
|
+
id: null,
|
|
1781
|
+
at: 0
|
|
1782
|
+
} : {
|
|
1783
|
+
id: n,
|
|
1784
|
+
at: i
|
|
1785
|
+
}, a && !D.value) {
|
|
1786
|
+
_r(r);
|
|
1787
|
+
return;
|
|
1788
|
+
}
|
|
1789
|
+
let o = F.value?.id === n, s = N.value;
|
|
1790
|
+
if (D.value) {
|
|
1791
|
+
P.value && Jn(), q.value?.begin?.(), L.value = L.value.filter((e) => e.id !== n), F.value?.id === n && (F.value = void 0), E.value = void 0, q.value?.end?.();
|
|
1792
|
+
return;
|
|
1793
|
+
}
|
|
1794
|
+
if (P.value && nn.value && nn.value !== n && Jn(), F.value = r, E.value = { id: r.id }, k.value) {
|
|
1795
|
+
z.value = !1, U.value = null;
|
|
1796
|
+
return;
|
|
1797
|
+
}
|
|
1798
|
+
if (Wn(r), r.type === "text") {
|
|
1799
|
+
let e = !k.value && !A.value && !O.value && !j.value;
|
|
1800
|
+
N.value = e, e && (s || o) && qn(r);
|
|
1801
|
+
return;
|
|
1802
|
+
}
|
|
1803
|
+
N.value = !1, z.value = !1, U.value = null;
|
|
1804
|
+
}
|
|
1805
|
+
let Sr = y(null);
|
|
1806
|
+
function Cr(e, t) {
|
|
1807
|
+
for (t(e), e = e.firstChild; e;) Cr(e, t), e = e.nextSibling;
|
|
1808
|
+
}
|
|
1809
|
+
function wr() {
|
|
1810
|
+
P.value && Jn(), Vt.value = !0, D.value = !1, k.value = !1, A.value = !1, N.value = !1, P.value = !1, j.value = !1, w.value = void 0, z.value = !1, ce(async () => {
|
|
1811
|
+
let e = Sr.value;
|
|
1812
|
+
if (e) {
|
|
1813
|
+
Cr(e, (e) => {
|
|
1814
|
+
e && e.nodeType === 1 && (e.setAttribute("font-family", "Helvetica"), e.style.fontFamily = "Helvetica");
|
|
1815
|
+
});
|
|
1816
|
+
try {
|
|
1817
|
+
let t;
|
|
1818
|
+
try {
|
|
1819
|
+
t = (await import("jspdf")).default;
|
|
1820
|
+
} catch {
|
|
1821
|
+
throw Error("jspdf is not installed. Run npm install jspdf");
|
|
1822
|
+
}
|
|
1823
|
+
let n = await l({
|
|
1824
|
+
container: e,
|
|
1825
|
+
scale: 2
|
|
1826
|
+
}), r = new Image();
|
|
1827
|
+
r.src = n, r.onload = () => {
|
|
1828
|
+
let e = {
|
|
1829
|
+
width: 595.28,
|
|
1830
|
+
height: 841.89
|
|
1831
|
+
}, i = r.width, a = r.height, o = i / e.width * e.height, s = e.width, c = s / i * a, l = new t("", "pt", "a4"), ee = 0, u = a;
|
|
1832
|
+
if (u < o) l.addImage(n, "PNG", 0, 0, s, c, "", "FAST");
|
|
1833
|
+
else for (; u > 0;) l.addImage(n, "PNG", 0, ee, s, c, "", "FAST"), u -= o, ee -= e.height, u > 0 && l.addPage();
|
|
1834
|
+
l.save(`${(/* @__PURE__ */ new Date()).toLocaleDateString()}_annotations.pdf`);
|
|
1835
|
+
};
|
|
1836
|
+
} catch (e) {
|
|
1837
|
+
console.error("Error generating image:", e);
|
|
1838
|
+
} finally {
|
|
1839
|
+
Vt.value = !1, Cr(e, (e) => {
|
|
1840
|
+
e && e.nodeType === 1 && (e.setAttribute("font-family", J.value.style.fontFamily), e.style.fontFamily = J.value.style.fontFamily);
|
|
1841
|
+
});
|
|
1842
|
+
}
|
|
1843
|
+
}
|
|
1844
|
+
});
|
|
1845
|
+
}
|
|
1846
|
+
function Tr(e) {
|
|
1847
|
+
let t = O.value && Lt.value && F.value && [
|
|
1848
|
+
"arrow",
|
|
1849
|
+
"circle",
|
|
1850
|
+
"line",
|
|
1851
|
+
"rect"
|
|
1852
|
+
].includes(F.value.type) ? L.value.find((e) => e.id === F.value.id) : null;
|
|
1853
|
+
if (!D.value && e && (e.preventDefault(), e.stopPropagation()), Lt.value = !1, Bt.value = !1, V.value = null, tn.value = null, H.value = null, fn.value != null) {
|
|
1854
|
+
try {
|
|
1855
|
+
vn.value?.releasePointerCapture?.(fn.value);
|
|
1856
|
+
} catch {}
|
|
1857
|
+
fn.value = null;
|
|
1858
|
+
}
|
|
1859
|
+
dn.value &&= (cancelAnimationFrame(dn.value), null);
|
|
1860
|
+
let n = j.value ? cr() : null;
|
|
1861
|
+
q.value?.end(), n && (j.value = !1, k.value = !0, A.value = !1, O.value = !1, D.value = !1, N.value = !1, P.value = !1, z.value = !1, U.value = null, F.value = n, E.value = { id: n.id }, Nt.value = void 0, Zn = Date.now() + 250), t && (Zn = Date.now() + 250, _r(t));
|
|
1862
|
+
}
|
|
1863
|
+
function Er() {
|
|
1864
|
+
!F.value || !F.value.id.includes("rect") || (F.value.isFilled = !F.value.isFilled);
|
|
1865
|
+
}
|
|
1866
|
+
function Dr() {
|
|
1867
|
+
!F.value || !F.value.id.includes("circle") || (F.value.isFilled = !F.value.isFilled);
|
|
1868
|
+
}
|
|
1869
|
+
function Or(e = pn.value) {
|
|
1870
|
+
let t = typeof e == "string" && e.length ? e : pn.value;
|
|
1871
|
+
if (pn.value = t, !F.value || k.value) return;
|
|
1872
|
+
let n = L.value.find((e) => e.id === F.value.id);
|
|
1873
|
+
if (n) {
|
|
1874
|
+
if (n.color = Z(t), F.value = n, ["arrow", "text"].includes(n.type)) {
|
|
1875
|
+
Kn();
|
|
1876
|
+
return;
|
|
1877
|
+
}
|
|
1878
|
+
n.alpha = Z(hn.value);
|
|
1879
|
+
}
|
|
1880
|
+
}
|
|
1881
|
+
function kr() {
|
|
1882
|
+
!F.value || F.value.type === "text" || (F.value.isDash = Z(It.value));
|
|
1883
|
+
}
|
|
1884
|
+
function Ar() {
|
|
1885
|
+
!F.value || ["arrow", "text"].includes(F.value.type) || (F.value.alpha = Z(hn.value));
|
|
1886
|
+
}
|
|
1887
|
+
function jr() {
|
|
1888
|
+
!F.value || ![
|
|
1889
|
+
"arrow",
|
|
1890
|
+
"circle",
|
|
1891
|
+
"rect",
|
|
1892
|
+
"line"
|
|
1893
|
+
].includes(F.value.type) || (F.value.strokeWidth = Z(Math.abs(Mt.value)));
|
|
1894
|
+
}
|
|
1895
|
+
function Mr() {
|
|
1896
|
+
!F.value || F.value.type !== "text" || (F.value.isBold = Z(Pt.value), F.value.isItalic = Z(zt.value), F.value.isUnderline = Z(Ht.value), F.value.fontSize = Z(Qt.value), F.value.isBulletTextMode = Z(Ft.value), Kn());
|
|
1897
|
+
}
|
|
1898
|
+
function Nr(e) {
|
|
1899
|
+
if (e.preventDefault(), !vn.value) return;
|
|
1900
|
+
let t = vn.value.getBoundingClientRect(), n, r;
|
|
1901
|
+
e.touches && e.touches.length > 0 ? (n = e.touches[0].clientX, r = e.touches[0].clientY) : (n = e.clientX, r = e.clientY), I.value.x = (n - t.left) / t.width * qt.value, I.value.y = (r - t.top) / t.height * Kt.value;
|
|
1902
|
+
}
|
|
1903
|
+
function Pr(e) {
|
|
1904
|
+
if (z.value = !1, Yn(), e === w.value) {
|
|
1905
|
+
w.value = void 0, O.value = !1;
|
|
1906
|
+
return;
|
|
1907
|
+
}
|
|
1908
|
+
O.value = !0, D.value = !1, k.value = !1, A.value = !1, N.value = !1, w.value = e;
|
|
1909
|
+
}
|
|
1910
|
+
function Fr() {
|
|
1911
|
+
P.value && Jn(), M.value = !M.value, M.value || (k.value = !1, A.value = !1, j.value = !1, N.value = !1, P.value = !1, w.value = void 0, F.value = void 0, E.value = void 0, Nt.value = void 0, Wt.value = [], z.value = !1, D.value = !1), xe("toggleOpenState", { isOpen: M.value });
|
|
1912
|
+
}
|
|
1913
|
+
function Ir() {
|
|
1914
|
+
P.value && Jn(), xe("saveAnnotations", {
|
|
1915
|
+
shapes: L.value,
|
|
1916
|
+
lastSelectedShape: F.value
|
|
1917
|
+
});
|
|
1918
|
+
}
|
|
1919
|
+
let Lr = null;
|
|
1920
|
+
return de(() => {
|
|
1921
|
+
if (Sr.value) {
|
|
1922
|
+
let e = !1;
|
|
1923
|
+
Cr(Sr.value, (t) => {
|
|
1924
|
+
if (!e && [
|
|
1925
|
+
"DIV",
|
|
1926
|
+
"svg",
|
|
1927
|
+
"section",
|
|
1928
|
+
"canvas"
|
|
1929
|
+
].includes(t.tagName)) {
|
|
1930
|
+
Yt.value = t, e = !0;
|
|
1931
|
+
return;
|
|
1932
|
+
}
|
|
1933
|
+
});
|
|
1934
|
+
}
|
|
1935
|
+
cn.value = (() => {
|
|
1936
|
+
if (typeof navigator > "u") return !1;
|
|
1937
|
+
let e = navigator.userAgentData?.platform ?? "";
|
|
1938
|
+
if (e) return /mac|ios/i.test(e);
|
|
1939
|
+
let t = navigator.userAgent ?? "";
|
|
1940
|
+
return /(Mac|iPhone|iPad|iPod)/i.test(t);
|
|
1941
|
+
})();
|
|
1942
|
+
let e = Yt?.value.getBoundingClientRect();
|
|
1943
|
+
if (Jt.value = e.height / e.width, qt.value = 1e3, Kt.value = Jt.value * 1e3, Xt.value = e.width, Zt.value = e.height, new ResizeObserver((e) => {
|
|
1944
|
+
e.forEach((e) => {
|
|
1945
|
+
Xt.value = e.contentRect.width, Zt.value = e.contentRect.height, Jt.value = e.contentRect.height / e.contentRect.width, Kt.value = Jt.value * 1e3;
|
|
1946
|
+
});
|
|
1947
|
+
}).observe(Yt.value), ln.value = (e) => nr(e), window.addEventListener("keydown", ln.value), q.value = Rn(), q.value.size) {
|
|
1948
|
+
let e = q.value.size();
|
|
1949
|
+
un.value.undo = e.undo, un.value.redo = e.redo;
|
|
1950
|
+
}
|
|
1951
|
+
Lr = ye({
|
|
1952
|
+
isMacLike: cn,
|
|
1953
|
+
isSummaryOpen: M,
|
|
1954
|
+
isWriting: P,
|
|
1955
|
+
isDeleteMode: D,
|
|
1956
|
+
isMoveMode: k,
|
|
1957
|
+
isResizeMode: A,
|
|
1958
|
+
isSelectMode: j,
|
|
1959
|
+
isDrawMode: O,
|
|
1960
|
+
isTextMode: N,
|
|
1961
|
+
activeShape: w,
|
|
1962
|
+
showCaret: z,
|
|
1963
|
+
lastSelectedShape: F,
|
|
1964
|
+
shapes: L,
|
|
1965
|
+
history: q,
|
|
1966
|
+
setShapeTo: Pr,
|
|
1967
|
+
undoLastShape: er,
|
|
1968
|
+
redoLastShape: tr
|
|
1969
|
+
});
|
|
1970
|
+
}), ue(() => {
|
|
1971
|
+
$(), dn.value && cancelAnimationFrame(dn.value), ln.value && window.removeEventListener("keydown", ln.value), Lr && Lr(), window.removeEventListener("keydown", nr);
|
|
1972
|
+
}), ge(L, (e) => {
|
|
1973
|
+
e.length === 0 && (F.value = void 0);
|
|
1974
|
+
}), ge(N, (e) => {
|
|
1975
|
+
if (!e && P.value) {
|
|
1976
|
+
Jn();
|
|
1977
|
+
return;
|
|
1978
|
+
}
|
|
1979
|
+
z.value = !!(e && P.value), z.value && Kn();
|
|
1980
|
+
}), (e, t) => (v(), p("div", Se, [m("div", Ce, [
|
|
1981
|
+
b(e.$slots, "toggle", le(se({
|
|
1982
|
+
toggle: Fr,
|
|
1983
|
+
isOpen: M.value
|
|
1984
|
+
})), () => [oe(te, {
|
|
1985
|
+
config: {
|
|
1986
|
+
maxHeight: 1e3,
|
|
1987
|
+
useCursorPointer: Y.value,
|
|
1988
|
+
head: {
|
|
1989
|
+
backgroundColor: J.value.style.backgroundColor,
|
|
1990
|
+
color: J.value.style.color,
|
|
1991
|
+
iconColor: J.value.style.color,
|
|
1992
|
+
iconSize: 20,
|
|
1993
|
+
icon: M.value ? "close" : "annotator",
|
|
1994
|
+
padding: "6px"
|
|
1995
|
+
},
|
|
1996
|
+
body: {
|
|
1997
|
+
backgroundColor: J.value.style.backgroundColor,
|
|
1998
|
+
color: J.value.style.color
|
|
1999
|
+
}
|
|
2000
|
+
},
|
|
2001
|
+
onToggle: Fr
|
|
2002
|
+
}, {
|
|
2003
|
+
title: S(({ color: e }) => [m("div", { style: _({ color: e }) }, x(J.value.translations.title), 5)]),
|
|
2004
|
+
content: S(({ backgroundColor: e }) => [m("div", { id: `toggle_default_${kt.value}` }, null, 8, we)]),
|
|
2005
|
+
_: 1
|
|
2006
|
+
}, 8, ["config"])], !0),
|
|
2007
|
+
e.$slots.toggle && M.value ? (v(), p("div", {
|
|
2008
|
+
key: 0,
|
|
2009
|
+
id: `toggle_slot_${kt.value}`
|
|
2010
|
+
}, null, 8, Te)) : f("", !0),
|
|
2011
|
+
Dt.value && Ot.value ? (v(), d(ie, {
|
|
2012
|
+
key: 1,
|
|
2013
|
+
to: e.$slots.toggle ? `#toggle_slot_${kt.value}` : `#toggle_default_${kt.value}`
|
|
2014
|
+
}, [m("div", null, [m("div", Ee, [
|
|
2015
|
+
m("button", {
|
|
2016
|
+
disabled: L.value.length === 0,
|
|
2017
|
+
style: _({
|
|
2018
|
+
background: k.value ? J.value.style.buttons.controls.selected.backgroundColor : J.value.style.buttons.controls.backgroundColor,
|
|
2019
|
+
border: k.value ? J.value.style.buttons.controls.selected.border : J.value.style.buttons.controls.border,
|
|
2020
|
+
color: k.value ? J.value.style.buttons.controls.selected.color : J.value.style.buttons.controls.color,
|
|
2021
|
+
borderRadius: `${J.value.style.buttons.borderRadius}px`,
|
|
2022
|
+
cursor: Y.value ? "pointer" : "default"
|
|
2023
|
+
}),
|
|
2024
|
+
class: g({
|
|
2025
|
+
"button-tool": !0,
|
|
2026
|
+
"button-tool--selected": k.value,
|
|
2027
|
+
tooltip: !0
|
|
2028
|
+
}),
|
|
2029
|
+
onClick: t[0] ||= (e) => {
|
|
2030
|
+
Yn(), k.value = !k.value, D.value = !1, O.value = !1, A.value = !1, j.value = !1, N.value = !1, P.value = !1, z.value = !1;
|
|
2031
|
+
},
|
|
2032
|
+
onMouseenter: t[1] ||= (e) => J.value.style.showTooltips && Q("move", e, "top"),
|
|
2033
|
+
onMouseleave: $,
|
|
2034
|
+
onFocus: t[2] ||= (e) => J.value.style.showTooltips && Q("move", e, "top"),
|
|
2035
|
+
onBlur: $
|
|
2036
|
+
}, [b(e.$slots, "icon-move", le(se({ active: k.value })), () => [oe(u, {
|
|
2037
|
+
name: "move",
|
|
2038
|
+
stroke: k.value ? J.value.style.buttons.controls.selected.color : J.value.style.buttons.controls.color
|
|
2039
|
+
}, null, 8, ["stroke"])], !0), J.value.style.showTooltips ? (v(), d(C, {
|
|
2040
|
+
key: 0,
|
|
2041
|
+
show: W.value && G.value === "move",
|
|
2042
|
+
x: K.value.x,
|
|
2043
|
+
y: K.value.y - 6,
|
|
2044
|
+
placement: "top",
|
|
2045
|
+
styleObject: X.value
|
|
2046
|
+
}, {
|
|
2047
|
+
default: S(() => [h(x(J.value.translations.tooltipMove) + " ", 1), t[91] ||= m("kbd", null, "M", -1)]),
|
|
2048
|
+
_: 1
|
|
2049
|
+
}, 8, [
|
|
2050
|
+
"show",
|
|
2051
|
+
"x",
|
|
2052
|
+
"y",
|
|
2053
|
+
"styleObject"
|
|
2054
|
+
])) : f("", !0)], 46, De),
|
|
2055
|
+
m("button", {
|
|
2056
|
+
disabled: L.value.length === 0,
|
|
2057
|
+
style: _({
|
|
2058
|
+
background: A.value ? J.value.style.buttons.controls.selected.backgroundColor : J.value.style.buttons.controls.backgroundColor,
|
|
2059
|
+
border: A.value ? J.value.style.buttons.controls.selected.border : J.value.style.buttons.controls.border,
|
|
2060
|
+
color: A.value ? J.value.style.buttons.controls.selected.color : J.value.style.buttons.controls.color,
|
|
2061
|
+
borderRadius: `${J.value.style.buttons.borderRadius}px`,
|
|
2062
|
+
cursor: Y.value ? "pointer" : "default"
|
|
2063
|
+
}),
|
|
2064
|
+
class: g({
|
|
2065
|
+
"button-tool": !0,
|
|
2066
|
+
"button-tool--selected": A.value,
|
|
2067
|
+
tooltip: !0
|
|
2068
|
+
}),
|
|
2069
|
+
onClick: t[3] ||= (e) => {
|
|
2070
|
+
Yn(), A.value = !A.value, k.value = !1, D.value = !1, O.value = !1, j.value = !1, N.value = !1, P.value = !1, w.value = void 0, z.value = !1;
|
|
2071
|
+
},
|
|
2072
|
+
onMouseenter: t[4] ||= (e) => J.value.style.showTooltips && Q("resize", e, "top"),
|
|
2073
|
+
onMouseleave: $,
|
|
2074
|
+
onFocus: t[5] ||= (e) => J.value.style.showTooltips && Q("resize", e, "top"),
|
|
2075
|
+
onBlur: $
|
|
2076
|
+
}, [b(e.$slots, "icon-resize", le(se({ active: A.value })), () => [oe(u, {
|
|
2077
|
+
name: "resize",
|
|
2078
|
+
stroke: A.value ? J.value.style.buttons.controls.selected.color : J.value.style.buttons.controls.color
|
|
2079
|
+
}, null, 8, ["stroke"])], !0), J.value.style.showTooltips ? (v(), d(C, {
|
|
2080
|
+
key: 0,
|
|
2081
|
+
show: W.value && G.value === "resize",
|
|
2082
|
+
x: K.value.x,
|
|
2083
|
+
y: K.value.y - 6,
|
|
2084
|
+
placement: "top",
|
|
2085
|
+
styleObject: X.value
|
|
2086
|
+
}, {
|
|
2087
|
+
default: S(() => [h(x(J.value.translations.tooltipResize) + " ", 1), t[92] ||= m("kbd", null, "R", -1)]),
|
|
2088
|
+
_: 1
|
|
2089
|
+
}, 8, [
|
|
2090
|
+
"show",
|
|
2091
|
+
"x",
|
|
2092
|
+
"y",
|
|
2093
|
+
"styleObject"
|
|
2094
|
+
])) : f("", !0)], 46, Oe),
|
|
2095
|
+
m("button", {
|
|
2096
|
+
disabled: L.value.length === 0,
|
|
2097
|
+
style: _({
|
|
2098
|
+
background: D.value ? J.value.style.buttons.controls.selected.backgroundColor : J.value.style.buttons.controls.backgroundColor,
|
|
2099
|
+
border: D.value ? J.value.style.buttons.controls.selected.border : J.value.style.buttons.controls.border,
|
|
2100
|
+
color: D.value ? J.value.style.buttons.controls.selected.color : J.value.style.buttons.controls.color,
|
|
2101
|
+
borderRadius: `${J.value.style.buttons.borderRadius}px`,
|
|
2102
|
+
cursor: Y.value ? "pointer" : "default"
|
|
2103
|
+
}),
|
|
2104
|
+
class: g({
|
|
2105
|
+
"button-tool": !0,
|
|
2106
|
+
"button-tool--selected": D.value,
|
|
2107
|
+
tooltip: !0
|
|
2108
|
+
}),
|
|
2109
|
+
onClick: t[6] ||= (e) => {
|
|
2110
|
+
Yn(), D.value = !D.value, k.value = !1, A.value = !1, j.value = !1, N.value = !1, P.value = !1, w.value = void 0, z.value = !1;
|
|
2111
|
+
},
|
|
2112
|
+
onMouseenter: t[7] ||= (e) => J.value.style.showTooltips && Q("delete", e, "top"),
|
|
2113
|
+
onMouseleave: $,
|
|
2114
|
+
onFocus: t[8] ||= (e) => J.value.style.showTooltips && Q("delete", e, "top"),
|
|
2115
|
+
onBlur: $
|
|
2116
|
+
}, [b(e.$slots, "icon-delete", le(se({ active: D.value })), () => [oe(u, {
|
|
2117
|
+
name: "trash",
|
|
2118
|
+
stroke: D.value ? J.value.style.buttons.controls.selected.color : J.value.style.buttons.controls.color
|
|
2119
|
+
}, null, 8, ["stroke"])], !0), J.value.style.showTooltips ? (v(), d(C, {
|
|
2120
|
+
key: 0,
|
|
2121
|
+
show: W.value && G.value === "delete",
|
|
2122
|
+
x: K.value.x,
|
|
2123
|
+
y: K.value.y - 6,
|
|
2124
|
+
placement: "top",
|
|
2125
|
+
styleObject: X.value
|
|
2126
|
+
}, {
|
|
2127
|
+
default: S(() => [h(x(J.value.translations.tooltipDelete) + " ", 1), t[93] ||= m("kbd", null, "D", -1)]),
|
|
2128
|
+
_: 1
|
|
2129
|
+
}, 8, [
|
|
2130
|
+
"show",
|
|
2131
|
+
"x",
|
|
2132
|
+
"y",
|
|
2133
|
+
"styleObject"
|
|
2134
|
+
])) : f("", !0)], 46, ke),
|
|
2135
|
+
m("button", {
|
|
2136
|
+
disabled: !mn.value,
|
|
2137
|
+
style: _({
|
|
2138
|
+
background: j.value ? J.value.style.buttons.controls.selected.backgroundColor : J.value.style.buttons.controls.backgroundColor,
|
|
2139
|
+
border: j.value ? J.value.style.buttons.controls.selected.border : J.value.style.buttons.controls.border,
|
|
2140
|
+
color: j.value ? J.value.style.buttons.controls.selected.color : J.value.style.buttons.controls.color,
|
|
2141
|
+
borderRadius: `${J.value.style.buttons.borderRadius}px`,
|
|
2142
|
+
cursor: Y.value ? "pointer" : "default"
|
|
2143
|
+
}),
|
|
2144
|
+
class: g({
|
|
2145
|
+
"button-tool": !0,
|
|
2146
|
+
"button-tool--selected": j.value,
|
|
2147
|
+
tooltip: !0
|
|
2148
|
+
}),
|
|
2149
|
+
onClick: t[9] ||= (e) => {
|
|
2150
|
+
Yn(), Pr("group"), j.value = !j.value, D.value = !1, k.value = !1, A.value = !1, N.value = !1, P.value = !1, w.value = "group", z.value = !1;
|
|
2151
|
+
},
|
|
2152
|
+
onMouseenter: t[10] ||= (e) => J.value.style.showTooltips && Q("selectAndGroup", e, "top"),
|
|
2153
|
+
onMouseleave: $,
|
|
2154
|
+
onFocus: t[11] ||= (e) => J.value.style.showTooltips && Q("selectAndGroup", e, "top"),
|
|
2155
|
+
onBlur: $
|
|
2156
|
+
}, [b(e.$slots, "icon-select-group", le(se({ active: j.value })), () => [oe(u, {
|
|
2157
|
+
name: "selectAndGroup",
|
|
2158
|
+
stroke: j.value ? J.value.style.buttons.controls.selected.color : J.value.style.buttons.controls.color
|
|
2159
|
+
}, null, 8, ["stroke"])], !0), J.value.style.showTooltips ? (v(), d(C, {
|
|
2160
|
+
key: 0,
|
|
2161
|
+
show: W.value && G.value === "selectAndGroup",
|
|
2162
|
+
x: K.value.x,
|
|
2163
|
+
y: K.value.y - 6,
|
|
2164
|
+
placement: "top",
|
|
2165
|
+
styleObject: X.value
|
|
2166
|
+
}, {
|
|
2167
|
+
default: S(() => [h(x(J.value.translations.tooltipGroup) + " ", 1), t[94] ||= m("kbd", null, "G", -1)]),
|
|
2168
|
+
_: 1
|
|
2169
|
+
}, 8, [
|
|
2170
|
+
"show",
|
|
2171
|
+
"x",
|
|
2172
|
+
"y",
|
|
2173
|
+
"styleObject"
|
|
2174
|
+
])) : f("", !0)], 46, Ae),
|
|
2175
|
+
m("button", {
|
|
2176
|
+
disabled: L.value.length === 0,
|
|
2177
|
+
style: _({
|
|
2178
|
+
background: J.value.style.buttons.controls.backgroundColor,
|
|
2179
|
+
border: J.value.style.buttons.controls.border,
|
|
2180
|
+
color: J.value.style.buttons.controls.color,
|
|
2181
|
+
borderRadius: `${J.value.style.buttons.borderRadius}px`,
|
|
2182
|
+
cursor: Y.value ? "pointer" : "default"
|
|
2183
|
+
}),
|
|
2184
|
+
class: g({
|
|
2185
|
+
"button-tool": !0,
|
|
2186
|
+
tooltip: !0
|
|
2187
|
+
}),
|
|
2188
|
+
onClick: t[12] ||= (e) => {
|
|
2189
|
+
A.value = !1, k.value = !0, D.value = !1, O.value = !1, j.value = !1, N.value = !1, P.value = !1, z.value = !1, Hn("front");
|
|
2190
|
+
},
|
|
2191
|
+
onMouseenter: t[13] ||= (e) => J.value.style.showTooltips && Q("bringToFront", e, "top"),
|
|
2192
|
+
onMouseleave: $,
|
|
2193
|
+
onFocus: t[14] ||= (e) => J.value.style.showTooltips && Q("bringToFront", e, "top"),
|
|
2194
|
+
onBlur: $
|
|
2195
|
+
}, [b(e.$slots, "icon-bring-to-front", {}, () => [oe(u, {
|
|
2196
|
+
name: "bringToFront",
|
|
2197
|
+
stroke: J.value.style.buttons.controls.color
|
|
2198
|
+
}, null, 8, ["stroke"])], !0), J.value.style.showTooltips ? (v(), d(C, {
|
|
2199
|
+
key: 0,
|
|
2200
|
+
show: W.value && G.value === "bringToFront",
|
|
2201
|
+
x: K.value.x,
|
|
2202
|
+
y: K.value.y - 6,
|
|
2203
|
+
placement: "top",
|
|
2204
|
+
styleObject: X.value
|
|
2205
|
+
}, {
|
|
2206
|
+
default: S(() => [h(x(J.value.translations.tooltipBringToFront), 1)]),
|
|
2207
|
+
_: 1
|
|
2208
|
+
}, 8, [
|
|
2209
|
+
"show",
|
|
2210
|
+
"x",
|
|
2211
|
+
"y",
|
|
2212
|
+
"styleObject"
|
|
2213
|
+
])) : f("", !0)], 44, je),
|
|
2214
|
+
m("button", {
|
|
2215
|
+
disabled: L.value.length === 0,
|
|
2216
|
+
style: _({
|
|
2217
|
+
background: J.value.style.buttons.controls.backgroundColor,
|
|
2218
|
+
border: J.value.style.buttons.controls.border,
|
|
2219
|
+
color: J.value.style.buttons.controls.color,
|
|
2220
|
+
borderRadius: `${J.value.style.buttons.borderRadius}px`,
|
|
2221
|
+
cursor: Y.value ? "pointer" : "default"
|
|
2222
|
+
}),
|
|
2223
|
+
class: g({
|
|
2224
|
+
"button-tool": !0,
|
|
2225
|
+
tooltip: !0
|
|
2226
|
+
}),
|
|
2227
|
+
onClick: t[15] ||= (e) => {
|
|
2228
|
+
A.value = !1, k.value = !0, D.value = !1, O.value = !1, j.value = !1, N.value = !1, P.value = !1, z.value = !1, Hn("back");
|
|
2229
|
+
},
|
|
2230
|
+
onMouseenter: t[16] ||= (e) => J.value.style.showTooltips && Q("bringToBack", e, "top"),
|
|
2231
|
+
onMouseleave: $,
|
|
2232
|
+
onFocus: t[17] ||= (e) => J.value.style.showTooltips && Q("bringToBack", e, "top"),
|
|
2233
|
+
onBlur: $
|
|
2234
|
+
}, [b(e.$slots, "icon-bring-to-back", {}, () => [oe(u, {
|
|
2235
|
+
name: "bringToBack",
|
|
2236
|
+
stroke: J.value.style.buttons.controls.color
|
|
2237
|
+
}, null, 8, ["stroke"])], !0), J.value.style.showTooltips ? (v(), d(C, {
|
|
2238
|
+
key: 0,
|
|
2239
|
+
show: W.value && G.value === "bringToBack",
|
|
2240
|
+
x: K.value.x,
|
|
2241
|
+
y: K.value.y - 6,
|
|
2242
|
+
placement: "top",
|
|
2243
|
+
styleObject: X.value
|
|
2244
|
+
}, {
|
|
2245
|
+
default: S(() => [h(x(J.value.translations.tooltipBringToBack), 1)]),
|
|
2246
|
+
_: 1
|
|
2247
|
+
}, 8, [
|
|
2248
|
+
"show",
|
|
2249
|
+
"x",
|
|
2250
|
+
"y",
|
|
2251
|
+
"styleObject"
|
|
2252
|
+
])) : f("", !0)], 44, Me),
|
|
2253
|
+
m("button", {
|
|
2254
|
+
disabled: L.value.length === 0 || w.value === "line",
|
|
2255
|
+
style: _({
|
|
2256
|
+
background: J.value.style.buttons.controls.backgroundColor,
|
|
2257
|
+
border: J.value.style.buttons.controls.border,
|
|
2258
|
+
color: J.value.style.buttons.controls.color,
|
|
2259
|
+
borderRadius: `${J.value.style.buttons.borderRadius}px`,
|
|
2260
|
+
cursor: Y.value ? "pointer" : "default"
|
|
2261
|
+
}),
|
|
2262
|
+
class: g({
|
|
2263
|
+
"button-tool": !0,
|
|
2264
|
+
tooltip: !0
|
|
2265
|
+
}),
|
|
2266
|
+
onClick: t[18] ||= (e) => {
|
|
2267
|
+
Yn(), A.value = !1, k.value = !0, D.value = !1, O.value = !1, j.value = !1, N.value = !1, P.value = !1, z.value = !1, Un();
|
|
2268
|
+
},
|
|
2269
|
+
onMouseenter: t[19] ||= (e) => J.value.style.showTooltips && Q("duplicate", e, "top"),
|
|
2270
|
+
onMouseleave: $,
|
|
2271
|
+
onFocus: t[20] ||= (e) => J.value.style.showTooltips && Q("duplicate", e, "top"),
|
|
2272
|
+
onBlur: $
|
|
2273
|
+
}, [b(e.$slots, "icon-copy", {}, () => [oe(u, {
|
|
2274
|
+
name: "copy",
|
|
2275
|
+
stroke: J.value.style.buttons.controls.color,
|
|
2276
|
+
size: 18
|
|
2277
|
+
}, null, 8, ["stroke"])], !0), J.value.style.showTooltips ? (v(), d(C, {
|
|
2278
|
+
key: 0,
|
|
2279
|
+
show: W.value && G.value === "duplicate",
|
|
2280
|
+
x: K.value.x,
|
|
2281
|
+
y: K.value.y - 6,
|
|
2282
|
+
placement: "top",
|
|
2283
|
+
styleObject: X.value
|
|
2284
|
+
}, {
|
|
2285
|
+
default: S(() => [h(x(J.value.translations.tooltipDuplicate), 1)]),
|
|
2286
|
+
_: 1
|
|
2287
|
+
}, 8, [
|
|
2288
|
+
"show",
|
|
2289
|
+
"x",
|
|
2290
|
+
"y",
|
|
2291
|
+
"styleObject"
|
|
2292
|
+
])) : f("", !0)], 44, Ne),
|
|
2293
|
+
m("button", {
|
|
2294
|
+
disabled: un.value.undo === 0,
|
|
2295
|
+
style: _({
|
|
2296
|
+
background: J.value.style.buttons.controls.backgroundColor,
|
|
2297
|
+
border: J.value.style.buttons.controls.border,
|
|
2298
|
+
color: J.value.style.buttons.controls.color,
|
|
2299
|
+
borderRadius: `${J.value.style.buttons.borderRadius}px`,
|
|
2300
|
+
cursor: Y.value ? "pointer" : "default"
|
|
2301
|
+
}),
|
|
2302
|
+
class: g({
|
|
2303
|
+
"button-tool": !0,
|
|
2304
|
+
"button-tool--one-shot": !0,
|
|
2305
|
+
tooltip: !0
|
|
2306
|
+
}),
|
|
2307
|
+
onClick: t[21] ||= (e) => {
|
|
2308
|
+
A.value = !1, k.value = !1, D.value = !1, O.value = !1, j.value = !1, N.value = !1, P.value = !1, w.value = void 0, z.value = !1, er();
|
|
2309
|
+
},
|
|
2310
|
+
onMouseenter: t[22] ||= (e) => J.value.style.showTooltips && Q("undoLast", e, "top"),
|
|
2311
|
+
onMouseleave: $,
|
|
2312
|
+
onFocus: t[23] ||= (e) => J.value.style.showTooltips && Q("undoLast", e, "top"),
|
|
2313
|
+
onBlur: $
|
|
2314
|
+
}, [b(e.$slots, "icon-undo", {}, () => [oe(u, {
|
|
2315
|
+
name: "refresh",
|
|
2316
|
+
stroke: J.value.style.buttons.controls.color,
|
|
2317
|
+
size: 20
|
|
2318
|
+
}, null, 8, ["stroke"])], !0), J.value.style.showTooltips ? (v(), d(C, {
|
|
2319
|
+
key: 0,
|
|
2320
|
+
show: W.value && G.value === "undoLast",
|
|
2321
|
+
x: K.value.x,
|
|
2322
|
+
y: K.value.y - 6,
|
|
2323
|
+
placement: "top",
|
|
2324
|
+
styleObject: X.value
|
|
2325
|
+
}, {
|
|
2326
|
+
default: S(() => [
|
|
2327
|
+
h(x(J.value.translations.tooltipUndo) + " ", 1),
|
|
2328
|
+
m("kbd", null, x(cn.value ? "⌘" : "Ctrl"), 1),
|
|
2329
|
+
t[95] ||= m("kbd", null, "Z", -1)
|
|
2330
|
+
]),
|
|
2331
|
+
_: 1
|
|
2332
|
+
}, 8, [
|
|
2333
|
+
"show",
|
|
2334
|
+
"x",
|
|
2335
|
+
"y",
|
|
2336
|
+
"styleObject"
|
|
2337
|
+
])) : f("", !0)], 44, Pe),
|
|
2338
|
+
m("button", {
|
|
2339
|
+
disabled: un.value.redo === 0,
|
|
2340
|
+
style: _({
|
|
2341
|
+
background: J.value.style.buttons.controls.backgroundColor,
|
|
2342
|
+
border: J.value.style.buttons.controls.border,
|
|
2343
|
+
color: J.value.style.buttons.controls.color,
|
|
2344
|
+
borderRadius: `${J.value.style.buttons.borderRadius}px`,
|
|
2345
|
+
cursor: Y.value ? "pointer" : "default"
|
|
2346
|
+
}),
|
|
2347
|
+
class: g({
|
|
2348
|
+
"button-tool": !0,
|
|
2349
|
+
"button-tool--one-shot": !0,
|
|
2350
|
+
tooltip: !0
|
|
2351
|
+
}),
|
|
2352
|
+
onClick: t[24] ||= (e) => {
|
|
2353
|
+
A.value = !1, k.value = !1, D.value = !1, O.value = !1, j.value = !1, N.value = !1, P.value = !1, w.value = void 0, z.value = !1, tr();
|
|
2354
|
+
},
|
|
2355
|
+
onMouseenter: t[25] ||= (e) => J.value.style.showTooltips && Q("redoLast", e, "top"),
|
|
2356
|
+
onMouseleave: $,
|
|
2357
|
+
onFocus: t[26] ||= (e) => J.value.style.showTooltips && Q("redoLast", e, "top"),
|
|
2358
|
+
onBlur: $
|
|
2359
|
+
}, [b(e.$slots, "icon-redo", {}, () => [oe(u, {
|
|
2360
|
+
name: "refresh",
|
|
2361
|
+
stroke: J.value.style.buttons.controls.color,
|
|
2362
|
+
size: 20,
|
|
2363
|
+
style: { transform: "rotateX(0deg) rotateY(180deg)" }
|
|
2364
|
+
}, null, 8, ["stroke"])], !0), J.value.style.showTooltips ? (v(), d(C, {
|
|
2365
|
+
key: 0,
|
|
2366
|
+
show: W.value && G.value === "redoLast",
|
|
2367
|
+
x: K.value.x,
|
|
2368
|
+
y: K.value.y - 6,
|
|
2369
|
+
placement: "top",
|
|
2370
|
+
styleObject: X.value
|
|
2371
|
+
}, {
|
|
2372
|
+
default: S(() => [
|
|
2373
|
+
h(x(J.value.translations.tooltipRedo) + " ", 1),
|
|
2374
|
+
m("kbd", null, x(cn.value ? "⌘" : "Ctrl"), 1),
|
|
2375
|
+
t[96] ||= m("kbd", null, "Y", -1)
|
|
2376
|
+
]),
|
|
2377
|
+
_: 1
|
|
2378
|
+
}, 8, [
|
|
2379
|
+
"show",
|
|
2380
|
+
"x",
|
|
2381
|
+
"y",
|
|
2382
|
+
"styleObject"
|
|
2383
|
+
])) : f("", !0)], 44, Fe),
|
|
2384
|
+
J.value.style.showPrint ? (v(), p("button", {
|
|
2385
|
+
key: 0,
|
|
2386
|
+
style: _({
|
|
2387
|
+
background: J.value.style.buttons.controls.backgroundColor,
|
|
2388
|
+
border: J.value.style.buttons.controls.border,
|
|
2389
|
+
color: J.value.style.buttons.controls.color,
|
|
2390
|
+
borderRadius: `${J.value.style.buttons.borderRadius}px`,
|
|
2391
|
+
cursor: Y.value ? "pointer" : "default"
|
|
2392
|
+
}),
|
|
2393
|
+
class: g({
|
|
2394
|
+
"button-tool": !0,
|
|
2395
|
+
tooltip: !0
|
|
2396
|
+
}),
|
|
2397
|
+
onClick: wr,
|
|
2398
|
+
onMouseenter: t[27] ||= (e) => J.value.style.showTooltips && Q("printPdf", e, "top"),
|
|
2399
|
+
onMouseleave: $,
|
|
2400
|
+
onFocus: t[28] ||= (e) => J.value.style.showTooltips && Q("printPdf", e, "top"),
|
|
2401
|
+
onBlur: $
|
|
2402
|
+
}, [b(e.$slots, "icon-print", {}, () => [oe(u, {
|
|
2403
|
+
name: "printer",
|
|
2404
|
+
stroke: J.value.style.buttons.controls.color
|
|
2405
|
+
}, null, 8, ["stroke"])], !0), J.value.style.showTooltips ? (v(), d(C, {
|
|
2406
|
+
key: 0,
|
|
2407
|
+
show: W.value && G.value === "printPdf",
|
|
2408
|
+
x: K.value.x,
|
|
2409
|
+
y: K.value.y - 6,
|
|
2410
|
+
placement: "top",
|
|
2411
|
+
styleObject: X.value
|
|
2412
|
+
}, {
|
|
2413
|
+
default: S(() => [h(x(J.value.translations.tooltipPdf), 1)]),
|
|
2414
|
+
_: 1
|
|
2415
|
+
}, 8, [
|
|
2416
|
+
"show",
|
|
2417
|
+
"x",
|
|
2418
|
+
"y",
|
|
2419
|
+
"styleObject"
|
|
2420
|
+
])) : f("", !0)], 36)) : f("", !0),
|
|
2421
|
+
J.value.style.showImage ? (v(), p("button", {
|
|
2422
|
+
key: 1,
|
|
2423
|
+
style: _({
|
|
2424
|
+
background: J.value.style.buttons.controls.backgroundColor,
|
|
2425
|
+
border: J.value.style.buttons.controls.border,
|
|
2426
|
+
color: J.value.style.buttons.controls.color,
|
|
2427
|
+
borderRadius: `${J.value.style.buttons.borderRadius}px`,
|
|
2428
|
+
cursor: Y.value ? "pointer" : "default"
|
|
2429
|
+
}),
|
|
2430
|
+
class: g({
|
|
2431
|
+
"button-tool": !0,
|
|
2432
|
+
tooltip: !0
|
|
2433
|
+
}),
|
|
2434
|
+
onClick: t[29] ||= (...e) => pe(jt) && pe(jt)(...e),
|
|
2435
|
+
onMouseenter: t[30] ||= (e) => J.value.style.showTooltips && Q("printImage", e, "top"),
|
|
2436
|
+
onMouseleave: $,
|
|
2437
|
+
onFocus: t[31] ||= (e) => J.value.style.showTooltips && Q("printImage", e, "top"),
|
|
2438
|
+
onBlur: $
|
|
2439
|
+
}, [b(e.$slots, "icon-export-image", {}, () => [oe(u, {
|
|
2440
|
+
name: "image",
|
|
2441
|
+
stroke: J.value.style.buttons.controls.color,
|
|
2442
|
+
size: 20
|
|
2443
|
+
}, null, 8, ["stroke"])], !0), J.value.style.showTooltips ? (v(), d(C, {
|
|
2444
|
+
key: 0,
|
|
2445
|
+
show: W.value && G.value === "printImage",
|
|
2446
|
+
x: K.value.x,
|
|
2447
|
+
y: K.value.y - 6,
|
|
2448
|
+
placement: "top",
|
|
2449
|
+
styleObject: X.value
|
|
2450
|
+
}, {
|
|
2451
|
+
default: S(() => [h(x(J.value.translations.tooltipImage), 1)]),
|
|
2452
|
+
_: 1
|
|
2453
|
+
}, 8, [
|
|
2454
|
+
"show",
|
|
2455
|
+
"x",
|
|
2456
|
+
"y",
|
|
2457
|
+
"styleObject"
|
|
2458
|
+
])) : f("", !0)], 36)) : f("", !0),
|
|
2459
|
+
J.value.style.showSave ? (v(), p("button", {
|
|
2460
|
+
key: 2,
|
|
2461
|
+
style: _({
|
|
2462
|
+
background: J.value.style.buttons.controls.backgroundColor,
|
|
2463
|
+
border: J.value.style.buttons.controls.border,
|
|
2464
|
+
color: J.value.style.buttons.controls.color,
|
|
2465
|
+
borderRadius: `${J.value.style.buttons.borderRadius}px`,
|
|
2466
|
+
cursor: Y.value ? "pointer" : "default"
|
|
2467
|
+
}),
|
|
2468
|
+
class: g({
|
|
2469
|
+
"button-tool": !0,
|
|
2470
|
+
tooltip: !0
|
|
2471
|
+
}),
|
|
2472
|
+
onClick: Ir,
|
|
2473
|
+
onMouseenter: t[32] ||= (e) => J.value.style.showTooltips && Q("saveAction", e, "top"),
|
|
2474
|
+
onMouseleave: $,
|
|
2475
|
+
onFocus: t[33] ||= (e) => J.value.style.showTooltips && Q("saveAction", e, "top"),
|
|
2476
|
+
onBlur: $
|
|
2477
|
+
}, [b(e.$slots, "icon-save", {}, () => [oe(u, {
|
|
2478
|
+
name: "save",
|
|
2479
|
+
stroke: J.value.style.buttons.controls.color
|
|
2480
|
+
}, null, 8, ["stroke"])], !0), J.value.style.showTooltips ? (v(), d(C, {
|
|
2481
|
+
key: 0,
|
|
2482
|
+
show: W.value && G.value === "saveAction",
|
|
2483
|
+
x: K.value.x,
|
|
2484
|
+
y: K.value.y - 6,
|
|
2485
|
+
placement: "top",
|
|
2486
|
+
styleObject: X.value
|
|
2487
|
+
}, {
|
|
2488
|
+
default: S(() => [h(x(J.value.translations.tooltipSave), 1)]),
|
|
2489
|
+
_: 1
|
|
2490
|
+
}, 8, [
|
|
2491
|
+
"show",
|
|
2492
|
+
"x",
|
|
2493
|
+
"y",
|
|
2494
|
+
"styleObject"
|
|
2495
|
+
])) : f("", !0)], 36)) : f("", !0)
|
|
2496
|
+
]), m("div", Ie, [
|
|
2497
|
+
m("button", {
|
|
2498
|
+
class: g({
|
|
2499
|
+
"button-tool": !0,
|
|
2500
|
+
"button-tool--selected": w.value === "circle",
|
|
2501
|
+
tooltip: !0
|
|
2502
|
+
}),
|
|
2503
|
+
style: _({
|
|
2504
|
+
background: w.value === "circle" ? J.value.style.buttons.shapes.selected.backgroundColor : J.value.style.buttons.shapes.backgroundColor,
|
|
2505
|
+
border: w.value === "circle" ? J.value.style.buttons.shapes.selected.border : J.value.style.buttons.shapes.border,
|
|
2506
|
+
color: w.value === "circle" ? J.value.style.buttons.shapes.selected.color : J.value.style.buttons.shapes.color,
|
|
2507
|
+
borderRadius: `${J.value.style.buttons.borderRadius}px`,
|
|
2508
|
+
cursor: Y.value ? "pointer" : "default"
|
|
2509
|
+
}),
|
|
2510
|
+
onClick: t[34] ||= (e) => {
|
|
2511
|
+
Pr("circle"), j.value = !1;
|
|
2512
|
+
},
|
|
2513
|
+
onMouseenter: t[35] ||= (e) => J.value.style.showTooltips && Q("setCircle", e, "top"),
|
|
2514
|
+
onMouseleave: $,
|
|
2515
|
+
onFocus: t[36] ||= (e) => J.value.style.showTooltips && Q("setCircle", e, "top"),
|
|
2516
|
+
onBlur: $
|
|
2517
|
+
}, [b(e.$slots, "icon-circle", le(se({ filled: R.value.circle.filled })), () => [(v(), p("svg", Le, [m("circle", {
|
|
2518
|
+
cx: 6,
|
|
2519
|
+
cy: 6,
|
|
2520
|
+
r: "4",
|
|
2521
|
+
fill: R.value.circle.filled ? (w.value, pn.value + hn.value) : "none",
|
|
2522
|
+
stroke: "currentColor"
|
|
2523
|
+
}, null, 8, Re)]))], !0), J.value.style.showTooltips ? (v(), d(C, {
|
|
2524
|
+
key: 0,
|
|
2525
|
+
show: W.value && G.value === "setCircle",
|
|
2526
|
+
x: K.value.x,
|
|
2527
|
+
y: K.value.y - 6,
|
|
2528
|
+
placement: "top",
|
|
2529
|
+
styleObject: X.value
|
|
2530
|
+
}, {
|
|
2531
|
+
default: S(() => [h(x(J.value.translations.tooltipShapeCircle) + " ", 1), t[97] ||= m("kbd", null, "C", -1)]),
|
|
2532
|
+
_: 1
|
|
2533
|
+
}, 8, [
|
|
2534
|
+
"show",
|
|
2535
|
+
"x",
|
|
2536
|
+
"y",
|
|
2537
|
+
"styleObject"
|
|
2538
|
+
])) : f("", !0)], 38),
|
|
2539
|
+
w.value === "circle" ? (v(), p("div", ze, [m("label", Be, [h(x(J.value.translations.filled) + " ", 1), _e(m("input", {
|
|
2540
|
+
type: "checkbox",
|
|
2541
|
+
"onUpdate:modelValue": t[37] ||= (e) => R.value.circle.filled = e,
|
|
2542
|
+
onChange: Dr,
|
|
2543
|
+
checked: R.value.circle.filled,
|
|
2544
|
+
style: _({
|
|
2545
|
+
all: "revert",
|
|
2546
|
+
appearance: "auto",
|
|
2547
|
+
"-webkit-appearance": "auto",
|
|
2548
|
+
accentColor: J.value.style.color + " !important"
|
|
2549
|
+
})
|
|
2550
|
+
}, null, 44, Ve), [[me, R.value.circle.filled]])])])) : f("", !0),
|
|
2551
|
+
m("button", {
|
|
2552
|
+
class: g({
|
|
2553
|
+
"button-tool": !0,
|
|
2554
|
+
"button-tool--selected": w.value === "rect",
|
|
2555
|
+
tooltip: !0
|
|
2556
|
+
}),
|
|
2557
|
+
style: _({
|
|
2558
|
+
background: w.value === "rect" ? J.value.style.buttons.shapes.selected.backgroundColor : J.value.style.buttons.shapes.backgroundColor,
|
|
2559
|
+
border: w.value === "rect" ? J.value.style.buttons.shapes.selected.border : J.value.style.buttons.shapes.border,
|
|
2560
|
+
color: w.value === "rect" ? J.value.style.buttons.shapes.selected.color : J.value.style.buttons.shapes.color,
|
|
2561
|
+
borderRadius: `${J.value.style.buttons.borderRadius}px`,
|
|
2562
|
+
cursor: Y.value ? "pointer" : "default"
|
|
2563
|
+
}),
|
|
2564
|
+
onClick: t[38] ||= (e) => {
|
|
2565
|
+
Pr("rect"), j.value = !1;
|
|
2566
|
+
},
|
|
2567
|
+
onMouseenter: t[39] ||= (e) => J.value.style.showTooltips && Q("setRect", e, "top"),
|
|
2568
|
+
onMouseleave: $,
|
|
2569
|
+
onFocus: t[40] ||= (e) => J.value.style.showTooltips && Q("setRect", e, "top"),
|
|
2570
|
+
onBlur: $
|
|
2571
|
+
}, [b(e.$slots, "icon-rect", le(se({ filled: R.value.rect.filled })), () => [(v(), p("svg", He, [m("rect", {
|
|
2572
|
+
x: "3",
|
|
2573
|
+
y: "3",
|
|
2574
|
+
style: {
|
|
2575
|
+
rx: "0 !important",
|
|
2576
|
+
ry: "0 !important"
|
|
2577
|
+
},
|
|
2578
|
+
height: "6",
|
|
2579
|
+
width: "6",
|
|
2580
|
+
fill: R.value.rect.filled ? (w.value, pn.value + hn.value) : "none",
|
|
2581
|
+
stroke: "currentColor"
|
|
2582
|
+
}, null, 8, Ue)]))], !0), J.value.style.showTooltips ? (v(), d(C, {
|
|
2583
|
+
key: 0,
|
|
2584
|
+
show: W.value && G.value === "setRect",
|
|
2585
|
+
x: K.value.x,
|
|
2586
|
+
y: K.value.y - 6,
|
|
2587
|
+
placement: "top",
|
|
2588
|
+
styleObject: X.value
|
|
2589
|
+
}, {
|
|
2590
|
+
default: S(() => [h(x(J.value.translations.tooltipShapeRect) + " ", 1), t[98] ||= m("kbd", null, "S", -1)]),
|
|
2591
|
+
_: 1
|
|
2592
|
+
}, 8, [
|
|
2593
|
+
"show",
|
|
2594
|
+
"x",
|
|
2595
|
+
"y",
|
|
2596
|
+
"styleObject"
|
|
2597
|
+
])) : f("", !0)], 38),
|
|
2598
|
+
w.value === "rect" ? (v(), p("div", We, [m("label", Ge, [h(x(J.value.translations.filled) + " ", 1), _e(m("input", {
|
|
2599
|
+
type: "checkbox",
|
|
2600
|
+
"onUpdate:modelValue": t[41] ||= (e) => R.value.rect.filled = e,
|
|
2601
|
+
onChange: Er,
|
|
2602
|
+
checked: R.value.rect.filled,
|
|
2603
|
+
style: _({
|
|
2604
|
+
all: "revert",
|
|
2605
|
+
appearance: "auto",
|
|
2606
|
+
"-webkit-appearance": "auto",
|
|
2607
|
+
accentColor: J.value.style.color + " !important"
|
|
2608
|
+
})
|
|
2609
|
+
}, null, 44, Ke), [[me, R.value.rect.filled]])])])) : f("", !0),
|
|
2610
|
+
m("button", {
|
|
2611
|
+
class: g({
|
|
2612
|
+
"button-tool": !0,
|
|
2613
|
+
"button-tool--selected": w.value === "arrow",
|
|
2614
|
+
tooltip: !0
|
|
2615
|
+
}),
|
|
2616
|
+
style: _({
|
|
2617
|
+
background: w.value === "arrow" ? J.value.style.buttons.shapes.selected.backgroundColor : J.value.style.buttons.shapes.backgroundColor,
|
|
2618
|
+
border: w.value === "arrow" ? J.value.style.buttons.shapes.selected.border : J.value.style.buttons.shapes.border,
|
|
2619
|
+
color: w.value === "arrow" ? J.value.style.buttons.shapes.selected.color : J.value.style.buttons.shapes.color,
|
|
2620
|
+
borderRadius: `${J.value.style.buttons.borderRadius}px`,
|
|
2621
|
+
cursor: Y.value ? "pointer" : "default"
|
|
2622
|
+
}),
|
|
2623
|
+
onClick: t[42] ||= (e) => {
|
|
2624
|
+
Pr("arrow"), j.value = !1;
|
|
2625
|
+
},
|
|
2626
|
+
onMouseenter: t[43] ||= (e) => J.value.style.showTooltips && Q("setArrow", e, "top"),
|
|
2627
|
+
onMouseleave: $,
|
|
2628
|
+
onFocus: t[44] ||= (e) => J.value.style.showTooltips && Q("setArrow", e, "top"),
|
|
2629
|
+
onBlur: $
|
|
2630
|
+
}, [b(e.$slots, "icon-arrow", {}, () => [(v(), p("svg", qe, [m("path", {
|
|
2631
|
+
stroke: R.value.arrow.filled ? w.value === "arrow" ? "white" : "grey" : "none",
|
|
2632
|
+
"stroke-width": "2",
|
|
2633
|
+
d: "M5,19 19,5 14,5 19,10.5 19,5",
|
|
2634
|
+
fill: "none",
|
|
2635
|
+
"stroke-linecap": "round",
|
|
2636
|
+
"stroke-linejoin": "round"
|
|
2637
|
+
}, null, 8, Je)]))], !0), J.value.style.showTooltips ? (v(), d(C, {
|
|
2638
|
+
key: 0,
|
|
2639
|
+
show: W.value && G.value === "setArrow",
|
|
2640
|
+
x: K.value.x,
|
|
2641
|
+
y: K.value.y - 6,
|
|
2642
|
+
placement: "top",
|
|
2643
|
+
styleObject: X.value
|
|
2644
|
+
}, {
|
|
2645
|
+
default: S(() => [h(x(J.value.translations.tooltipShapeArrow) + " ", 1), t[99] ||= m("kbd", null, "A", -1)]),
|
|
2646
|
+
_: 1
|
|
2647
|
+
}, 8, [
|
|
2648
|
+
"show",
|
|
2649
|
+
"x",
|
|
2650
|
+
"y",
|
|
2651
|
+
"styleObject"
|
|
2652
|
+
])) : f("", !0)], 38),
|
|
2653
|
+
m("button", {
|
|
2654
|
+
class: g({
|
|
2655
|
+
"button-tool": !0,
|
|
2656
|
+
"button-tool--selected": w.value === "line",
|
|
2657
|
+
tooltip: !0
|
|
2658
|
+
}),
|
|
2659
|
+
style: _({
|
|
2660
|
+
background: w.value === "line" ? J.value.style.buttons.shapes.selected.backgroundColor : J.value.style.buttons.shapes.backgroundColor,
|
|
2661
|
+
border: w.value === "line" ? J.value.style.buttons.shapes.selected.border : J.value.style.buttons.shapes.border,
|
|
2662
|
+
color: w.value === "line" ? J.value.style.buttons.shapes.selected.color : J.value.style.buttons.shapes.color,
|
|
2663
|
+
borderRadius: `${J.value.style.buttons.borderRadius}px`,
|
|
2664
|
+
cursor: Y.value ? "pointer" : "default"
|
|
2665
|
+
}),
|
|
2666
|
+
onClick: t[45] ||= (e) => {
|
|
2667
|
+
Pr("line"), j.value = !1;
|
|
2668
|
+
},
|
|
2669
|
+
onMouseenter: t[46] ||= (e) => J.value.style.showTooltips && Q("setFreehand", e, "top"),
|
|
2670
|
+
onMouseleave: $,
|
|
2671
|
+
onFocus: t[47] ||= (e) => J.value.style.showTooltips && Q("setFreehand", e, "top"),
|
|
2672
|
+
onBlur: $
|
|
2673
|
+
}, [b(e.$slots, "icon-freehand", {}, () => [t[100] ||= m("svg", {
|
|
2674
|
+
width: "80%",
|
|
2675
|
+
viewBox: "0 0 24 24",
|
|
2676
|
+
"stroke-width": "2",
|
|
2677
|
+
stroke: "currentColor",
|
|
2678
|
+
fill: "none",
|
|
2679
|
+
"stroke-linecap": "round",
|
|
2680
|
+
"stroke-linejoin": "round"
|
|
2681
|
+
}, [m("path", {
|
|
2682
|
+
stroke: "none",
|
|
2683
|
+
d: "M0 0h24v24H0z",
|
|
2684
|
+
fill: "none"
|
|
2685
|
+
}), m("path", { d: "M3 15c2 3 4 4 7 4s7 -3 7 -7s-3 -7 -6 -7s-5 1.5 -5 4s2 5 6 5s8.408 -2.453 10 -5" })], -1)], !0), J.value.style.showTooltips ? (v(), d(C, {
|
|
2686
|
+
key: 0,
|
|
2687
|
+
show: W.value && G.value === "setFreehand",
|
|
2688
|
+
x: K.value.x,
|
|
2689
|
+
y: K.value.y - 6,
|
|
2690
|
+
placement: "top",
|
|
2691
|
+
styleObject: X.value
|
|
2692
|
+
}, {
|
|
2693
|
+
default: S(() => [h(x(J.value.translations.tooltipShapeFreehand) + " ", 1), t[101] ||= m("kbd", null, "L", -1)]),
|
|
2694
|
+
_: 1
|
|
2695
|
+
}, 8, [
|
|
2696
|
+
"show",
|
|
2697
|
+
"x",
|
|
2698
|
+
"y",
|
|
2699
|
+
"styleObject"
|
|
2700
|
+
])) : f("", !0)], 38),
|
|
2701
|
+
[
|
|
2702
|
+
"arrow",
|
|
2703
|
+
"circle",
|
|
2704
|
+
"rect",
|
|
2705
|
+
"line"
|
|
2706
|
+
].includes(w.value) ? (v(), p("div", Ye, [m("div", Xe, [m("label", Ze, [h(x(J.value.translations.thickness) + " ", 1), _e(m("input", {
|
|
2707
|
+
type: "number",
|
|
2708
|
+
"onUpdate:modelValue": t[48] ||= (e) => Mt.value = e,
|
|
2709
|
+
onInput: jr,
|
|
2710
|
+
min: 1,
|
|
2711
|
+
style: {
|
|
2712
|
+
padding: "0 4px",
|
|
2713
|
+
width: "40px",
|
|
2714
|
+
border: "1px solid #dadada",
|
|
2715
|
+
"border-radius": "3px"
|
|
2716
|
+
}
|
|
2717
|
+
}, null, 544), [[he, Mt.value]])])])])) : f("", !0),
|
|
2718
|
+
[
|
|
2719
|
+
"arrow",
|
|
2720
|
+
"circle",
|
|
2721
|
+
"rect"
|
|
2722
|
+
].includes(w.value) ? (v(), p("div", Qe, [m("div", $e, [m("label", et, [h(x(J.value.translations.dashedLines) + " ", 1), _e(m("input", {
|
|
2723
|
+
name: "dashStyle",
|
|
2724
|
+
type: "checkbox",
|
|
2725
|
+
"onUpdate:modelValue": t[49] ||= (e) => It.value = e,
|
|
2726
|
+
onChange: kr,
|
|
2727
|
+
checked: It.value,
|
|
2728
|
+
style: _({
|
|
2729
|
+
all: "revert",
|
|
2730
|
+
appearance: "auto",
|
|
2731
|
+
"-webkit-appearance": "auto",
|
|
2732
|
+
accentColor: J.value.style.color + " !important"
|
|
2733
|
+
})
|
|
2734
|
+
}, null, 44, tt), [[me, It.value]])])])])) : f("", !0),
|
|
2735
|
+
m("button", {
|
|
2736
|
+
class: g({
|
|
2737
|
+
"button-tool": !0,
|
|
2738
|
+
"button-tool--selected": N.value,
|
|
2739
|
+
tooltip: !0
|
|
2740
|
+
}),
|
|
2741
|
+
style: _({
|
|
2742
|
+
background: N.value ? J.value.style.buttons.shapes.selected.backgroundColor : J.value.style.buttons.shapes.backgroundColor,
|
|
2743
|
+
border: N.value ? J.value.style.buttons.shapes.selected.border : J.value.style.buttons.shapes.border,
|
|
2744
|
+
color: N.value ? J.value.style.buttons.shapes.selected.color : J.value.style.buttons.shapes.color,
|
|
2745
|
+
borderRadius: `${J.value.style.buttons.borderRadius}px`,
|
|
2746
|
+
cursor: Y.value ? "pointer" : "default"
|
|
2747
|
+
}),
|
|
2748
|
+
onClick: t[50] ||= (e) => {
|
|
2749
|
+
Yn(), N.value = !N.value, D.value = !1, k.value = !1, A.value = !1, j.value = !1, O.value = !1, w.value = void 0;
|
|
2750
|
+
},
|
|
2751
|
+
onMouseenter: t[51] ||= (e) => J.value.style.showTooltips && Q("setText", e, "top"),
|
|
2752
|
+
onMouseleave: $,
|
|
2753
|
+
onFocus: t[52] ||= (e) => J.value.style.showTooltips && Q("setText", e, "top"),
|
|
2754
|
+
onBlur: $
|
|
2755
|
+
}, [b(e.$slots, "icon-text", le(se({ active: N.value })), () => [oe(u, {
|
|
2756
|
+
name: "text",
|
|
2757
|
+
stroke: N.value ? J.value.style.buttons.shapes.selected.color : J.value.style.buttons.shapes.color
|
|
2758
|
+
}, null, 8, ["stroke"])], !0), J.value.style.showTooltips ? (v(), d(C, {
|
|
2759
|
+
key: 0,
|
|
2760
|
+
show: W.value && G.value === "setText",
|
|
2761
|
+
x: K.value.x,
|
|
2762
|
+
y: K.value.y - 6,
|
|
2763
|
+
placement: "top",
|
|
2764
|
+
styleObject: X.value
|
|
2765
|
+
}, {
|
|
2766
|
+
default: S(() => [h(x(J.value.translations.tooltipShapeText) + " ", 1), t[102] ||= m("kbd", null, "T", -1)]),
|
|
2767
|
+
_: 1
|
|
2768
|
+
}, 8, [
|
|
2769
|
+
"show",
|
|
2770
|
+
"x",
|
|
2771
|
+
"y",
|
|
2772
|
+
"styleObject"
|
|
2773
|
+
])) : f("", !0)], 38),
|
|
2774
|
+
N.value ? (v(), p("div", nt, [m("div", rt, [m("label", it, [h(x(J.value.translations.fontSize) + " ", 1), _e(m("input", {
|
|
2775
|
+
type: "number",
|
|
2776
|
+
"onUpdate:modelValue": t[53] ||= (e) => Qt.value = e,
|
|
2777
|
+
onInput: Mr,
|
|
2778
|
+
style: {
|
|
2779
|
+
padding: "0 4px",
|
|
2780
|
+
width: "40px",
|
|
2781
|
+
border: "1px solid #dadada",
|
|
2782
|
+
"border-radius": "3px"
|
|
2783
|
+
}
|
|
2784
|
+
}, null, 544), [[he, Qt.value]])])])])) : f("", !0),
|
|
2785
|
+
N.value ? (v(), p("div", at, [m("button", {
|
|
2786
|
+
class: g({
|
|
2787
|
+
"button-tool": !0,
|
|
2788
|
+
"button-tool--selected": B.value === "start",
|
|
2789
|
+
tooltip: !0
|
|
2790
|
+
}),
|
|
2791
|
+
style: _({
|
|
2792
|
+
background: B.value === "start" ? J.value.style.buttons.shapes.selected.backgroundColor : J.value.style.buttons.shapes.backgroundColor,
|
|
2793
|
+
border: B.value === "start" ? J.value.style.buttons.shapes.selected.border : J.value.style.buttons.shapes.border,
|
|
2794
|
+
color: B.value === "start" ? J.value.style.buttons.shapes.selected.color : J.value.style.buttons.shapes.color,
|
|
2795
|
+
borderRadius: `${J.value.style.buttons.borderRadius}px`,
|
|
2796
|
+
cursor: Y.value ? "pointer" : "default"
|
|
2797
|
+
}),
|
|
2798
|
+
onClick: t[54] ||= (e) => {
|
|
2799
|
+
D.value = !1, k.value = !1, A.value = !1, O.value = !1, j.value = !1, w.value = void 0, B.value = "start", $n("start");
|
|
2800
|
+
},
|
|
2801
|
+
onMouseenter: t[55] ||= (e) => J.value.style.showTooltips && Q("setAlignStart", e, "top"),
|
|
2802
|
+
onMouseleave: $,
|
|
2803
|
+
onFocus: t[56] ||= (e) => J.value.style.showTooltips && Q("setAlignStart", e, "top"),
|
|
2804
|
+
onBlur: $
|
|
2805
|
+
}, [b(e.$slots, "icon-text-align-left", {}, () => [t[103] ||= m("svg", {
|
|
2806
|
+
width: "80%",
|
|
2807
|
+
viewBox: "0 0 24 24",
|
|
2808
|
+
"stroke-width": "2",
|
|
2809
|
+
stroke: "currentColor",
|
|
2810
|
+
fill: "none",
|
|
2811
|
+
"stroke-linecap": "round",
|
|
2812
|
+
"stroke-linejoin": "round"
|
|
2813
|
+
}, [
|
|
2814
|
+
m("path", {
|
|
2815
|
+
stroke: "none",
|
|
2816
|
+
d: "M0 0h24v24H0z",
|
|
2817
|
+
fill: "none"
|
|
2818
|
+
}),
|
|
2819
|
+
m("path", { d: "M4 6l16 0" }),
|
|
2820
|
+
m("path", { d: "M4 12l10 0" }),
|
|
2821
|
+
m("path", { d: "M4 18l14 0" })
|
|
2822
|
+
], -1)], !0), J.value.style.showTooltips ? (v(), d(C, {
|
|
2823
|
+
key: 0,
|
|
2824
|
+
show: W.value && G.value === "setAlignStart",
|
|
2825
|
+
x: K.value.x,
|
|
2826
|
+
y: K.value.y - 6,
|
|
2827
|
+
placement: "top",
|
|
2828
|
+
styleObject: X.value
|
|
2829
|
+
}, {
|
|
2830
|
+
default: S(() => [h(x(J.value.translations.tooltipShapeTextLeft), 1)]),
|
|
2831
|
+
_: 1
|
|
2832
|
+
}, 8, [
|
|
2833
|
+
"show",
|
|
2834
|
+
"x",
|
|
2835
|
+
"y",
|
|
2836
|
+
"styleObject"
|
|
2837
|
+
])) : f("", !0)], 38)])) : f("", !0),
|
|
2838
|
+
N.value ? (v(), p("div", ot, [m("button", {
|
|
2839
|
+
class: g({
|
|
2840
|
+
"button-tool": !0,
|
|
2841
|
+
"button-tool--selected": B.value === "middle",
|
|
2842
|
+
tooltip: !0
|
|
2843
|
+
}),
|
|
2844
|
+
style: _({
|
|
2845
|
+
background: B.value === "middle" ? J.value.style.buttons.shapes.selected.backgroundColor : J.value.style.buttons.shapes.backgroundColor,
|
|
2846
|
+
border: B.value === "middle" ? J.value.style.buttons.shapes.selected.border : J.value.style.buttons.shapes.border,
|
|
2847
|
+
color: B.value === "middle" ? J.value.style.buttons.shapes.selected.color : J.value.style.buttons.shapes.color,
|
|
2848
|
+
borderRadius: `${J.value.style.buttons.borderRadius}px`,
|
|
2849
|
+
cursor: Y.value ? "pointer" : "default"
|
|
2850
|
+
}),
|
|
2851
|
+
disabled: Ft.value,
|
|
2852
|
+
onClick: t[57] ||= (e) => {
|
|
2853
|
+
D.value = !1, k.value = !1, A.value = !1, O.value = !1, j.value = !1, w.value = void 0, B.value = "middle", $n("middle");
|
|
2854
|
+
},
|
|
2855
|
+
onMouseenter: t[58] ||= (e) => J.value.style.showTooltips && Q("setAlignMiddle", e, "top"),
|
|
2856
|
+
onMouseleave: $,
|
|
2857
|
+
onFocus: t[59] ||= (e) => J.value.style.showTooltips && Q("setAlignMiddle", e, "top"),
|
|
2858
|
+
onBlur: $
|
|
2859
|
+
}, [b(e.$slots, "icon-text-align-center", {}, () => [t[104] ||= m("svg", {
|
|
2860
|
+
width: "80%",
|
|
2861
|
+
viewBox: "0 0 24 24",
|
|
2862
|
+
"stroke-width": "2",
|
|
2863
|
+
stroke: "currentColor",
|
|
2864
|
+
fill: "none",
|
|
2865
|
+
"stroke-linecap": "round",
|
|
2866
|
+
"stroke-linejoin": "round"
|
|
2867
|
+
}, [
|
|
2868
|
+
m("path", {
|
|
2869
|
+
stroke: "none",
|
|
2870
|
+
d: "M0 0h24v24H0z",
|
|
2871
|
+
fill: "none"
|
|
2872
|
+
}),
|
|
2873
|
+
m("path", { d: "M4 6l16 0" }),
|
|
2874
|
+
m("path", { d: "M8 12l8 0" }),
|
|
2875
|
+
m("path", { d: "M6 18l12 0" })
|
|
2876
|
+
], -1)], !0), J.value.style.showTooltips ? (v(), d(C, {
|
|
2877
|
+
key: 0,
|
|
2878
|
+
show: W.value && G.value === "setAlignMiddle",
|
|
2879
|
+
x: K.value.x,
|
|
2880
|
+
y: K.value.y - 6,
|
|
2881
|
+
placement: "top",
|
|
2882
|
+
styleObject: X.value
|
|
2883
|
+
}, {
|
|
2884
|
+
default: S(() => [h(x(J.value.translations.tooltipShapeTextCenter), 1)]),
|
|
2885
|
+
_: 1
|
|
2886
|
+
}, 8, [
|
|
2887
|
+
"show",
|
|
2888
|
+
"x",
|
|
2889
|
+
"y",
|
|
2890
|
+
"styleObject"
|
|
2891
|
+
])) : f("", !0)], 46, st)])) : f("", !0),
|
|
2892
|
+
N.value ? (v(), p("div", ct, [m("button", {
|
|
2893
|
+
class: g({
|
|
2894
|
+
"button-tool": !0,
|
|
2895
|
+
"button-tool--selected": B.value === "end",
|
|
2896
|
+
tooltip: !0
|
|
2897
|
+
}),
|
|
2898
|
+
style: _({
|
|
2899
|
+
background: B.value === "end" ? J.value.style.buttons.shapes.selected.backgroundColor : J.value.style.buttons.shapes.backgroundColor,
|
|
2900
|
+
border: B.value === "end" ? J.value.style.buttons.shapes.selected.border : J.value.style.buttons.shapes.border,
|
|
2901
|
+
color: B.value === "end" ? J.value.style.buttons.shapes.selected.color : J.value.style.buttons.shapes.color,
|
|
2902
|
+
borderRadius: `${J.value.style.buttons.borderRadius}px`,
|
|
2903
|
+
cursor: Y.value ? "pointer" : "default"
|
|
2904
|
+
}),
|
|
2905
|
+
disabled: Ft.value,
|
|
2906
|
+
onClick: t[60] ||= (e) => {
|
|
2907
|
+
D.value = !1, k.value = !1, A.value = !1, O.value = !1, j.value = !1, w.value = void 0, B.value = "end", $n("end");
|
|
2908
|
+
},
|
|
2909
|
+
onMouseenter: t[61] ||= (e) => J.value.style.showTooltips && Q("setAlignEnd", e, "top"),
|
|
2910
|
+
onMouseleave: $,
|
|
2911
|
+
onFocus: t[62] ||= (e) => J.value.style.showTooltips && Q("setAlignEnd", e, "top"),
|
|
2912
|
+
onBlur: $
|
|
2913
|
+
}, [b(e.$slots, "icon-text-align-right", {}, () => [t[105] ||= m("svg", {
|
|
2914
|
+
width: "80%",
|
|
2915
|
+
viewBox: "0 0 24 24",
|
|
2916
|
+
"stroke-width": "2",
|
|
2917
|
+
stroke: "currentColor",
|
|
2918
|
+
fill: "none",
|
|
2919
|
+
"stroke-linecap": "round",
|
|
2920
|
+
"stroke-linejoin": "round"
|
|
2921
|
+
}, [
|
|
2922
|
+
m("path", {
|
|
2923
|
+
stroke: "none",
|
|
2924
|
+
d: "M0 0h24v24H0z",
|
|
2925
|
+
fill: "none"
|
|
2926
|
+
}),
|
|
2927
|
+
m("path", { d: "M4 6l16 0" }),
|
|
2928
|
+
m("path", { d: "M10 12l10 0" }),
|
|
2929
|
+
m("path", { d: "M6 18l14 0" })
|
|
2930
|
+
], -1)], !0), J.value.style.showTooltips ? (v(), d(C, {
|
|
2931
|
+
key: 0,
|
|
2932
|
+
show: W.value && G.value === "setAlignEnd",
|
|
2933
|
+
x: K.value.x,
|
|
2934
|
+
y: K.value.y - 6,
|
|
2935
|
+
placement: "top",
|
|
2936
|
+
styleObject: X.value
|
|
2937
|
+
}, {
|
|
2938
|
+
default: S(() => [h(x(J.value.translations.tooltipShapeTextRight), 1)]),
|
|
2939
|
+
_: 1
|
|
2940
|
+
}, 8, [
|
|
2941
|
+
"show",
|
|
2942
|
+
"x",
|
|
2943
|
+
"y",
|
|
2944
|
+
"styleObject"
|
|
2945
|
+
])) : f("", !0)], 46, lt)])) : f("", !0),
|
|
2946
|
+
N.value ? (v(), p("div", ut, [m("button", {
|
|
2947
|
+
class: g({
|
|
2948
|
+
"button-tool": !0,
|
|
2949
|
+
"button-tool--selected": Ft.value,
|
|
2950
|
+
tooltip: !0
|
|
2951
|
+
}),
|
|
2952
|
+
style: _({
|
|
2953
|
+
background: Ft.value ? J.value.style.buttons.shapes.selected.backgroundColor : J.value.style.buttons.shapes.backgroundColor,
|
|
2954
|
+
border: Ft.value ? J.value.style.buttons.shapes.selected.border : J.value.style.buttons.shapes.border,
|
|
2955
|
+
color: Ft.value ? J.value.style.buttons.shapes.selected.color : J.value.style.buttons.shapes.color,
|
|
2956
|
+
borderRadius: `${J.value.style.buttons.borderRadius}px`,
|
|
2957
|
+
cursor: Y.value ? "pointer" : "default"
|
|
2958
|
+
}),
|
|
2959
|
+
onClick: t[63] ||= (e) => {
|
|
2960
|
+
D.value = !1, k.value = !1, A.value = !1, O.value = !1, j.value = !1, w.value = void 0, Ft.value = !Ft.value, B.value = "start", $n("start"), Mr();
|
|
2961
|
+
},
|
|
2962
|
+
onMouseenter: t[64] ||= (e) => J.value.style.showTooltips && Q("setBulletMode", e, "top"),
|
|
2963
|
+
onMouseleave: $,
|
|
2964
|
+
onFocus: t[65] ||= (e) => J.value.style.showTooltips && Q("setBulletMode", e, "top"),
|
|
2965
|
+
onBlur: $
|
|
2966
|
+
}, [b(e.$slots, "icon-text-bullet-points", {}, () => [t[106] ||= m("svg", {
|
|
2967
|
+
width: "100%",
|
|
2968
|
+
viewBox: "0 0 24 24",
|
|
2969
|
+
"stroke-width": "2",
|
|
2970
|
+
stroke: "currentColor",
|
|
2971
|
+
fill: "none",
|
|
2972
|
+
"stroke-linecap": "round",
|
|
2973
|
+
"stroke-linejoin": "round"
|
|
2974
|
+
}, [
|
|
2975
|
+
m("path", {
|
|
2976
|
+
stroke: "none",
|
|
2977
|
+
d: "M0 0h24v24H0z",
|
|
2978
|
+
fill: "none"
|
|
2979
|
+
}),
|
|
2980
|
+
m("path", { d: "M9 6l11 0" }),
|
|
2981
|
+
m("path", { d: "M9 12l11 0" }),
|
|
2982
|
+
m("path", { d: "M9 18l11 0" }),
|
|
2983
|
+
m("path", { d: "M5 6l0 .01" }),
|
|
2984
|
+
m("path", { d: "M5 12l0 .01" }),
|
|
2985
|
+
m("path", { d: "M5 18l0 .01" })
|
|
2986
|
+
], -1)], !0), J.value.style.showTooltips ? (v(), d(C, {
|
|
2987
|
+
key: 0,
|
|
2988
|
+
show: W.value && G.value === "setBulletMode",
|
|
2989
|
+
x: K.value.x,
|
|
2990
|
+
y: K.value.y - 6,
|
|
2991
|
+
placement: "top",
|
|
2992
|
+
styleObject: X.value
|
|
2993
|
+
}, {
|
|
2994
|
+
default: S(() => [h(x(J.value.translations.tooltipShapeTextBullet), 1)]),
|
|
2995
|
+
_: 1
|
|
2996
|
+
}, 8, [
|
|
2997
|
+
"show",
|
|
2998
|
+
"x",
|
|
2999
|
+
"y",
|
|
3000
|
+
"styleObject"
|
|
3001
|
+
])) : f("", !0)], 38)])) : f("", !0),
|
|
3002
|
+
N.value ? (v(), p("div", dt, [m("button", {
|
|
3003
|
+
class: g({
|
|
3004
|
+
"button-tool": !0,
|
|
3005
|
+
"button-tool--selected": Pt.value,
|
|
3006
|
+
tooltip: !0
|
|
3007
|
+
}),
|
|
3008
|
+
style: _({
|
|
3009
|
+
background: Pt.value ? J.value.style.buttons.shapes.selected.backgroundColor : J.value.style.buttons.shapes.backgroundColor,
|
|
3010
|
+
border: Pt.value ? J.value.style.buttons.shapes.selected.border : J.value.style.buttons.shapes.border,
|
|
3011
|
+
color: Pt.value ? J.value.style.buttons.shapes.selected.color : J.value.style.buttons.shapes.color,
|
|
3012
|
+
borderRadius: `${J.value.style.buttons.borderRadius}px`,
|
|
3013
|
+
cursor: Y.value ? "pointer" : "default"
|
|
3014
|
+
}),
|
|
3015
|
+
onClick: t[66] ||= (e) => {
|
|
3016
|
+
D.value = !1, k.value = !1, A.value = !1, O.value = !1, j.value = !1, w.value = void 0, Pt.value = !Pt.value, Mr();
|
|
3017
|
+
},
|
|
3018
|
+
onMouseenter: t[67] ||= (e) => J.value.style.showTooltips && Q("setBold", e, "top"),
|
|
3019
|
+
onMouseleave: $,
|
|
3020
|
+
onFocus: t[68] ||= (e) => J.value.style.showTooltips && Q("setBold", e, "top"),
|
|
3021
|
+
onBlur: $
|
|
3022
|
+
}, [b(e.$slots, "icon-text-bold", {}, () => [t[107] ||= m("svg", {
|
|
3023
|
+
width: "100%",
|
|
3024
|
+
viewBox: "0 0 24 24",
|
|
3025
|
+
"stroke-width": "3",
|
|
3026
|
+
stroke: "currentColor",
|
|
3027
|
+
fill: "none",
|
|
3028
|
+
"stroke-linecap": "round",
|
|
3029
|
+
"stroke-linejoin": "round"
|
|
3030
|
+
}, [
|
|
3031
|
+
m("path", {
|
|
3032
|
+
stroke: "none",
|
|
3033
|
+
d: "M0 0h24v24H0z",
|
|
3034
|
+
fill: "none"
|
|
3035
|
+
}),
|
|
3036
|
+
m("path", { d: "M7 5h6a3.5 3.5 0 0 1 0 7h-6z" }),
|
|
3037
|
+
m("path", { d: "M13 12h1a3.5 3.5 0 0 1 0 7h-7v-7" })
|
|
3038
|
+
], -1)], !0), J.value.style.showTooltips ? (v(), d(C, {
|
|
3039
|
+
key: 0,
|
|
3040
|
+
show: W.value && G.value === "setBold",
|
|
3041
|
+
x: K.value.x,
|
|
3042
|
+
y: K.value.y - 6,
|
|
3043
|
+
placement: "top",
|
|
3044
|
+
styleObject: X.value
|
|
3045
|
+
}, {
|
|
3046
|
+
default: S(() => [h(x(J.value.translations.tooltipShapeTextBold), 1)]),
|
|
3047
|
+
_: 1
|
|
3048
|
+
}, 8, [
|
|
3049
|
+
"show",
|
|
3050
|
+
"x",
|
|
3051
|
+
"y",
|
|
3052
|
+
"styleObject"
|
|
3053
|
+
])) : f("", !0)], 38)])) : f("", !0),
|
|
3054
|
+
N.value ? (v(), p("div", ft, [m("button", {
|
|
3055
|
+
class: g({
|
|
3056
|
+
"button-tool": !0,
|
|
3057
|
+
"button-tool--selected": zt.value,
|
|
3058
|
+
tooltip: !0
|
|
3059
|
+
}),
|
|
3060
|
+
style: _({
|
|
3061
|
+
background: zt.value ? J.value.style.buttons.shapes.selected.backgroundColor : J.value.style.buttons.shapes.backgroundColor,
|
|
3062
|
+
border: zt.value ? J.value.style.buttons.shapes.selected.border : J.value.style.buttons.shapes.border,
|
|
3063
|
+
color: zt.value ? J.value.style.buttons.shapes.selected.color : J.value.style.buttons.shapes.color,
|
|
3064
|
+
borderRadius: `${J.value.style.buttons.borderRadius}px`,
|
|
3065
|
+
cursor: Y.value ? "pointer" : "default"
|
|
3066
|
+
}),
|
|
3067
|
+
onClick: t[69] ||= (e) => {
|
|
3068
|
+
D.value = !1, k.value = !1, A.value = !1, O.value = !1, j.value = !1, w.value = void 0, zt.value = !zt.value, Mr();
|
|
3069
|
+
},
|
|
3070
|
+
onMouseenter: t[70] ||= (e) => J.value.style.showTooltips && Q("setItalic", e, "top"),
|
|
3071
|
+
onMouseleave: $,
|
|
3072
|
+
onFocus: t[71] ||= (e) => J.value.style.showTooltips && Q("setItalic", e, "top"),
|
|
3073
|
+
onBlur: $
|
|
3074
|
+
}, [b(e.$slots, "icon-text-italic", {}, () => [t[108] ||= m("svg", {
|
|
3075
|
+
width: "100%",
|
|
3076
|
+
height: "44",
|
|
3077
|
+
viewBox: "0 0 24 24",
|
|
3078
|
+
"stroke-width": "2",
|
|
3079
|
+
stroke: "currentColor",
|
|
3080
|
+
fill: "none",
|
|
3081
|
+
"stroke-linecap": "round",
|
|
3082
|
+
"stroke-linejoin": "round"
|
|
3083
|
+
}, [
|
|
3084
|
+
m("path", {
|
|
3085
|
+
stroke: "none",
|
|
3086
|
+
d: "M0 0h24v24H0z",
|
|
3087
|
+
fill: "none"
|
|
3088
|
+
}),
|
|
3089
|
+
m("path", { d: "M11 5l6 0" }),
|
|
3090
|
+
m("path", { d: "M7 19l6 0" }),
|
|
3091
|
+
m("path", { d: "M14 5l-4 14" })
|
|
3092
|
+
], -1)], !0), J.value.style.showTooltips ? (v(), d(C, {
|
|
3093
|
+
key: 0,
|
|
3094
|
+
show: W.value && G.value === "setItalic",
|
|
3095
|
+
x: K.value.x,
|
|
3096
|
+
y: K.value.y - 6,
|
|
3097
|
+
placement: "top",
|
|
3098
|
+
styleObject: X.value
|
|
3099
|
+
}, {
|
|
3100
|
+
default: S(() => [h(x(J.value.translations.tooltipShapeTextItalic), 1)]),
|
|
3101
|
+
_: 1
|
|
3102
|
+
}, 8, [
|
|
3103
|
+
"show",
|
|
3104
|
+
"x",
|
|
3105
|
+
"y",
|
|
3106
|
+
"styleObject"
|
|
3107
|
+
])) : f("", !0)], 38)])) : f("", !0),
|
|
3108
|
+
N.value ? (v(), p("div", pt, [m("button", {
|
|
3109
|
+
class: g({
|
|
3110
|
+
"button-tool": !0,
|
|
3111
|
+
"button-tool--selected": Ht.value,
|
|
3112
|
+
tooltip: !0
|
|
3113
|
+
}),
|
|
3114
|
+
style: _({
|
|
3115
|
+
background: Ht.value ? J.value.style.buttons.shapes.selected.backgroundColor : J.value.style.buttons.shapes.backgroundColor,
|
|
3116
|
+
border: Ht.value ? J.value.style.buttons.shapes.selected.border : J.value.style.buttons.shapes.border,
|
|
3117
|
+
color: Ht.value ? J.value.style.buttons.shapes.selected.color : J.value.style.buttons.shapes.color,
|
|
3118
|
+
borderRadius: `${J.value.style.buttons.borderRadius}px`,
|
|
3119
|
+
cursor: Y.value ? "pointer" : "default"
|
|
3120
|
+
}),
|
|
3121
|
+
onClick: t[72] ||= (e) => {
|
|
3122
|
+
D.value = !1, k.value = !1, A.value = !1, O.value = !1, j.value = !1, w.value = void 0, Ht.value = !Ht.value, Mr();
|
|
3123
|
+
},
|
|
3124
|
+
onMouseenter: t[73] ||= (e) => J.value.style.showTooltips && Q("setUnderline", e, "top"),
|
|
3125
|
+
onMouseleave: $,
|
|
3126
|
+
onFocus: t[74] ||= (e) => J.value.style.showTooltips && Q("setUnderline", e, "top"),
|
|
3127
|
+
onBlur: $
|
|
3128
|
+
}, [b(e.$slots, "icon-text-underline", {}, () => [t[109] ||= m("svg", {
|
|
3129
|
+
width: "100%",
|
|
3130
|
+
viewBox: "0 0 24 24",
|
|
3131
|
+
"stroke-width": "2",
|
|
3132
|
+
stroke: "currentColor",
|
|
3133
|
+
fill: "none",
|
|
3134
|
+
"stroke-linecap": "round",
|
|
3135
|
+
"stroke-linejoin": "round"
|
|
3136
|
+
}, [
|
|
3137
|
+
m("path", {
|
|
3138
|
+
stroke: "none",
|
|
3139
|
+
d: "M0 0h24v24H0z",
|
|
3140
|
+
fill: "none"
|
|
3141
|
+
}),
|
|
3142
|
+
m("path", { d: "M7 5v5a5 5 0 0 0 10 0v-5" }),
|
|
3143
|
+
m("path", { d: "M5 19h14" })
|
|
3144
|
+
], -1)], !0), J.value.style.showTooltips ? (v(), d(C, {
|
|
3145
|
+
key: 0,
|
|
3146
|
+
show: W.value && G.value === "setUnderline",
|
|
3147
|
+
x: K.value.x,
|
|
3148
|
+
y: K.value.y - 6,
|
|
3149
|
+
placement: "top",
|
|
3150
|
+
styleObject: X.value
|
|
3151
|
+
}, {
|
|
3152
|
+
default: S(() => [h(x(J.value.translations.tooltipShapeTextUnderline), 1)]),
|
|
3153
|
+
_: 1
|
|
3154
|
+
}, 8, [
|
|
3155
|
+
"show",
|
|
3156
|
+
"x",
|
|
3157
|
+
"y",
|
|
3158
|
+
"styleObject"
|
|
3159
|
+
])) : f("", !0)], 38)])) : f("", !0),
|
|
3160
|
+
m("div", mt, [m("button", {
|
|
3161
|
+
class: g({
|
|
3162
|
+
"button-tool": !0,
|
|
3163
|
+
tooltip: !0
|
|
3164
|
+
}),
|
|
3165
|
+
style: { borderRadius: "6px" },
|
|
3166
|
+
onMouseenter: t[77] ||= (e) => J.value.style.showTooltips && Q("setColor", e, "top"),
|
|
3167
|
+
onMouseleave: $,
|
|
3168
|
+
onFocus: t[78] ||= (e) => J.value.style.showTooltips && Q("setColor", e, "top"),
|
|
3169
|
+
onBlur: $
|
|
3170
|
+
}, [oe(ne, {
|
|
3171
|
+
value: pn.value,
|
|
3172
|
+
"onUpdate:value": [t[75] ||= (e) => pn.value = e, t[76] ||= (e) => Or(e)],
|
|
3173
|
+
backgroundColor: J.value.style.backgroundColor,
|
|
3174
|
+
buttonBorderColor: J.value.style.color,
|
|
3175
|
+
isCursorPointer: Y.value,
|
|
3176
|
+
palette: J.value.style.palette,
|
|
3177
|
+
teleported: ""
|
|
3178
|
+
}, {
|
|
3179
|
+
"annotator-action-color": S(({ color: t }) => [b(e.$slots, "icon-color", le(se({
|
|
3180
|
+
color: t,
|
|
3181
|
+
backgroundColor: pn.value
|
|
3182
|
+
})), void 0, !0)]),
|
|
3183
|
+
_: 3
|
|
3184
|
+
}, 8, [
|
|
3185
|
+
"value",
|
|
3186
|
+
"backgroundColor",
|
|
3187
|
+
"buttonBorderColor",
|
|
3188
|
+
"isCursorPointer",
|
|
3189
|
+
"palette"
|
|
3190
|
+
])], 32), J.value.style.showTooltips ? (v(), d(C, {
|
|
3191
|
+
key: 0,
|
|
3192
|
+
show: W.value && G.value === "setColor",
|
|
3193
|
+
x: K.value.x,
|
|
3194
|
+
y: K.value.y - 6,
|
|
3195
|
+
placement: "top",
|
|
3196
|
+
styleObject: X.value
|
|
3197
|
+
}, {
|
|
3198
|
+
default: S(() => [h(x(J.value.translations.tooltipShapeColor), 1)]),
|
|
3199
|
+
_: 1
|
|
3200
|
+
}, 8, [
|
|
3201
|
+
"show",
|
|
3202
|
+
"x",
|
|
3203
|
+
"y",
|
|
3204
|
+
"styleObject"
|
|
3205
|
+
])) : f("", !0)]),
|
|
3206
|
+
m("div", ht, [m("label", gt, [h(x(J.value.translations.colorAlpha) + ": " + x($t.value > 98 ? 100 : $t.value) + " % ", 1), _e(m("input", {
|
|
3207
|
+
name: "colorTransparency",
|
|
3208
|
+
type: "range",
|
|
3209
|
+
"onUpdate:modelValue": t[79] ||= (e) => $t.value = e,
|
|
3210
|
+
onInput: Ar,
|
|
3211
|
+
min: 0,
|
|
3212
|
+
max: 100,
|
|
3213
|
+
style: _({
|
|
3214
|
+
width: "100%",
|
|
3215
|
+
accentColor: J.value.style.color + " !important"
|
|
3216
|
+
})
|
|
3217
|
+
}, null, 36), [[he, $t.value]])])])
|
|
3218
|
+
])])], 8, ["to"])) : f("", !0)
|
|
3219
|
+
]), m("div", {
|
|
3220
|
+
class: "annotator annotator__wrapper",
|
|
3221
|
+
ref_key: "drawSvgContainer",
|
|
3222
|
+
ref: Sr,
|
|
3223
|
+
style: { position: "relative" },
|
|
3224
|
+
id: kt.value,
|
|
3225
|
+
"data-annotator-content": ""
|
|
3226
|
+
}, [
|
|
3227
|
+
m("div", {
|
|
3228
|
+
class: "annotator__content-layer",
|
|
3229
|
+
style: _(`${M.value ? "pointer-events: none;" : ""}`)
|
|
3230
|
+
}, [b(e.$slots, "default", {}, void 0, !0)], 4),
|
|
3231
|
+
M.value || J.value.alwaysVisible ? (v(), p("svg", {
|
|
3232
|
+
id: "annotatorSvg",
|
|
3233
|
+
key: Gt.value,
|
|
3234
|
+
ref_key: "mainSvg",
|
|
3235
|
+
ref: vn,
|
|
3236
|
+
class: g({
|
|
3237
|
+
annotator__overlay: !0,
|
|
3238
|
+
"annotator__overlay--inactive": !M.value,
|
|
3239
|
+
draw: !0,
|
|
3240
|
+
"draw--free": w.value === "line"
|
|
3241
|
+
}),
|
|
3242
|
+
viewBox: `0 0 ${qt.value} ${Kt.value}`,
|
|
3243
|
+
width: Xt.value,
|
|
3244
|
+
height: Zt.value,
|
|
3245
|
+
onPointerdown: t[83] ||= (e) => fr(e),
|
|
3246
|
+
onPointerup: t[84] ||= (e) => Tr(e),
|
|
3247
|
+
onTouchend: t[85] ||= (e) => Tr(e),
|
|
3248
|
+
onTouchstart: t[86] ||= (e) => Nr(e),
|
|
3249
|
+
onPointermove: t[87] ||= (e) => {
|
|
3250
|
+
Nr(e), gr(e);
|
|
3251
|
+
},
|
|
3252
|
+
onPointerout: t[88] ||= (e) => ur(e),
|
|
3253
|
+
onPointerover: t[89] ||= (e) => Gn(e),
|
|
3254
|
+
onClick: t[90] ||= (e) => Qn(e),
|
|
3255
|
+
style: _({
|
|
3256
|
+
position: "absolute",
|
|
3257
|
+
top: 0,
|
|
3258
|
+
left: 0,
|
|
3259
|
+
cursor: gn.value,
|
|
3260
|
+
fontFamily: "Helvetica",
|
|
3261
|
+
zIndex: 1e8,
|
|
3262
|
+
pointerEvents: M.value ? "all" : "none"
|
|
3263
|
+
})
|
|
3264
|
+
}, [
|
|
3265
|
+
m("rect", {
|
|
3266
|
+
class: "annotator__glass",
|
|
3267
|
+
x: "0",
|
|
3268
|
+
y: "0",
|
|
3269
|
+
width: qt.value,
|
|
3270
|
+
height: Kt.value,
|
|
3271
|
+
fill: "transparent",
|
|
3272
|
+
"pointer-events": M.value ? "all" : "none",
|
|
3273
|
+
style: { cursor: "inherit" },
|
|
3274
|
+
onPointerdown: t[80] ||= ve((e) => fr(e), ["stop", "prevent"]),
|
|
3275
|
+
onPointermove: t[81] ||= ve((e) => {
|
|
3276
|
+
Nr(e), gr(e);
|
|
3277
|
+
}, ["stop", "prevent"]),
|
|
3278
|
+
onPointerup: ve(Tr, ["stop", "prevent"]),
|
|
3279
|
+
onClick: t[82] ||= ve((e) => Qn(e), ["stop", "prevent"])
|
|
3280
|
+
}, null, 40, yt),
|
|
3281
|
+
(v(!0), p(re, null, fe(Mn.value, (e) => (v(), p("g", {
|
|
3282
|
+
key: e.id,
|
|
3283
|
+
innerHTML: e.html,
|
|
3284
|
+
style: _({ pointerEvents: M.value ? null : "none" }),
|
|
3285
|
+
onClick: (t) => xr(t, e.id),
|
|
3286
|
+
onDblclick: ve((t) => br(t, e.id), ["stop", "prevent"])
|
|
3287
|
+
}, null, 44, bt))), 128)),
|
|
3288
|
+
U.value && P.value ? (v(), p("line", {
|
|
3289
|
+
key: 0,
|
|
3290
|
+
class: "vue-ui-annotator-caret",
|
|
3291
|
+
x1: U.value.x,
|
|
3292
|
+
x2: U.value.x,
|
|
3293
|
+
y1: U.value.y1,
|
|
3294
|
+
y2: U.value.y2,
|
|
3295
|
+
stroke: U.value.color,
|
|
3296
|
+
"stroke-width": "2",
|
|
3297
|
+
"pointer-events": "none",
|
|
3298
|
+
"vector-effect": "non-scaling-stroke"
|
|
3299
|
+
}, null, 8, xt)) : f("", !0)
|
|
3300
|
+
], 46, vt)) : f("", !0),
|
|
3301
|
+
Vt.value || pe(At) ? (v(), p("svg", {
|
|
3302
|
+
key: 1,
|
|
3303
|
+
style: {
|
|
3304
|
+
position: "absolute",
|
|
3305
|
+
top: "0",
|
|
3306
|
+
left: "0"
|
|
3307
|
+
},
|
|
3308
|
+
height: Zt.value,
|
|
3309
|
+
viewBox: `0 0 ${qt.value} ${Kt.value}`,
|
|
3310
|
+
width: Xt.value,
|
|
3311
|
+
"data-dom-to-png-ignore": ""
|
|
3312
|
+
}, [m("circle", {
|
|
3313
|
+
class: "animated-circle-print",
|
|
3314
|
+
cx: qt.value / 2,
|
|
3315
|
+
cy: Kt.value / 2,
|
|
3316
|
+
r: "50",
|
|
3317
|
+
stroke: "#6376DD",
|
|
3318
|
+
"stroke-width": "10",
|
|
3319
|
+
fill: "none"
|
|
3320
|
+
}, null, 8, Ct)], 8, St)) : f("", !0)
|
|
3321
|
+
], 8, _t)]));
|
|
3322
|
+
}
|
|
3323
|
+
}, [["__scopeId", "data-v-c9b9850e"]]);
|
|
3324
|
+
//#endregion
|
|
3325
|
+
export { xe as n, Dt as t };
|