@glodon-aiot/dataset-annotation 3.13.0-alpha.29 → 3.14.0-alpha.31
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/es/components/DetectionAnnotation/components/LabelMaker/RectLabel.mjs +151 -135
- package/dist/es/components/DetectionAnnotation/components/LabelMaker/index.mjs +244 -218
- package/dist/es/components/VLMAnnotation/RegionItem.mjs +135 -59
- package/dist/es/components/VLMAnnotation/TextAnnotationPanel.mjs +73 -62
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useDeleteRegion.mjs +55 -40
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useDrawingMode.mjs +291 -162
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useOCRControl.mjs +100 -0
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useOCRRecognition.mjs +88 -55
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionBoundaryCheck.mjs +103 -0
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionLoader.mjs +123 -91
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionSelection.mjs +42 -39
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionUpdate.mjs +55 -60
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/icons/ai.svg.mjs +4 -0
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/icons/error.svg.mjs +4 -0
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/icons/loading.svg.mjs +4 -0
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/icons/star.svg.mjs +4 -0
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/index.mjs +512 -387
- package/dist/es/components/VLMAnnotation/constants.mjs +39 -32
- package/dist/es/components/VLMAnnotation/index.mjs +187 -150
- package/dist/es/index.mjs +1 -1
- package/dist/lib/index.js +4 -4
- package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useDeleteRegion.d.ts +1 -0
- package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useDrawingMode.d.ts +3 -1
- package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useOCRControl.d.ts +16 -0
- package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useOCRRecognition.d.ts +3 -2
- package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionBoundaryCheck.d.ts +31 -0
- package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionLoader.d.ts +5 -1
- package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionSelection.d.ts +2 -1
- package/dist/src/components/VLMAnnotation/VLMLabelMaker/index.d.ts +2 -2
- package/dist/src/components/VLMAnnotation/constants.d.ts +19 -3
- package/dist/src/components/VLMAnnotation/index.d.ts +1 -1
- package/dist/src/components/VLMAnnotation/types.d.ts +15 -0
- package/package.json +2 -2
|
@@ -1,50 +1,57 @@
|
|
|
1
|
-
const _ =
|
|
1
|
+
const _ = 8, E = 0.1, O = 0.999, T = 0.01, R = 100, L = 2, C = "#EAD4FF", A = "#9C24F2", I = "rgba(156, 36, 242, 0.1)", n = "rgba(156, 36, 242, 0.05)", s = "transparent", t = "rgba(0, 0, 0, 0)", N = [5, 5], c = "vlm-label-maker-canvas", o = 300, S = 0.7, F = 0.05, D = 0.95, M = "rect", a = "区域", r = "区域1", P = "Arial, sans-serif", H = 12, U = 4, X = 3, G = 3, g = 1.5, Y = 0.5, b = 3e-3, K = "rgba(156, 36, 242, 0.2)", Z = "rgba(156, 36, 242, 0.5)", e = "#9C24F2", B = "rgba(156, 36, 242, 0.2)", W = "rgba(156, 36, 242, 0.2)", l = "rgba(156, 36, 242, 0.5)", V = "rgba(0, 255, 0, 0.2)", i = 300, m = "#9C24F2", p = 6, v = 24, f = 20, k = 24, x = 24, d = 20, h = 24, j = "#9C24F2", q = "image/png", u = "确认删除", w = "确定要删除此标注区域吗?", y = "确定", z = "取消", J = "rgba(156, 36, 242, 0.5)", Q = 1, $ = [5, 5];
|
|
2
2
|
export {
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
A as ACTIVE_RECT_STROKE_COLOR,
|
|
4
|
+
d as AI_CONTROL_OFFSET_X,
|
|
5
|
+
h as AI_CONTROL_OFFSET_Y,
|
|
6
|
+
x as AI_ICON_SIZE,
|
|
7
|
+
L as BASE_STROKE_WIDTH,
|
|
8
|
+
c as CANVAS_CONTAINER_CLASS,
|
|
5
9
|
m as CONTROL_POINT_COLOR,
|
|
6
10
|
p as CONTROL_POINT_SIZE,
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
S as
|
|
11
|
-
|
|
11
|
+
J as CROSSHAIR_LINE_COLOR,
|
|
12
|
+
$ as CROSSHAIR_LINE_DASH_ARRAY,
|
|
13
|
+
Q as CROSSHAIR_LINE_WIDTH,
|
|
14
|
+
S as DEFAULT_LEFT_RATIO,
|
|
15
|
+
D as DEFAULT_MAX_RATIO,
|
|
16
|
+
o as DEFAULT_MIN_LEFT_WIDTH,
|
|
17
|
+
F as DEFAULT_MIN_RATIO,
|
|
18
|
+
r as DEFAULT_REGION_NAME,
|
|
12
19
|
M as DEFAULT_SHAPE_TYPE,
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
f as DELETE_CONTROL_OFFSET_X,
|
|
21
|
+
k as DELETE_CONTROL_OFFSET_Y,
|
|
22
|
+
v as DELETE_ICON_SIZE,
|
|
23
|
+
z as DELETE_MODAL_CANCEL_TEXT,
|
|
24
|
+
w as DELETE_MODAL_CONTENT,
|
|
25
|
+
y as DELETE_MODAL_OK_TEXT,
|
|
26
|
+
u as DELETE_MODAL_TITLE,
|
|
27
|
+
n as HOVER_RECT_FILL_COLOR,
|
|
28
|
+
q as IMAGE_EXPORT_FORMAT,
|
|
22
29
|
_ as MAX_ZOOM,
|
|
23
30
|
E as MIN_ZOOM,
|
|
24
31
|
b as OCR_SCAN_ANIMATION_SPEED,
|
|
25
|
-
|
|
26
|
-
|
|
32
|
+
X as OCR_SCAN_LINE_BASE_HEIGHT,
|
|
33
|
+
Z as OCR_SCAN_LINE_BRIGHT_COLOR,
|
|
27
34
|
e as OCR_SCAN_LINE_CORE_COLOR,
|
|
28
|
-
|
|
35
|
+
Y as OCR_SCAN_LINE_CORE_HEIGHT_MULTIPLIER,
|
|
29
36
|
g as OCR_SCAN_LINE_CORE_POSITION_MULTIPLIER,
|
|
30
|
-
|
|
31
|
-
|
|
37
|
+
K as OCR_SCAN_LINE_GLOW_COLOR,
|
|
38
|
+
G as OCR_SCAN_LINE_GLOW_MULTIPLIER,
|
|
32
39
|
C as RECT_STROKE_COLOR,
|
|
33
40
|
P as REGION_NAME_FONT_FAMILY,
|
|
34
|
-
|
|
41
|
+
H as REGION_NAME_FONT_SIZE,
|
|
35
42
|
U as REGION_NAME_PADDING,
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
43
|
+
a as REGION_NAME_PREFIX,
|
|
44
|
+
j as REGION_NAME_TEXT_COLOR,
|
|
45
|
+
I as SELECTED_RECT_FILL_COLOR,
|
|
46
|
+
t as TEMP_RECT_FILL_COLOR,
|
|
40
47
|
N as TEMP_RECT_STROKE_DASH_ARRAY,
|
|
41
|
-
|
|
48
|
+
V as TEXT_LAYOUT_RECT_CLICK_FEEDBACK_COLOR,
|
|
42
49
|
i as TEXT_LAYOUT_RECT_FEEDBACK_DELAY,
|
|
43
|
-
|
|
50
|
+
B as TEXT_LAYOUT_RECT_FILL_COLOR,
|
|
44
51
|
l as TEXT_LAYOUT_RECT_HOVER_STROKE_COLOR,
|
|
45
|
-
|
|
46
|
-
|
|
52
|
+
W as TEXT_LAYOUT_RECT_STROKE_COLOR,
|
|
53
|
+
s as TRANSPARENT_FILL,
|
|
47
54
|
O as ZOOM_FACTOR,
|
|
48
55
|
T as ZOOM_PRECISION_ERROR,
|
|
49
|
-
|
|
56
|
+
R as ZOOM_STEP
|
|
50
57
|
};
|
|
@@ -1,242 +1,279 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
for (var
|
|
7
|
-
|
|
8
|
-
if (
|
|
9
|
-
for (var
|
|
10
|
-
|
|
11
|
-
return
|
|
12
|
-
},
|
|
13
|
-
import { jsxs as
|
|
14
|
-
import { useMemo as
|
|
1
|
+
var me = Object.defineProperty, fe = Object.defineProperties;
|
|
2
|
+
var pe = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var ee = Object.getOwnPropertySymbols;
|
|
4
|
+
var ve = Object.prototype.hasOwnProperty, be = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var te = (l, o, r) => o in l ? me(l, o, { enumerable: !0, configurable: !0, writable: !0, value: r }) : l[o] = r, u = (l, o) => {
|
|
6
|
+
for (var r in o || (o = {}))
|
|
7
|
+
ve.call(o, r) && te(l, r, o[r]);
|
|
8
|
+
if (ee)
|
|
9
|
+
for (var r of ee(o))
|
|
10
|
+
be.call(o, r) && te(l, r, o[r]);
|
|
11
|
+
return l;
|
|
12
|
+
}, a = (l, o) => fe(l, pe(o));
|
|
13
|
+
import { jsxs as Ee, jsx as g } from "react/jsx-runtime";
|
|
14
|
+
import { useMemo as Te, useState as b, useRef as S, useEffect as w } from "react";
|
|
15
|
+
import { Modal as Ae } from "antd";
|
|
15
16
|
import "./style.less.mjs";
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import { DEFAULT_SHAPE_TYPE as
|
|
19
|
-
const
|
|
20
|
-
var o,
|
|
21
|
-
return u(
|
|
22
|
-
labels: (
|
|
23
|
-
if (
|
|
17
|
+
import ye from "./TextAnnotationPanel.mjs";
|
|
18
|
+
import Le from "./VLMLabelMaker/index.mjs";
|
|
19
|
+
import { DEFAULT_SHAPE_TYPE as Re, DELETE_MODAL_TITLE as Me, DELETE_MODAL_CONTENT as we, DELETE_MODAL_OK_TEXT as _e, DELETE_MODAL_CANCEL_TEXT as he, DEFAULT_MIN_LEFT_WIDTH as ge, DEFAULT_MAX_RATIO as F, DEFAULT_MIN_RATIO as ne, DEFAULT_LEFT_RATIO as De } from "./constants.mjs";
|
|
20
|
+
const V = (l) => {
|
|
21
|
+
var o, r;
|
|
22
|
+
return a(u({}, l), {
|
|
23
|
+
labels: (r = (o = l.labels) == null ? void 0 : o.map((c) => {
|
|
24
|
+
if (c.shape.name === "rect") {
|
|
24
25
|
const {
|
|
25
|
-
x:
|
|
26
|
-
y:
|
|
27
|
-
width:
|
|
28
|
-
height:
|
|
29
|
-
} =
|
|
30
|
-
return u(
|
|
31
|
-
shape: u(
|
|
32
|
-
x:
|
|
33
|
-
y:
|
|
26
|
+
x: L,
|
|
27
|
+
y: E,
|
|
28
|
+
width: T,
|
|
29
|
+
height: f
|
|
30
|
+
} = c.shape;
|
|
31
|
+
return a(u({}, c), {
|
|
32
|
+
shape: a(u({}, c.shape), {
|
|
33
|
+
x: L + T / 2,
|
|
34
|
+
y: E + f / 2
|
|
34
35
|
})
|
|
35
36
|
});
|
|
36
37
|
}
|
|
37
|
-
return
|
|
38
|
-
})) != null ?
|
|
38
|
+
return c;
|
|
39
|
+
})) != null ? r : []
|
|
39
40
|
});
|
|
40
|
-
},
|
|
41
|
-
var o,
|
|
42
|
-
return u(
|
|
43
|
-
labels: (
|
|
44
|
-
if (
|
|
41
|
+
}, Oe = (l) => {
|
|
42
|
+
var o, r;
|
|
43
|
+
return a(u({}, l), {
|
|
44
|
+
labels: (r = (o = l.labels) == null ? void 0 : o.map((c) => {
|
|
45
|
+
if (c.shape.name === "rect") {
|
|
45
46
|
const {
|
|
46
|
-
x:
|
|
47
|
-
y:
|
|
48
|
-
width:
|
|
49
|
-
height:
|
|
50
|
-
} =
|
|
51
|
-
return u(
|
|
52
|
-
shape: u(
|
|
53
|
-
x:
|
|
54
|
-
y:
|
|
47
|
+
x: L,
|
|
48
|
+
y: E,
|
|
49
|
+
width: T,
|
|
50
|
+
height: f
|
|
51
|
+
} = c.shape;
|
|
52
|
+
return a(u({}, c), {
|
|
53
|
+
shape: a(u({}, c.shape), {
|
|
54
|
+
x: L - T / 2,
|
|
55
|
+
y: E - f / 2
|
|
55
56
|
})
|
|
56
57
|
});
|
|
57
58
|
}
|
|
58
|
-
return
|
|
59
|
-
})) != null ?
|
|
59
|
+
return c;
|
|
60
|
+
})) != null ? r : []
|
|
60
61
|
});
|
|
61
|
-
},
|
|
62
|
-
sample:
|
|
62
|
+
}, Be = ({
|
|
63
|
+
sample: l,
|
|
63
64
|
labelDefinitions: o,
|
|
64
|
-
onChange:
|
|
65
|
-
leftRatio:
|
|
66
|
-
resizable:
|
|
67
|
-
minLeftRatio:
|
|
68
|
-
maxLeftRatio:
|
|
69
|
-
minLeftWidth:
|
|
70
|
-
onRatioChange:
|
|
71
|
-
ocrRecognize:
|
|
72
|
-
coordinateType:
|
|
73
|
-
hideRightSide:
|
|
74
|
-
readOnly:
|
|
65
|
+
onChange: r,
|
|
66
|
+
leftRatio: c,
|
|
67
|
+
resizable: L = !0,
|
|
68
|
+
minLeftRatio: E,
|
|
69
|
+
maxLeftRatio: T,
|
|
70
|
+
minLeftWidth: f = ge,
|
|
71
|
+
onRatioChange: U,
|
|
72
|
+
ocrRecognize: re,
|
|
73
|
+
coordinateType: R = "top-left",
|
|
74
|
+
hideRightSide: D,
|
|
75
|
+
readOnly: B
|
|
75
76
|
}) => {
|
|
76
|
-
var
|
|
77
|
-
const i =
|
|
78
|
-
|
|
79
|
-
const
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
}, [
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
-
|
|
77
|
+
var K, Y, G, J, Q, Z;
|
|
78
|
+
const i = Te(() => R === "center" ? Oe(l) : l, [l, R]), [d, _] = b((K = i == null ? void 0 : i.labels) != null ? K : []), [m, p] = b(null), [O, v] = b(null), [A, y] = b(null);
|
|
79
|
+
b(Re);
|
|
80
|
+
const h = S(null), [Ne, oe] = b(0);
|
|
81
|
+
w(() => {
|
|
82
|
+
const t = setInterval(() => {
|
|
83
|
+
h.current && oe((e) => e + 1);
|
|
84
|
+
}, 100);
|
|
85
|
+
return () => clearInterval(t);
|
|
86
|
+
}, []);
|
|
87
|
+
const I = Math.min(F, Math.max(ne, E != null ? E : ne)), X = Math.min(F, Math.max(I, T != null ? T : F)), N = S(null), P = S(!1), x = (t, e) => {
|
|
88
|
+
let n = I;
|
|
89
|
+
return typeof f == "number" && f >= 0 && e && e > 0 && (n = Math.max(n, Math.min(F, f / e))), Math.min(X, Math.max(n, t));
|
|
90
|
+
}, k = typeof c == "number", [se, $] = b(x(c != null ? c : De));
|
|
91
|
+
w(() => {
|
|
92
|
+
k || $((t) => x(t));
|
|
93
|
+
}, [I, X]);
|
|
94
|
+
const le = (Y = N.current) == null ? void 0 : Y.clientWidth, ce = x(k ? c : se, le), j = D ? 1 : ce, ue = D ? 0 : 1 - j, ae = D ? !1 : L, [, H] = b(0);
|
|
95
|
+
w(() => {
|
|
96
|
+
const t = N.current;
|
|
89
97
|
if (!t)
|
|
90
98
|
return;
|
|
91
99
|
let e = null, n = 0;
|
|
92
100
|
if (typeof ResizeObserver != "undefined")
|
|
93
101
|
e = new ResizeObserver(() => {
|
|
94
102
|
cancelAnimationFrame(n), n = requestAnimationFrame(() => {
|
|
95
|
-
|
|
103
|
+
H((s) => s + 1);
|
|
96
104
|
});
|
|
97
105
|
}), e.observe(t);
|
|
98
106
|
else {
|
|
99
|
-
const
|
|
100
|
-
return window.addEventListener("resize",
|
|
101
|
-
window.removeEventListener("resize",
|
|
107
|
+
const s = () => H((M) => M + 1);
|
|
108
|
+
return window.addEventListener("resize", s), () => {
|
|
109
|
+
window.removeEventListener("resize", s);
|
|
102
110
|
};
|
|
103
111
|
}
|
|
104
112
|
return () => {
|
|
105
113
|
e && e.disconnect(), cancelAnimationFrame(n);
|
|
106
114
|
};
|
|
107
|
-
}, []),
|
|
115
|
+
}, []), w(() => {
|
|
108
116
|
var t;
|
|
109
|
-
|
|
110
|
-
}, [i]),
|
|
111
|
-
|
|
112
|
-
}, [
|
|
113
|
-
|
|
114
|
-
}, [
|
|
115
|
-
const
|
|
116
|
-
const e =
|
|
117
|
+
_((t = i == null ? void 0 : i.labels) != null ? t : []), p(null), v(null), y(null);
|
|
118
|
+
}, [i]), w(() => {
|
|
119
|
+
A && (p(null), v(null));
|
|
120
|
+
}, [A]), w(() => {
|
|
121
|
+
m !== null && y(null);
|
|
122
|
+
}, [m]);
|
|
123
|
+
const q = (t) => {
|
|
124
|
+
const e = N.current;
|
|
117
125
|
if (!e)
|
|
118
126
|
return;
|
|
119
|
-
const n = e.getBoundingClientRect(),
|
|
120
|
-
|
|
121
|
-
},
|
|
122
|
-
if (!
|
|
127
|
+
const n = e.getBoundingClientRect(), s = x((t - n.left) / n.width, n.width);
|
|
128
|
+
U && U(s), k || $(s);
|
|
129
|
+
}, ie = (t) => {
|
|
130
|
+
if (!L)
|
|
123
131
|
return;
|
|
124
|
-
t.preventDefault(),
|
|
125
|
-
const e = (
|
|
126
|
-
|
|
132
|
+
t.preventDefault(), P.current = !0, document.body.style.userSelect = "none", document.body.style.setProperty("-webkit-user-select", "none"), document.body.style.setProperty("-moz-user-select", "none"), document.body.style.setProperty("-ms-user-select", "none"), q(t.clientX);
|
|
133
|
+
const e = (s) => {
|
|
134
|
+
P.current && (s.preventDefault(), q(s.clientX));
|
|
127
135
|
}, n = () => {
|
|
128
|
-
|
|
136
|
+
P.current = !1, document.body.style.userSelect = "", document.body.style.setProperty("-webkit-user-select", ""), document.body.style.setProperty("-moz-user-select", ""), document.body.style.setProperty("-ms-user-select", ""), window.removeEventListener("mousemove", e), window.removeEventListener("mouseup", n);
|
|
129
137
|
};
|
|
130
138
|
window.addEventListener("mousemove", e), window.addEventListener("mouseup", n);
|
|
131
139
|
};
|
|
132
|
-
return /* @__PURE__ */
|
|
140
|
+
return /* @__PURE__ */ Ee("div", {
|
|
133
141
|
className: "vlm-annotation-wrap",
|
|
134
|
-
ref:
|
|
135
|
-
children: [/* @__PURE__ */
|
|
142
|
+
ref: N,
|
|
143
|
+
children: [/* @__PURE__ */ g("div", {
|
|
136
144
|
className: "vlm-annotation-left",
|
|
137
145
|
style: {
|
|
138
|
-
flex: `${
|
|
139
|
-
minWidth: typeof
|
|
146
|
+
flex: `${j} 1 0%`,
|
|
147
|
+
minWidth: typeof f == "number" ? `${f}px` : void 0
|
|
140
148
|
},
|
|
141
|
-
children: /* @__PURE__ */
|
|
149
|
+
children: /* @__PURE__ */ g(Le, {
|
|
150
|
+
ref: h,
|
|
142
151
|
sample: i,
|
|
143
152
|
labelDefinitions: o,
|
|
144
|
-
labels:
|
|
153
|
+
labels: d,
|
|
145
154
|
onChange: (t) => {
|
|
146
|
-
if (
|
|
147
|
-
const e = u(
|
|
155
|
+
if (r) {
|
|
156
|
+
const e = a(u({}, i), {
|
|
148
157
|
labels: t
|
|
149
158
|
});
|
|
150
|
-
|
|
159
|
+
r(R === "center" ? V(e) : e);
|
|
151
160
|
}
|
|
152
|
-
|
|
161
|
+
_(t);
|
|
153
162
|
},
|
|
154
|
-
onRegionSelect:
|
|
163
|
+
onRegionSelect: y,
|
|
155
164
|
onRegionChange: (t, e) => {
|
|
156
165
|
},
|
|
157
|
-
ocrRecognize:
|
|
158
|
-
activeLabelValue:
|
|
166
|
+
ocrRecognize: re,
|
|
167
|
+
activeLabelValue: m,
|
|
159
168
|
onClearActive: () => {
|
|
160
|
-
|
|
169
|
+
p(null), v(null);
|
|
161
170
|
},
|
|
162
|
-
selectedRegion:
|
|
171
|
+
selectedRegion: A,
|
|
163
172
|
onAppendTextToActive: (t) => {
|
|
164
|
-
if (!
|
|
173
|
+
if (!m || O === null)
|
|
165
174
|
return;
|
|
166
|
-
const e =
|
|
175
|
+
const e = d[O];
|
|
167
176
|
if (!e)
|
|
168
177
|
return;
|
|
169
|
-
const n =
|
|
170
|
-
content: u(
|
|
171
|
-
[n]:
|
|
178
|
+
const n = m.label.id, M = (e.content[n] || "") + t, C = [...d], W = a(u({}, e), {
|
|
179
|
+
content: a(u({}, e.content), {
|
|
180
|
+
[n]: M
|
|
172
181
|
})
|
|
173
182
|
});
|
|
174
|
-
|
|
175
|
-
const
|
|
176
|
-
region:
|
|
183
|
+
C[O] = W, _(C);
|
|
184
|
+
const de = a(u({}, m), {
|
|
185
|
+
region: W
|
|
177
186
|
});
|
|
178
|
-
if (
|
|
179
|
-
}, 0),
|
|
180
|
-
const
|
|
181
|
-
labels:
|
|
187
|
+
if (p(de), (o == null ? void 0 : o.find((z) => z.id === n)) && setTimeout(() => {
|
|
188
|
+
}, 0), r) {
|
|
189
|
+
const z = a(u({}, i), {
|
|
190
|
+
labels: C
|
|
182
191
|
});
|
|
183
|
-
|
|
192
|
+
r(R === "center" ? V(z) : z);
|
|
184
193
|
}
|
|
185
194
|
},
|
|
186
|
-
readOnly:
|
|
195
|
+
readOnly: B
|
|
187
196
|
})
|
|
188
|
-
}),
|
|
197
|
+
}), ae ? /* @__PURE__ */ g("div", {
|
|
189
198
|
className: "vlm-annotation-resizer",
|
|
190
199
|
role: "separator",
|
|
191
200
|
"aria-orientation": "vertical",
|
|
192
|
-
onMouseDown:
|
|
193
|
-
}) : null, !
|
|
201
|
+
onMouseDown: ie
|
|
202
|
+
}) : null, !D && /* @__PURE__ */ g("div", {
|
|
194
203
|
className: "vlm-annotation-right",
|
|
195
204
|
style: {
|
|
196
|
-
flex: `${
|
|
205
|
+
flex: `${ue} 1 0%`
|
|
197
206
|
},
|
|
198
|
-
children: /* @__PURE__ */
|
|
207
|
+
children: /* @__PURE__ */ g(ye, {
|
|
199
208
|
labelDefinitions: o,
|
|
200
|
-
labels:
|
|
201
|
-
selectedRegion:
|
|
202
|
-
activeLabelValue:
|
|
203
|
-
activeRegionNumber:
|
|
204
|
-
readOnly:
|
|
209
|
+
labels: d,
|
|
210
|
+
selectedRegion: A,
|
|
211
|
+
activeLabelValue: m,
|
|
212
|
+
activeRegionNumber: O,
|
|
213
|
+
readOnly: B,
|
|
214
|
+
onRegionClick: (t) => {
|
|
215
|
+
y(t);
|
|
216
|
+
},
|
|
217
|
+
onOCR: (t) => {
|
|
218
|
+
var n;
|
|
219
|
+
const e = d.find((s) => s.id === t);
|
|
220
|
+
e && y(e), (n = h.current) == null || n.performOCRById(t);
|
|
221
|
+
},
|
|
222
|
+
ocrRecognizing: (J = (G = h.current) == null ? void 0 : G.ocrRecognizingRef) == null ? void 0 : J.current,
|
|
223
|
+
ocrErrors: (Z = (Q = h.current) == null ? void 0 : Q.ocrErrorRef) == null ? void 0 : Z.current,
|
|
224
|
+
onDelete: (t) => {
|
|
225
|
+
const e = d.find((n) => n.id === t);
|
|
226
|
+
e && y(e), Ae.confirm({
|
|
227
|
+
title: Me,
|
|
228
|
+
content: we,
|
|
229
|
+
okText: _e,
|
|
230
|
+
cancelText: he,
|
|
231
|
+
onOk: () => {
|
|
232
|
+
const n = d.filter((s) => s.id !== t);
|
|
233
|
+
if (_(n), (A == null ? void 0 : A.id) === t && y(null), (m == null ? void 0 : m.region.id) === t && (p(null), v(null)), r) {
|
|
234
|
+
const s = a(u({}, i), {
|
|
235
|
+
labels: n
|
|
236
|
+
});
|
|
237
|
+
r(R === "center" ? V(s) : s);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
});
|
|
241
|
+
},
|
|
205
242
|
onInputActive: (t, e) => {
|
|
206
|
-
if (e !== void 0 &&
|
|
207
|
-
const n =
|
|
243
|
+
if (e !== void 0 && d[e]) {
|
|
244
|
+
const n = d[e], s = {
|
|
208
245
|
label: t.label,
|
|
209
246
|
// 使用传入的 label,确保 label 字段被更新
|
|
210
|
-
region:
|
|
247
|
+
region: u({}, n)
|
|
211
248
|
};
|
|
212
|
-
|
|
249
|
+
p(s), v(e);
|
|
213
250
|
} else
|
|
214
|
-
|
|
251
|
+
p(t), e !== void 0 && v(e);
|
|
215
252
|
},
|
|
216
253
|
onChange: (t, e) => {
|
|
217
254
|
if (t !== null && e !== void 0) {
|
|
218
|
-
const n = [...
|
|
219
|
-
n[e] = t.region,
|
|
220
|
-
const
|
|
255
|
+
const n = [...d];
|
|
256
|
+
n[e] = t.region, _(n);
|
|
257
|
+
const s = {
|
|
221
258
|
label: t.label,
|
|
222
259
|
// 确保使用传入的 label
|
|
223
260
|
region: n[e]
|
|
224
261
|
// 使用更新后的 region
|
|
225
262
|
};
|
|
226
|
-
if (
|
|
227
|
-
const
|
|
263
|
+
if (p(s), v(e), r) {
|
|
264
|
+
const M = a(u({}, i), {
|
|
228
265
|
labels: n
|
|
229
266
|
});
|
|
230
|
-
|
|
267
|
+
r(R === "center" ? V(M) : M);
|
|
231
268
|
}
|
|
232
269
|
} else
|
|
233
|
-
|
|
270
|
+
p(null), v(null);
|
|
234
271
|
}
|
|
235
272
|
})
|
|
236
273
|
})]
|
|
237
274
|
});
|
|
238
275
|
};
|
|
239
276
|
export {
|
|
240
|
-
|
|
241
|
-
|
|
277
|
+
V as convertTopLeftToCenter,
|
|
278
|
+
Be as default
|
|
242
279
|
};
|