@camstack/addon-training 0.1.47 → 0.1.49
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{MaskShapeCanvas-Kfg9dl6B.mjs → MaskShapeCanvas-HNL0xNpy.mjs} +229 -228
- package/dist/MotionZonesSettings-B1g6IUfQ.mjs +291 -0
- package/dist/PrivacyMaskSettings-D4WRZZeD.mjs +339 -0
- package/dist/{ReactKonva-DGuYUN0L.mjs → ReactKonva-DzGysLZQ.mjs} +28 -28
- package/dist/SceneMonitorEditor-pYZfyXtn.mjs +825 -0
- package/dist/_stub.js +11562 -10221
- package/dist/{_virtual_mf-localSharedImportMap___mfe_internal__addon_training_page-cOIklMU6.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_training_page-OY71DavC.mjs} +4 -4
- package/dist/_virtual_mf___mfe_internal__addon_training_page__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-BVsoOuTM.mjs +26 -0
- package/dist/{_virtual_mf___mfe_internal__addon_training_page__loadShare__react__loadShare__.js-DeDbF7NI.mjs → _virtual_mf___mfe_internal__addon_training_page__loadShare__react__loadShare__.js-CEvdvp1T.mjs} +1 -1
- package/dist/addon-training.css +1 -1
- package/dist/{chevron-right-D3StkdcR.mjs → chevron-right-cA8Hucbi.mjs} +1 -1
- package/dist/{createLucideIcon-CPP1Jzoz.mjs → createLucideIcon-C0bBNRpC.mjs} +8 -8
- package/dist/{dist-CCnnaqt1.mjs → dist-D-7oMcBM.mjs} +198 -9
- package/dist/{dist-BUzSmOA3.js → dist-DvgVhVUN.js} +198 -9
- package/dist/{grid-2x2-Yngdckwo.mjs → grid-2x2-CHuMzRxF.mjs} +1 -1
- package/dist/{hostInit-v495uwvg.mjs → hostInit-B3DR-ujG.mjs} +3 -3
- package/dist/{icons-C4_Ji5S0.mjs → icons-BwkaMam3.mjs} +9 -9
- package/dist/index.js +1 -1
- package/dist/{mic-off-DPNSd6G7.mjs → mic-off-2uHAsVtR.mjs} +1 -1
- package/dist/orchestrator/training.addon.js +1 -1
- package/dist/orchestrator/training.addon.mjs +1 -1
- package/dist/{player-overlays-DXTsKpgo.mjs → player-overlays-B4V_uIvb.mjs} +25 -25
- package/dist/providers/modal/training-modal.addon.js +1 -1
- package/dist/providers/modal/training-modal.addon.mjs +1 -1
- package/dist/remoteEntry.js +1 -1
- package/dist/{responsive-Cfmds8tw.mjs → responsive-1iwc-rj2.mjs} +26 -26
- package/dist/{rotate-ccw-Dak-lXgZ.mjs → rotate-ccw-Cu6tGrgG.mjs} +1 -1
- package/dist/scene-monitor-copy-Cqfs4Vng.mjs +176 -0
- package/dist/{settings-2-Cgiv3kQb.mjs → settings-2-xV0I5Y5U.mjs} +1 -1
- package/dist/{square-B_679zIX.mjs → square-ZPUterXM.mjs} +1 -1
- package/dist/{trash-2-DC8LDYlI.mjs → trash-2-BKfuhsgY.mjs} +1 -1
- package/dist/ui-text-CqJgUCKX.mjs +34 -0
- package/dist/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__addon_training_page__remoteEntry_js-CdlOqgkp.mjs → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__addon_training_page__remoteEntry_js-Dk6Nf5b3.mjs} +1 -1
- package/dist/{zoom-out-BJoVDYa3.mjs → zoom-out-DDZCsqkQ.mjs} +1 -1
- package/package.json +1 -1
- package/dist/MotionZonesSettings-15Lfyz9l.mjs +0 -292
- package/dist/PrivacyMaskSettings-CAyzlGjl.mjs +0 -348
- package/dist/SceneMonitorEditor-D49_o83T.mjs +0 -810
- package/dist/_virtual_mf___mfe_internal__addon_training_page__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-Cn2OEGrR.mjs +0 -26
- package/dist/scene-monitor-copy-DX2u-htD.mjs +0 -136
|
@@ -1,36 +1,37 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { d as e, l as t, o as n, v as r, w as i, y as a } from "./_virtual_mf___mfe_internal__addon_training_page__loadShare__react__loadShare__.js-CEvdvp1T.mjs";
|
|
2
2
|
import { n as o, r as s } from "./_virtual_mf___mfe_internal__addon_training_page__loadShare__react_mf_1_jsx_mf_2_runtime__loadShare__.js-DnrbBvrw.mjs";
|
|
3
|
-
import {
|
|
3
|
+
import { r as c } from "./ui-text-CqJgUCKX.mjs";
|
|
4
|
+
import { a as l, c as u, i as d, l as f, n as p, o as m, r as h, s as g } from "./ReactKonva-DzGysLZQ.mjs";
|
|
4
5
|
//#region ../ui-library/src/composites/cap-settings/MaskShapeCanvas.tsx
|
|
5
|
-
|
|
6
|
-
var
|
|
6
|
+
i();
|
|
7
|
+
var _ = {
|
|
7
8
|
rect: "#ef4444",
|
|
8
9
|
polygon: "#3b82f6",
|
|
9
10
|
grid: "#6366f1",
|
|
10
11
|
line: "#f59e0b"
|
|
11
|
-
},
|
|
12
|
-
function
|
|
12
|
+
}, v = "33", y = "66", b = "#6366f1", x = 3, S = 2, C = 12, w = 16, T = 9;
|
|
13
|
+
function E(e, t, n) {
|
|
13
14
|
return {
|
|
14
15
|
x: e.x * t,
|
|
15
16
|
y: e.y * n
|
|
16
17
|
};
|
|
17
18
|
}
|
|
18
|
-
function
|
|
19
|
+
function D(e, t, n) {
|
|
19
20
|
return {
|
|
20
21
|
x: e.x / t,
|
|
21
22
|
y: e.y / n
|
|
22
23
|
};
|
|
23
24
|
}
|
|
24
|
-
function
|
|
25
|
+
function O(e, t, n) {
|
|
25
26
|
return e.flatMap((e) => [e.x * t, e.y * n]);
|
|
26
27
|
}
|
|
27
|
-
function
|
|
28
|
+
function k(e) {
|
|
28
29
|
return !Number.isFinite(e) || e < 0 ? 0 : e > 1 ? 1 : e;
|
|
29
30
|
}
|
|
30
|
-
function
|
|
31
|
-
return e.color ??
|
|
31
|
+
function A(e) {
|
|
32
|
+
return e.color ?? _[e.shape.kind];
|
|
32
33
|
}
|
|
33
|
-
function
|
|
34
|
+
function j(e, t) {
|
|
34
35
|
let n = e[t], r = e[(t + 1) % e.length];
|
|
35
36
|
if (!n || !r) return [...e];
|
|
36
37
|
let i = {
|
|
@@ -43,36 +44,36 @@ function A(e, t) {
|
|
|
43
44
|
...e.slice(t + 1)
|
|
44
45
|
];
|
|
45
46
|
}
|
|
46
|
-
function
|
|
47
|
+
function M(e, t) {
|
|
47
48
|
return e.length === t.length ? e.every((e, n) => {
|
|
48
49
|
let r = t[n];
|
|
49
50
|
return Math.abs(e.x - r.x) < 1e-6 && Math.abs(e.y - r.y) < 1e-6;
|
|
50
51
|
}) : !1;
|
|
51
52
|
}
|
|
52
|
-
function
|
|
53
|
+
function N(e) {
|
|
53
54
|
return e.kind === "polygon" || e.kind === "line";
|
|
54
55
|
}
|
|
55
|
-
function
|
|
56
|
-
let
|
|
56
|
+
function P({ items: n, selectedId: i, onSelect: d, onShapeChange: f, onDrawComplete: p, drawingKind: h, supportedShapes: g, transparent: v = !1, backdrop: y, polygonVertices: j, grid: P }) {
|
|
57
|
+
let F = c(), I = r(null), [B, V] = a({
|
|
57
58
|
w: 800,
|
|
58
59
|
h: 450
|
|
59
|
-
}), [
|
|
60
|
-
|
|
61
|
-
if (!
|
|
62
|
-
let
|
|
63
|
-
if (!
|
|
64
|
-
|
|
60
|
+
}), [H, U] = a([]), [W, G] = a(null), [K, ee] = a(null), [q, J] = a(null), Y = h !== null && g.includes(h);
|
|
61
|
+
e(() => {
|
|
62
|
+
if (!q) return;
|
|
63
|
+
let e = n.find((e) => e.id === q.itemId);
|
|
64
|
+
if (!e || !N(e.shape)) {
|
|
65
|
+
J(null);
|
|
65
66
|
return;
|
|
66
67
|
}
|
|
67
|
-
|
|
68
|
-
}, [
|
|
69
|
-
let e =
|
|
68
|
+
M(e.shape.points, q.points) && J(null);
|
|
69
|
+
}, [n, q]), e(() => {
|
|
70
|
+
let e = I.current;
|
|
70
71
|
if (!e) return;
|
|
71
72
|
let t = new ResizeObserver((e) => {
|
|
72
73
|
let t = e[0];
|
|
73
74
|
if (!t) return;
|
|
74
75
|
let { width: n, height: r } = t.contentRect;
|
|
75
|
-
|
|
76
|
+
V(v ? {
|
|
76
77
|
w: n,
|
|
77
78
|
h: r
|
|
78
79
|
} : {
|
|
@@ -81,24 +82,24 @@ function N({ items: e, selectedId: n, onSelect: u, onShapeChange: d, onDrawCompl
|
|
|
81
82
|
});
|
|
82
83
|
});
|
|
83
84
|
return t.observe(e), () => t.disconnect();
|
|
84
|
-
}, [
|
|
85
|
-
!
|
|
86
|
-
}, [
|
|
87
|
-
let
|
|
88
|
-
|
|
89
|
-
}, [
|
|
90
|
-
if (!
|
|
91
|
-
|
|
85
|
+
}, [v]), e(() => {
|
|
86
|
+
!Y && W !== null && G(null);
|
|
87
|
+
}, [Y, W]);
|
|
88
|
+
let X = t((e) => {
|
|
89
|
+
p(e), U([]);
|
|
90
|
+
}, [p]), te = t((e) => {
|
|
91
|
+
if (!Y || h === null) {
|
|
92
|
+
d(null);
|
|
92
93
|
return;
|
|
93
94
|
}
|
|
94
95
|
let t = e.target.getStage();
|
|
95
96
|
if (!t) return;
|
|
96
97
|
let n = t.getPointerPosition();
|
|
97
98
|
if (!n) return;
|
|
98
|
-
let r =
|
|
99
|
-
if (
|
|
100
|
-
let e =
|
|
101
|
-
|
|
99
|
+
let r = D(n, B.w, B.h);
|
|
100
|
+
if (h === "rect") {
|
|
101
|
+
let e = k(r.x), t = k(r.y);
|
|
102
|
+
X({
|
|
102
103
|
kind: "rect",
|
|
103
104
|
x: e,
|
|
104
105
|
y: t,
|
|
@@ -107,9 +108,9 @@ function N({ items: e, selectedId: n, onSelect: u, onShapeChange: d, onDrawCompl
|
|
|
107
108
|
});
|
|
108
109
|
return;
|
|
109
110
|
}
|
|
110
|
-
if (
|
|
111
|
-
let e =
|
|
112
|
-
|
|
111
|
+
if (h === "grid") {
|
|
112
|
+
let e = P?.width ?? w, t = P?.height ?? T;
|
|
113
|
+
X({
|
|
113
114
|
kind: "grid",
|
|
114
115
|
gridWidth: e,
|
|
115
116
|
gridHeight: t,
|
|
@@ -117,94 +118,94 @@ function N({ items: e, selectedId: n, onSelect: u, onShapeChange: d, onDrawCompl
|
|
|
117
118
|
});
|
|
118
119
|
return;
|
|
119
120
|
}
|
|
120
|
-
if (
|
|
121
|
-
if (
|
|
122
|
-
|
|
121
|
+
if (h === "line") {
|
|
122
|
+
if (H.length === 0) {
|
|
123
|
+
U([r]);
|
|
123
124
|
return;
|
|
124
125
|
}
|
|
125
|
-
|
|
126
|
+
X({
|
|
126
127
|
kind: "line",
|
|
127
|
-
points: [...
|
|
128
|
+
points: [...H, r]
|
|
128
129
|
});
|
|
129
130
|
return;
|
|
130
131
|
}
|
|
131
|
-
if (
|
|
132
|
-
if (
|
|
133
|
-
|
|
132
|
+
if (h === "polygon") {
|
|
133
|
+
if (H.length === 0) {
|
|
134
|
+
U([r]);
|
|
134
135
|
return;
|
|
135
136
|
}
|
|
136
|
-
if (
|
|
137
|
-
let e =
|
|
138
|
-
if (Math.hypot(n.x - e.x, n.y - e.y) <
|
|
139
|
-
|
|
137
|
+
if (H.length >= x) {
|
|
138
|
+
let e = E(H[0], B.w, B.h);
|
|
139
|
+
if (Math.hypot(n.x - e.x, n.y - e.y) < C) {
|
|
140
|
+
X({
|
|
140
141
|
kind: "polygon",
|
|
141
|
-
points:
|
|
142
|
+
points: H
|
|
142
143
|
});
|
|
143
144
|
return;
|
|
144
145
|
}
|
|
145
146
|
}
|
|
146
|
-
|
|
147
|
+
U((e) => [...e, r]);
|
|
147
148
|
}
|
|
148
149
|
}, [
|
|
149
|
-
J,
|
|
150
|
-
m,
|
|
151
|
-
B,
|
|
152
|
-
F,
|
|
153
|
-
N,
|
|
154
150
|
Y,
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
151
|
+
h,
|
|
152
|
+
H,
|
|
153
|
+
B,
|
|
154
|
+
P,
|
|
155
|
+
X,
|
|
156
|
+
d
|
|
157
|
+
]), ne = t((e) => {
|
|
158
|
+
!Y || h !== "polygon" || H.length < x || (e.cancelBubble = !0, X({
|
|
158
159
|
kind: "polygon",
|
|
159
|
-
points:
|
|
160
|
+
points: H
|
|
160
161
|
}));
|
|
161
162
|
}, [
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
]), Z =
|
|
167
|
-
|
|
163
|
+
Y,
|
|
164
|
+
h,
|
|
165
|
+
H,
|
|
166
|
+
X
|
|
167
|
+
]), Z = r(null), Q = r(null);
|
|
168
|
+
e(() => () => {
|
|
168
169
|
Z.current !== null && cancelAnimationFrame(Z.current);
|
|
169
170
|
}, []);
|
|
170
|
-
let
|
|
171
|
-
if (!
|
|
171
|
+
let re = t((e) => {
|
|
172
|
+
if (!Y) return;
|
|
172
173
|
let t = e.target.getStage();
|
|
173
174
|
t && (Q.current = t.getPointerPosition() ?? null, Z.current === null && (Z.current = requestAnimationFrame(() => {
|
|
174
|
-
Z.current = null,
|
|
175
|
+
Z.current = null, G(Q.current);
|
|
175
176
|
})));
|
|
176
|
-
}, [
|
|
177
|
+
}, [Y]), ie = r(!1), ae = r(!0), oe = r(/* @__PURE__ */ new Set()), se = t((e, t, n, r) => {
|
|
177
178
|
let i = t.gridWidth * t.gridHeight;
|
|
178
179
|
if (n < 0 || n >= i || t.cells[n] === r) return;
|
|
179
180
|
let a = [...t.cells];
|
|
180
181
|
for (; a.length < i;) a.push(!1);
|
|
181
|
-
a.length = i, a[n] = r,
|
|
182
|
+
a.length = i, a[n] = r, f(e, {
|
|
182
183
|
...t,
|
|
183
184
|
cells: a
|
|
184
185
|
});
|
|
185
|
-
}, [
|
|
186
|
-
if (!
|
|
187
|
-
for (let e = 1; e <
|
|
188
|
-
let t =
|
|
189
|
-
$.push(/* @__PURE__ */ o(
|
|
186
|
+
}, [f]), $ = [];
|
|
187
|
+
if (!v) {
|
|
188
|
+
for (let e = 1; e < w; e++) {
|
|
189
|
+
let t = B.w / w * e;
|
|
190
|
+
$.push(/* @__PURE__ */ o(m, {
|
|
190
191
|
points: [
|
|
191
192
|
t,
|
|
192
193
|
0,
|
|
193
194
|
t,
|
|
194
|
-
|
|
195
|
+
B.h
|
|
195
196
|
],
|
|
196
197
|
stroke: "#ffffff",
|
|
197
198
|
strokeWidth: .5,
|
|
198
199
|
opacity: .08
|
|
199
200
|
}, `gv-${e}`));
|
|
200
201
|
}
|
|
201
|
-
for (let e = 1; e <
|
|
202
|
-
let t =
|
|
203
|
-
$.push(/* @__PURE__ */ o(
|
|
202
|
+
for (let e = 1; e < T; e++) {
|
|
203
|
+
let t = B.h / T * e;
|
|
204
|
+
$.push(/* @__PURE__ */ o(m, {
|
|
204
205
|
points: [
|
|
205
206
|
0,
|
|
206
207
|
t,
|
|
207
|
-
|
|
208
|
+
B.w,
|
|
208
209
|
t
|
|
209
210
|
],
|
|
210
211
|
stroke: "#ffffff",
|
|
@@ -214,37 +215,37 @@ function N({ items: e, selectedId: n, onSelect: u, onShapeChange: d, onDrawCompl
|
|
|
214
215
|
}
|
|
215
216
|
}
|
|
216
217
|
return /* @__PURE__ */ s("div", {
|
|
217
|
-
ref:
|
|
218
|
-
className:
|
|
219
|
-
style: { cursor:
|
|
218
|
+
ref: I,
|
|
219
|
+
className: v ? "absolute inset-0" : "relative w-full bg-zinc-900 rounded-lg overflow-hidden",
|
|
220
|
+
style: { cursor: Y ? "crosshair" : "default" },
|
|
220
221
|
children: [
|
|
221
|
-
|
|
222
|
+
y && !v ? /* @__PURE__ */ o("div", {
|
|
222
223
|
className: "absolute inset-0 pointer-events-none [&>*]:w-full [&>*]:h-full [&>img]:object-cover [&>video]:object-cover",
|
|
223
224
|
style: {
|
|
224
|
-
width:
|
|
225
|
-
height:
|
|
225
|
+
width: B.w,
|
|
226
|
+
height: B.h
|
|
226
227
|
},
|
|
227
|
-
children:
|
|
228
|
+
children: y
|
|
228
229
|
}) : null,
|
|
229
|
-
/* @__PURE__ */ s(
|
|
230
|
-
width:
|
|
231
|
-
height:
|
|
232
|
-
onClick:
|
|
233
|
-
onDblClick:
|
|
234
|
-
onMouseMove:
|
|
230
|
+
/* @__PURE__ */ s(u, {
|
|
231
|
+
width: B.w,
|
|
232
|
+
height: B.h,
|
|
233
|
+
onClick: te,
|
|
234
|
+
onDblClick: ne,
|
|
235
|
+
onMouseMove: re,
|
|
235
236
|
children: [
|
|
236
|
-
/* @__PURE__ */ s(
|
|
237
|
+
/* @__PURE__ */ s(l, {
|
|
237
238
|
listening: !1,
|
|
238
|
-
children: [/* @__PURE__ */ o(
|
|
239
|
+
children: [/* @__PURE__ */ o(m, {
|
|
239
240
|
points: [
|
|
240
241
|
0,
|
|
241
242
|
0,
|
|
242
|
-
|
|
243
|
+
B.w,
|
|
243
244
|
0,
|
|
244
|
-
|
|
245
|
-
|
|
245
|
+
B.w,
|
|
246
|
+
B.h,
|
|
246
247
|
0,
|
|
247
|
-
|
|
248
|
+
B.h,
|
|
248
249
|
0,
|
|
249
250
|
0
|
|
250
251
|
],
|
|
@@ -252,96 +253,96 @@ function N({ items: e, selectedId: n, onSelect: u, onShapeChange: d, onDrawCompl
|
|
|
252
253
|
strokeWidth: 0
|
|
253
254
|
}), $]
|
|
254
255
|
}),
|
|
255
|
-
/* @__PURE__ */ o(
|
|
256
|
-
let t = e.id ===
|
|
257
|
-
if (e.shape.kind === "rect") return /* @__PURE__ */ o(
|
|
256
|
+
/* @__PURE__ */ o(l, { children: n.map((e) => {
|
|
257
|
+
let t = e.id === i, n = e.enabled === !1, r = A(e), a = t && !Y && !n;
|
|
258
|
+
if (e.shape.kind === "rect") return /* @__PURE__ */ o(L, {
|
|
258
259
|
item: e,
|
|
259
260
|
shape: e.shape,
|
|
260
|
-
color:
|
|
261
|
+
color: r,
|
|
261
262
|
selected: t,
|
|
262
|
-
dimmed:
|
|
263
|
+
dimmed: n,
|
|
263
264
|
editable: a,
|
|
264
|
-
isDrawing:
|
|
265
|
-
size:
|
|
266
|
-
onSelect:
|
|
267
|
-
onShapeChange:
|
|
265
|
+
isDrawing: Y,
|
|
266
|
+
size: B,
|
|
267
|
+
onSelect: d,
|
|
268
|
+
onShapeChange: f
|
|
268
269
|
}, e.id);
|
|
269
|
-
if (e.shape.kind === "grid") return /* @__PURE__ */ o(
|
|
270
|
+
if (e.shape.kind === "grid") return /* @__PURE__ */ o(R, {
|
|
270
271
|
item: e,
|
|
271
272
|
shape: e.shape,
|
|
272
|
-
color:
|
|
273
|
-
dimmed:
|
|
273
|
+
color: r,
|
|
274
|
+
dimmed: n,
|
|
274
275
|
editable: a,
|
|
275
|
-
size:
|
|
276
|
-
onSelect:
|
|
277
|
-
paintingRef:
|
|
278
|
-
paintValueRef:
|
|
279
|
-
paintedRef:
|
|
280
|
-
paintCell:
|
|
276
|
+
size: B,
|
|
277
|
+
onSelect: d,
|
|
278
|
+
paintingRef: ie,
|
|
279
|
+
paintValueRef: ae,
|
|
280
|
+
paintedRef: oe,
|
|
281
|
+
paintCell: se
|
|
281
282
|
}, e.id);
|
|
282
|
-
let s = e.shape.kind === "line", c = s ?
|
|
283
|
-
return /* @__PURE__ */ o(
|
|
283
|
+
let s = e.shape.kind === "line", c = s ? S : Math.max(x, j?.min ?? x), l = s ? S : j?.max, u = q && q.itemId === e.id ? q.points : e.shape.points;
|
|
284
|
+
return /* @__PURE__ */ o(z, {
|
|
284
285
|
item: e,
|
|
285
286
|
shape: e.shape,
|
|
286
|
-
color:
|
|
287
|
+
color: r,
|
|
287
288
|
selected: t,
|
|
288
|
-
dimmed:
|
|
289
|
+
dimmed: n,
|
|
289
290
|
editable: a,
|
|
290
291
|
isLine: s,
|
|
291
|
-
isDrawing:
|
|
292
|
-
size:
|
|
293
|
-
effectivePoints:
|
|
292
|
+
isDrawing: Y,
|
|
293
|
+
size: B,
|
|
294
|
+
effectivePoints: u,
|
|
294
295
|
minVertices: c,
|
|
295
296
|
maxVertices: l,
|
|
296
|
-
isDragging:
|
|
297
|
-
onSelect:
|
|
298
|
-
onShapeChange:
|
|
299
|
-
setDragOverride:
|
|
300
|
-
setDraggingItemId:
|
|
297
|
+
isDragging: K === e.id,
|
|
298
|
+
onSelect: d,
|
|
299
|
+
onShapeChange: f,
|
|
300
|
+
setDragOverride: J,
|
|
301
|
+
setDraggingItemId: ee
|
|
301
302
|
}, e.id);
|
|
302
303
|
}) }),
|
|
303
|
-
/* @__PURE__ */ o(
|
|
304
|
+
/* @__PURE__ */ o(l, {
|
|
304
305
|
listening: !1,
|
|
305
|
-
children:
|
|
306
|
-
|
|
307
|
-
points:
|
|
308
|
-
stroke:
|
|
306
|
+
children: Y && H.length > 0 && /* @__PURE__ */ s("Group", { children: [
|
|
307
|
+
h === "polygon" && H.length >= 2 && /* @__PURE__ */ o("Line", {
|
|
308
|
+
points: O(H, B.w, B.h),
|
|
309
|
+
stroke: b,
|
|
309
310
|
strokeWidth: 1.5,
|
|
310
311
|
dash: [6, 3],
|
|
311
312
|
opacity: .8
|
|
312
313
|
}),
|
|
313
|
-
|
|
314
|
+
h === "line" && H.length === 1 && W && /* @__PURE__ */ o("Line", {
|
|
314
315
|
points: [
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
316
|
+
H[0].x * B.w,
|
|
317
|
+
H[0].y * B.h,
|
|
318
|
+
W.x,
|
|
319
|
+
W.y
|
|
319
320
|
],
|
|
320
|
-
stroke:
|
|
321
|
+
stroke: _.line,
|
|
321
322
|
strokeWidth: 1.5,
|
|
322
323
|
dash: [6, 3],
|
|
323
324
|
opacity: .7
|
|
324
325
|
}),
|
|
325
|
-
|
|
326
|
+
h === "polygon" && W && H.length >= 1 && /* @__PURE__ */ o("Line", {
|
|
326
327
|
points: [
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
328
|
+
H[H.length - 1].x * B.w,
|
|
329
|
+
H[H.length - 1].y * B.h,
|
|
330
|
+
W.x,
|
|
331
|
+
W.y
|
|
331
332
|
],
|
|
332
|
-
stroke:
|
|
333
|
+
stroke: b,
|
|
333
334
|
strokeWidth: 1,
|
|
334
335
|
dash: [4, 4],
|
|
335
336
|
opacity: .5
|
|
336
337
|
}),
|
|
337
|
-
|
|
338
|
-
let n =
|
|
338
|
+
H.map((e, t) => {
|
|
339
|
+
let n = E(e, B.w, B.h), r = t === 0 && h === "polygon" && H.length >= x;
|
|
339
340
|
return /* @__PURE__ */ o("Circle", {
|
|
340
341
|
x: n.x,
|
|
341
342
|
y: n.y,
|
|
342
343
|
radius: r ? 7 : 4,
|
|
343
|
-
fill: r ?
|
|
344
|
-
stroke:
|
|
344
|
+
fill: r ? b : "#ffffff",
|
|
345
|
+
stroke: b,
|
|
345
346
|
strokeWidth: 1.5,
|
|
346
347
|
opacity: .9
|
|
347
348
|
}, t);
|
|
@@ -350,26 +351,26 @@ function N({ items: e, selectedId: n, onSelect: u, onShapeChange: d, onDrawCompl
|
|
|
350
351
|
})
|
|
351
352
|
]
|
|
352
353
|
}),
|
|
353
|
-
|
|
354
|
+
Y ? /* @__PURE__ */ o("div", {
|
|
354
355
|
className: "px-3 py-1.5 bg-zinc-800/80 text-[11px] text-zinc-400 border-t border-zinc-700",
|
|
355
|
-
children:
|
|
356
|
+
children: h === "line" ? F("uiLibrary.maskShapeCanvas.hintLine", "Click to set the start point, click again to complete the line") : h === "rect" ? F("uiLibrary.maskShapeCanvas.hintRect", "Click to drop a rectangle, then drag the corner to resize") : h === "grid" ? F("uiLibrary.maskShapeCanvas.hintGrid", "Click to add the grid, then paint cells") : H.length < x ? F("uiLibrary.maskShapeCanvas.hintPoints", "Click to add points (min 3). Double-click or click the first point to close.") : F("uiLibrary.maskShapeCanvas.hintMore", "Continue adding points. Double-click or click the first point to close.")
|
|
356
357
|
}) : null
|
|
357
358
|
]
|
|
358
359
|
});
|
|
359
360
|
}
|
|
360
|
-
var
|
|
361
|
-
function
|
|
361
|
+
var F = .02;
|
|
362
|
+
function I(e, t) {
|
|
362
363
|
return Math.abs(e.x - t.x) < 1e-6 && Math.abs(e.y - t.y) < 1e-6 && Math.abs(e.width - t.width) < 1e-6 && Math.abs(e.height - t.height) < 1e-6;
|
|
363
364
|
}
|
|
364
|
-
function
|
|
365
|
-
let [b, x] =
|
|
365
|
+
function L({ item: t, shape: n, color: r, selected: i, dimmed: c, editable: l, isDrawing: u, size: p, onSelect: m, onShapeChange: _ }) {
|
|
366
|
+
let [b, x] = a(null), S = {
|
|
366
367
|
x: n.x,
|
|
367
368
|
y: n.y,
|
|
368
369
|
width: n.width,
|
|
369
370
|
height: n.height
|
|
370
371
|
};
|
|
371
|
-
|
|
372
|
-
b &&
|
|
372
|
+
e(() => {
|
|
373
|
+
b && I(S, b) && x(null);
|
|
373
374
|
}, [
|
|
374
375
|
n.x,
|
|
375
376
|
n.y,
|
|
@@ -377,20 +378,20 @@ function I({ item: e, shape: n, color: r, selected: i, dimmed: c, editable: l, i
|
|
|
377
378
|
n.height,
|
|
378
379
|
b
|
|
379
380
|
]);
|
|
380
|
-
let C = b ?? S, w = C.x * p.w, T = C.y * p.h, E = C.width * p.w, D = C.height * p.h,
|
|
381
|
-
x(
|
|
381
|
+
let C = b ?? S, w = C.x * p.w, T = C.y * p.h, E = C.width * p.w, D = C.height * p.h, O = c ? .35 : i ? 1 : .85, A = (e) => {
|
|
382
|
+
x(e), _(t.id, {
|
|
382
383
|
kind: "rect",
|
|
383
|
-
x:
|
|
384
|
-
y:
|
|
385
|
-
width:
|
|
386
|
-
height:
|
|
384
|
+
x: e.x,
|
|
385
|
+
y: e.y,
|
|
386
|
+
width: e.width,
|
|
387
|
+
height: e.height
|
|
387
388
|
});
|
|
388
389
|
};
|
|
389
|
-
return /* @__PURE__ */ o(
|
|
390
|
-
onClick: (
|
|
391
|
-
|
|
390
|
+
return /* @__PURE__ */ o(d, {
|
|
391
|
+
onClick: (e) => {
|
|
392
|
+
e.cancelBubble = !0, u || m(t.id);
|
|
392
393
|
},
|
|
393
|
-
children: /* @__PURE__ */ s(
|
|
394
|
+
children: /* @__PURE__ */ s(d, {
|
|
394
395
|
draggable: l,
|
|
395
396
|
dragBoundFunc: l ? (e) => ({
|
|
396
397
|
x: Math.max(-w, Math.min(p.w - (w + E), e.x)),
|
|
@@ -417,23 +418,23 @@ function I({ item: e, shape: n, color: r, selected: i, dimmed: c, editable: l, i
|
|
|
417
418
|
onMouseLeave: (e) => {
|
|
418
419
|
if (!l) return;
|
|
419
420
|
let t = e.target.getStage();
|
|
420
|
-
t && (t.container().style.cursor =
|
|
421
|
+
t && (t.container().style.cursor = u ? "crosshair" : "default");
|
|
421
422
|
},
|
|
422
423
|
children: [
|
|
423
|
-
/* @__PURE__ */ o(
|
|
424
|
+
/* @__PURE__ */ o(g, {
|
|
424
425
|
x: w,
|
|
425
426
|
y: T,
|
|
426
427
|
width: E,
|
|
427
428
|
height: D,
|
|
428
|
-
fill: r + (i ?
|
|
429
|
+
fill: r + (i ? y : v),
|
|
429
430
|
stroke: r,
|
|
430
431
|
strokeWidth: i ? 2.5 : 1.5,
|
|
431
|
-
opacity:
|
|
432
|
+
opacity: O
|
|
432
433
|
}),
|
|
433
|
-
|
|
434
|
+
t.label ? /* @__PURE__ */ o(f, {
|
|
434
435
|
x: w,
|
|
435
436
|
y: T - 16,
|
|
436
|
-
text:
|
|
437
|
+
text: t.label,
|
|
437
438
|
fontSize: 12,
|
|
438
439
|
fill: r,
|
|
439
440
|
stroke: "#000000",
|
|
@@ -442,7 +443,7 @@ function I({ item: e, shape: n, color: r, selected: i, dimmed: c, editable: l, i
|
|
|
442
443
|
fontStyle: "bold",
|
|
443
444
|
listening: !1
|
|
444
445
|
}) : null,
|
|
445
|
-
l ? /* @__PURE__ */ o(
|
|
446
|
+
l ? /* @__PURE__ */ o(h, {
|
|
446
447
|
x: w + E,
|
|
447
448
|
y: T + D,
|
|
448
449
|
radius: 6,
|
|
@@ -458,19 +459,19 @@ function I({ item: e, shape: n, color: r, selected: i, dimmed: c, editable: l, i
|
|
|
458
459
|
e.cancelBubble = !0;
|
|
459
460
|
},
|
|
460
461
|
onDragMove: (e) => {
|
|
461
|
-
let t = e.target, n =
|
|
462
|
+
let t = e.target, n = k(t.x() / p.w - C.x), r = k(t.y() / p.h - C.y);
|
|
462
463
|
x({
|
|
463
464
|
...C,
|
|
464
|
-
width: Math.max(
|
|
465
|
-
height: Math.max(
|
|
465
|
+
width: Math.max(F, Math.min(n, 1 - C.x)),
|
|
466
|
+
height: Math.max(F, Math.min(r, 1 - C.y))
|
|
466
467
|
});
|
|
467
468
|
},
|
|
468
469
|
onDragEnd: (e) => {
|
|
469
|
-
let t = e.target, n =
|
|
470
|
+
let t = e.target, n = k(t.x() / p.w - C.x), r = k(t.y() / p.h - C.y);
|
|
470
471
|
A({
|
|
471
472
|
...C,
|
|
472
|
-
width: Math.max(
|
|
473
|
-
height: Math.max(
|
|
473
|
+
width: Math.max(F, Math.min(n, 1 - C.x)),
|
|
474
|
+
height: Math.max(F, Math.min(r, 1 - C.y))
|
|
474
475
|
});
|
|
475
476
|
},
|
|
476
477
|
onMouseEnter: (e) => {
|
|
@@ -486,31 +487,31 @@ function I({ item: e, shape: n, color: r, selected: i, dimmed: c, editable: l, i
|
|
|
486
487
|
})
|
|
487
488
|
});
|
|
488
489
|
}
|
|
489
|
-
function
|
|
490
|
-
let { gridWidth: p, gridHeight: m, cells:
|
|
490
|
+
function R({ item: e, shape: t, color: n, dimmed: r, editable: i, size: a, onSelect: s, paintingRef: c, paintValueRef: l, paintedRef: u, paintCell: f }) {
|
|
491
|
+
let { gridWidth: p, gridHeight: m, cells: h } = t, _ = a.w / p, v = a.h / m, b = p * m, x = r ? .3 : 1, S = (n) => {
|
|
491
492
|
if (!i) {
|
|
492
493
|
s(e.id);
|
|
493
494
|
return;
|
|
494
495
|
}
|
|
495
|
-
let r =
|
|
496
|
-
c.current = !0, l.current = r,
|
|
496
|
+
let r = h[n] !== !0;
|
|
497
|
+
c.current = !0, l.current = r, u.current = new Set([n]), f(e.id, t, n, r);
|
|
497
498
|
}, C = (n) => {
|
|
498
|
-
!c.current || !i ||
|
|
499
|
+
!c.current || !i || u.current.has(n) || (u.current.add(n), f(e.id, t, n, l.current));
|
|
499
500
|
}, w = () => {
|
|
500
|
-
c.current && (c.current = !1,
|
|
501
|
+
c.current && (c.current = !1, u.current = /* @__PURE__ */ new Set());
|
|
501
502
|
};
|
|
502
|
-
return /* @__PURE__ */ o(
|
|
503
|
+
return /* @__PURE__ */ o(d, {
|
|
503
504
|
opacity: x,
|
|
504
505
|
onMouseUp: w,
|
|
505
506
|
onMouseLeave: w,
|
|
506
507
|
children: Array.from({ length: b }, (e, t) => {
|
|
507
|
-
let r = t % p, i = Math.floor(t / p), a =
|
|
508
|
-
return /* @__PURE__ */ o(
|
|
508
|
+
let r = t % p, i = Math.floor(t / p), a = h[t] === !0;
|
|
509
|
+
return /* @__PURE__ */ o(g, {
|
|
509
510
|
x: r * _,
|
|
510
|
-
y: i *
|
|
511
|
+
y: i * v,
|
|
511
512
|
width: _,
|
|
512
|
-
height:
|
|
513
|
-
fill: a ? n +
|
|
513
|
+
height: v,
|
|
514
|
+
fill: a ? n + y : "#ffffff10",
|
|
514
515
|
stroke: a ? n : "#ffffff40",
|
|
515
516
|
strokeWidth: .5,
|
|
516
517
|
onMouseDown: (e) => {
|
|
@@ -521,18 +522,18 @@ function L({ item: e, shape: t, color: n, dimmed: r, editable: i, size: a, onSel
|
|
|
521
522
|
})
|
|
522
523
|
});
|
|
523
524
|
}
|
|
524
|
-
function
|
|
525
|
-
let
|
|
525
|
+
function z({ item: e, shape: t, color: n, selected: r, dimmed: i, editable: a, isLine: c, isDrawing: l, size: u, effectivePoints: h, minVertices: g, maxVertices: _, isDragging: b, onSelect: x, onShapeChange: S, setDragOverride: C, setDraggingItemId: w }) {
|
|
526
|
+
let T = O(h, u.w, u.h), k = i ? .35 : r ? 1 : c ? .8 : .85, A = (e) => c ? {
|
|
526
527
|
kind: "line",
|
|
527
528
|
points: [...e]
|
|
528
529
|
} : {
|
|
529
530
|
kind: "polygon",
|
|
530
531
|
points: [...e]
|
|
531
|
-
}, M = h.map((e) => e.x *
|
|
532
|
-
x: Math.max(-P, Math.min(
|
|
533
|
-
y: Math.max(-I, Math.min(
|
|
532
|
+
}, M = h.map((e) => e.x * u.w), N = h.map((e) => e.y * u.h), P = M.length > 0 ? Math.min(...M) : 0, F = M.length > 0 ? Math.max(...M) : 0, I = N.length > 0 ? Math.min(...N) : 0, L = N.length > 0 ? Math.max(...N) : 0, R = (e) => ({
|
|
533
|
+
x: Math.max(-P, Math.min(u.w - F, e.x)),
|
|
534
|
+
y: Math.max(-I, Math.min(u.h - L, e.y))
|
|
534
535
|
}), z = (n) => {
|
|
535
|
-
let r = n.target, i = r.x() /
|
|
536
|
+
let r = n.target, i = r.x() / u.w, a = r.y() / u.h;
|
|
536
537
|
if (r.position({
|
|
537
538
|
x: 0,
|
|
538
539
|
y: 0
|
|
@@ -544,14 +545,14 @@ function R({ item: e, shape: t, color: n, selected: r, dimmed: i, editable: a, i
|
|
|
544
545
|
C({
|
|
545
546
|
itemId: e.id,
|
|
546
547
|
points: o
|
|
547
|
-
}), S(e.id,
|
|
548
|
-
}, B = !c && h.length > g, V = !c && (
|
|
549
|
-
return /* @__PURE__ */ s(
|
|
548
|
+
}), S(e.id, A(o));
|
|
549
|
+
}, B = !c && h.length > g, V = !c && (_ === void 0 || h.length < _);
|
|
550
|
+
return /* @__PURE__ */ s(d, {
|
|
550
551
|
onClick: (t) => {
|
|
551
552
|
t.cancelBubble = !0, l || x(e.id);
|
|
552
553
|
},
|
|
553
554
|
children: [
|
|
554
|
-
/* @__PURE__ */ s(
|
|
555
|
+
/* @__PURE__ */ s(d, {
|
|
555
556
|
draggable: a,
|
|
556
557
|
dragBoundFunc: a ? R : void 0,
|
|
557
558
|
onDragStart: a ? () => w(e.id) : void 0,
|
|
@@ -566,27 +567,27 @@ function R({ item: e, shape: t, color: n, selected: r, dimmed: i, editable: a, i
|
|
|
566
567
|
let t = e.target.getStage();
|
|
567
568
|
t && (t.container().style.cursor = l ? "crosshair" : "default");
|
|
568
569
|
},
|
|
569
|
-
children: [c ? /* @__PURE__ */ o(
|
|
570
|
-
points:
|
|
570
|
+
children: [c ? /* @__PURE__ */ o(p, {
|
|
571
|
+
points: T,
|
|
571
572
|
stroke: n,
|
|
572
573
|
strokeWidth: r ? 3 : 2,
|
|
573
574
|
fill: n,
|
|
574
575
|
pointerLength: 10,
|
|
575
576
|
pointerWidth: 8,
|
|
576
577
|
opacity: k
|
|
577
|
-
}) : /* @__PURE__ */ o(
|
|
578
|
-
points:
|
|
578
|
+
}) : /* @__PURE__ */ o(m, {
|
|
579
|
+
points: T,
|
|
579
580
|
closed: !0,
|
|
580
|
-
fill: n + (r ?
|
|
581
|
+
fill: n + (r ? y : v),
|
|
581
582
|
stroke: n,
|
|
582
583
|
strokeWidth: r ? 2.5 : 1.5,
|
|
583
584
|
opacity: k
|
|
584
585
|
}), e.label && h.length > 0 ? (() => {
|
|
585
|
-
let t =
|
|
586
|
+
let t = E({
|
|
586
587
|
x: h.reduce((e, t) => e + t.x, 0) / h.length,
|
|
587
588
|
y: h.reduce((e, t) => e + t.y, 0) / h.length
|
|
588
|
-
},
|
|
589
|
-
return /* @__PURE__ */ o(
|
|
589
|
+
}, u.w, u.h), r = Math.max(40, e.label.length * 11 * .62);
|
|
590
|
+
return /* @__PURE__ */ o(f, {
|
|
590
591
|
x: t.x - r / 2,
|
|
591
592
|
y: t.y - 7,
|
|
592
593
|
width: r,
|
|
@@ -603,7 +604,7 @@ function R({ item: e, shape: t, color: n, selected: r, dimmed: i, editable: a, i
|
|
|
603
604
|
})() : null]
|
|
604
605
|
}),
|
|
605
606
|
a && !b && h.map((r, i) => {
|
|
606
|
-
let a =
|
|
607
|
+
let a = E(r, u.w, u.h);
|
|
607
608
|
return /* @__PURE__ */ o("Circle", {
|
|
608
609
|
x: a.x,
|
|
609
610
|
y: a.y,
|
|
@@ -613,10 +614,10 @@ function R({ item: e, shape: t, color: n, selected: r, dimmed: i, editable: a, i
|
|
|
613
614
|
strokeWidth: 1.5,
|
|
614
615
|
draggable: !0,
|
|
615
616
|
onDragMove: (n) => {
|
|
616
|
-
let r =
|
|
617
|
+
let r = D({
|
|
617
618
|
x: n.target.x(),
|
|
618
619
|
y: n.target.y()
|
|
619
|
-
},
|
|
620
|
+
}, u.w, u.h);
|
|
620
621
|
C((n) => {
|
|
621
622
|
let a = n && n.itemId === e.id ? n.points : t.points;
|
|
622
623
|
return {
|
|
@@ -626,25 +627,25 @@ function R({ item: e, shape: t, color: n, selected: r, dimmed: i, editable: a, i
|
|
|
626
627
|
});
|
|
627
628
|
},
|
|
628
629
|
onDragEnd: (n) => {
|
|
629
|
-
let r =
|
|
630
|
+
let r = D({
|
|
630
631
|
x: n.target.x(),
|
|
631
632
|
y: n.target.y()
|
|
632
|
-
},
|
|
633
|
+
}, u.w, u.h), a = t.points.map((e, t) => t === i ? r : e);
|
|
633
634
|
C({
|
|
634
635
|
itemId: e.id,
|
|
635
636
|
points: a
|
|
636
|
-
}), S(e.id,
|
|
637
|
+
}), S(e.id, A(a));
|
|
637
638
|
},
|
|
638
639
|
onContextMenu: (n) => {
|
|
639
|
-
n.evt.preventDefault(), n.cancelBubble = !0, B && S(e.id,
|
|
640
|
+
n.evt.preventDefault(), n.cancelBubble = !0, B && S(e.id, A(t.points.filter((e, t) => t !== i)));
|
|
640
641
|
}
|
|
641
642
|
}, `pt-${i}`);
|
|
642
643
|
}),
|
|
643
644
|
a && !b && V && h.length >= 2 && h.map((r, i) => {
|
|
644
|
-
let a = h[(i + 1) % h.length], s =
|
|
645
|
+
let a = h[(i + 1) % h.length], s = E({
|
|
645
646
|
x: (r.x + a.x) / 2,
|
|
646
647
|
y: (r.y + a.y) / 2
|
|
647
|
-
},
|
|
648
|
+
}, u.w, u.h);
|
|
648
649
|
return /* @__PURE__ */ o("Circle", {
|
|
649
650
|
x: s.x,
|
|
650
651
|
y: s.y,
|
|
@@ -674,13 +675,13 @@ function R({ item: e, shape: t, color: n, selected: r, dimmed: i, editable: a, i
|
|
|
674
675
|
n && (n.container().style.cursor = l ? "crosshair" : "default");
|
|
675
676
|
},
|
|
676
677
|
onClick: (n) => {
|
|
677
|
-
n.cancelBubble = !0, S(e.id, j(
|
|
678
|
+
n.cancelBubble = !0, S(e.id, A(j(t.points, i)));
|
|
678
679
|
}
|
|
679
680
|
}, `mid-${i}`);
|
|
680
681
|
})
|
|
681
682
|
]
|
|
682
683
|
});
|
|
683
684
|
}
|
|
684
|
-
var
|
|
685
|
+
var B = n(P);
|
|
685
686
|
//#endregion
|
|
686
|
-
export {
|
|
687
|
+
export { B as MaskShapeCanvas };
|