@glodon-aiot/dataset-annotation 3.20.1 → 3.20.2-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/es/components/ClassificationImageAnnotation/components/ClassificationImageDetail/index.mjs +26 -25
- package/dist/es/components/DetectionAnnotation/components/ImageDetail/index.mjs +19 -18
- package/dist/es/components/DetectionAnnotation/components/LabelMaker/index.mjs +171 -161
- package/dist/es/components/DetectionAnnotation/index.mjs +637 -653
- package/dist/es/index.mjs +1 -1
- package/dist/lib/index.js +3 -3
- package/dist/src/components/DetectionAnnotation/components/LabelMaker/index.d.ts +1 -0
- package/package.json +2 -2
|
@@ -9,9 +9,9 @@ var S = (o, a, c) => a in o ? re(o, a, { enumerable: !0, configurable: !0, writa
|
|
|
9
9
|
for (var c of _(a))
|
|
10
10
|
ue.call(a, c) && S(o, c, a[c]);
|
|
11
11
|
return o;
|
|
12
|
-
},
|
|
12
|
+
}, Y = (o, a) => de(o, fe(a));
|
|
13
13
|
import { jsxs as j, jsx as e } from "react/jsx-runtime";
|
|
14
|
-
import { useRef as w, useState as v, useCallback as
|
|
14
|
+
import { useRef as w, useState as v, useCallback as K, useEffect as f } from "react";
|
|
15
15
|
import { Button as g, Space as he, Tooltip as p } from "antd";
|
|
16
16
|
import { useKeyPress as M } from "ahooks";
|
|
17
17
|
import { ZoomInOutlined as ge, ZoomOutOutlined as ve, DragOutlined as be, ExpandOutlined as xe, ClearOutlined as ye } from "@ant-design/icons";
|
|
@@ -38,26 +38,26 @@ const Be = (o) => {
|
|
|
38
38
|
readonly: u,
|
|
39
39
|
showLabelList: ie = !0,
|
|
40
40
|
onLoadingChange: N
|
|
41
|
-
} = o,
|
|
41
|
+
} = o, P = w(null), L = w(null), [n, Z] = v(), [ne, De] = v(!1), [C, $] = v(!1), [B, F] = v(1), [k, D] = v({
|
|
42
42
|
x: 0,
|
|
43
43
|
y: 0
|
|
44
44
|
}), [y, I] = v(() => !!u), h = w(null), X = w(k);
|
|
45
45
|
X.current = k;
|
|
46
|
-
const q = 1.15, se = 0.2, le = 10,
|
|
47
|
-
|
|
48
|
-
const
|
|
49
|
-
const r = i > 0 ? 1 / q : q, d = Math.min(le, Math.max(se,
|
|
50
|
-
|
|
46
|
+
const q = 1.15, se = 0.2, le = 10, H = w(B);
|
|
47
|
+
H.current = B;
|
|
48
|
+
const E = K((i, s, l) => {
|
|
49
|
+
const r = i > 0 ? 1 / q : q, d = Math.min(le, Math.max(se, H.current * r)), O = d !== H.current;
|
|
50
|
+
F(d), O && s != null && l != null && D((Q) => ({
|
|
51
51
|
x: s - (s - Q.x) * r,
|
|
52
52
|
y: l - (l - Q.y) * r
|
|
53
53
|
}));
|
|
54
|
-
}, []), ae =
|
|
54
|
+
}, []), ae = K((i) => {
|
|
55
55
|
if (i.preventDefault(), !L.current)
|
|
56
56
|
return;
|
|
57
57
|
const s = L.current.getBoundingClientRect(), l = i.clientX - s.left - s.width / 2, r = i.clientY - s.top - s.height / 2;
|
|
58
|
-
|
|
59
|
-
}, [
|
|
60
|
-
|
|
58
|
+
E(i.deltaY, l, r);
|
|
59
|
+
}, [E]), oe = K(() => {
|
|
60
|
+
F(1), D({
|
|
61
61
|
x: 0,
|
|
62
62
|
y: 0
|
|
63
63
|
});
|
|
@@ -90,7 +90,7 @@ const Be = (o) => {
|
|
|
90
90
|
i.removeEventListener("mousedown", s), window.removeEventListener("mousemove", l), window.removeEventListener("mouseup", r);
|
|
91
91
|
};
|
|
92
92
|
}, [y]);
|
|
93
|
-
const
|
|
93
|
+
const R = n != null ? n : t, T = (G = R == null ? void 0 : R.labels) != null && G.length ? R.labels[0] : void 0;
|
|
94
94
|
M("rightarrow", () => {
|
|
95
95
|
b == null || b();
|
|
96
96
|
}), M("leftarrow", () => {
|
|
@@ -106,28 +106,28 @@ const Be = (o) => {
|
|
|
106
106
|
}, []), f(() => {
|
|
107
107
|
(t == null ? void 0 : t.id) !== (n == null ? void 0 : n.id) && Z(void 0);
|
|
108
108
|
}, [t == null ? void 0 : t.id, n == null ? void 0 : n.id]), f(() => {
|
|
109
|
-
t != null && t.fileUrl && (
|
|
109
|
+
t != null && t.fileUrl && (F(1), D({
|
|
110
110
|
x: 0,
|
|
111
111
|
y: 0
|
|
112
112
|
}));
|
|
113
113
|
}, [t == null ? void 0 : t.fileUrl]), f(() => {
|
|
114
114
|
u && I(!0);
|
|
115
115
|
}, [u]), f(() => {
|
|
116
|
-
t != null && t.fileUrl &&
|
|
116
|
+
t != null && t.fileUrl && $(!0);
|
|
117
117
|
}, [t == null ? void 0 : t.fileUrl]), f(() => {
|
|
118
118
|
N == null || N(C);
|
|
119
119
|
}, [C, N]), f(() => {
|
|
120
120
|
var i;
|
|
121
121
|
if ((i = n == null ? void 0 : n.labels) != null && i.length) {
|
|
122
122
|
const s = n.labels[0].id, l = m.find((r) => r.id === s);
|
|
123
|
-
l && (n.labels = [
|
|
123
|
+
l && (n.labels = [Y(U({}, n.labels[0]), {
|
|
124
124
|
id: l.id,
|
|
125
125
|
label: l.label
|
|
126
126
|
})], Z(U({}, n)));
|
|
127
127
|
}
|
|
128
128
|
}, [m]);
|
|
129
129
|
const ce = () => {
|
|
130
|
-
|
|
130
|
+
P.current && $(!1);
|
|
131
131
|
}, A = (i) => {
|
|
132
132
|
if (!t || u)
|
|
133
133
|
return;
|
|
@@ -135,11 +135,11 @@ const Be = (o) => {
|
|
|
135
135
|
id: i.id,
|
|
136
136
|
label: i.label,
|
|
137
137
|
box: []
|
|
138
|
-
}] : [], l =
|
|
138
|
+
}] : [], l = Y(U({}, t), {
|
|
139
139
|
labels: s
|
|
140
140
|
});
|
|
141
141
|
Z(l), W == null || W(l);
|
|
142
|
-
},
|
|
142
|
+
}, V = T ? m.find((i) => i.id === T.id) : void 0;
|
|
143
143
|
return /* @__PURE__ */ j("div", {
|
|
144
144
|
className: "classification-image-detail",
|
|
145
145
|
children: [/* @__PURE__ */ e("div", {
|
|
@@ -167,14 +167,14 @@ const Be = (o) => {
|
|
|
167
167
|
placement: "right",
|
|
168
168
|
children: /* @__PURE__ */ e(g, {
|
|
169
169
|
icon: /* @__PURE__ */ e(ge, {}),
|
|
170
|
-
onClick: () =>
|
|
170
|
+
onClick: () => E(-100)
|
|
171
171
|
})
|
|
172
172
|
}), /* @__PURE__ */ e(p, {
|
|
173
173
|
title: "缩小",
|
|
174
174
|
placement: "right",
|
|
175
175
|
children: /* @__PURE__ */ e(g, {
|
|
176
176
|
icon: /* @__PURE__ */ e(ve, {}),
|
|
177
|
-
onClick: () =>
|
|
177
|
+
onClick: () => E(100)
|
|
178
178
|
})
|
|
179
179
|
}), /* @__PURE__ */ e(p, {
|
|
180
180
|
title: "拖动-按住ctrl",
|
|
@@ -196,7 +196,7 @@ const Be = (o) => {
|
|
|
196
196
|
placement: "right",
|
|
197
197
|
children: /* @__PURE__ */ e(g, {
|
|
198
198
|
icon: /* @__PURE__ */ e(ye, {}),
|
|
199
|
-
disabled: !
|
|
199
|
+
disabled: !T,
|
|
200
200
|
onClick: () => A(null)
|
|
201
201
|
})
|
|
202
202
|
})]
|
|
@@ -225,16 +225,17 @@ const Be = (o) => {
|
|
|
225
225
|
children: /* @__PURE__ */ e("div", {
|
|
226
226
|
className: "classification-image-transform",
|
|
227
227
|
style: {
|
|
228
|
-
transform: `translate(${k.x}px, ${k.y}px) scale(${
|
|
228
|
+
transform: `translate(${k.x}px, ${k.y}px) scale(${B})`,
|
|
229
229
|
transformOrigin: "center center"
|
|
230
230
|
},
|
|
231
231
|
children: /* @__PURE__ */ e("img", {
|
|
232
|
-
ref:
|
|
232
|
+
ref: P,
|
|
233
233
|
src: (t == null ? void 0 : t.fileUrl) || "",
|
|
234
234
|
alt: "",
|
|
235
235
|
draggable: !1,
|
|
236
236
|
onDragStart: (i) => i.preventDefault(),
|
|
237
237
|
onLoad: ce,
|
|
238
|
+
onError: () => $(!1),
|
|
238
239
|
style: {
|
|
239
240
|
maxWidth: "100%",
|
|
240
241
|
maxHeight: "100%",
|
|
@@ -259,7 +260,7 @@ const Be = (o) => {
|
|
|
259
260
|
children: /* @__PURE__ */ e(pe, {
|
|
260
261
|
title: "标签列表",
|
|
261
262
|
data: m,
|
|
262
|
-
selected:
|
|
263
|
+
selected: V != null ? V : null,
|
|
263
264
|
onSelectedChange: A,
|
|
264
265
|
showSearch: !0,
|
|
265
266
|
searchPlaceholder: "请输入标签名称搜索",
|
|
@@ -9,7 +9,7 @@ var A = (n, l, o) => l in n ? _(n, l, { enumerable: !0, configurable: !0, writab
|
|
|
9
9
|
for (var o of M(l))
|
|
10
10
|
ee.call(l, o) && A(n, o, l[o]);
|
|
11
11
|
return n;
|
|
12
|
-
},
|
|
12
|
+
}, I = (n, l) => $(n, V(l));
|
|
13
13
|
import { jsxs as b, jsx as d } from "react/jsx-runtime";
|
|
14
14
|
import { useRef as B, useState as h, useEffect as g } from "react";
|
|
15
15
|
import { Button as H } from "antd";
|
|
@@ -20,7 +20,7 @@ import se from "../LabelMaker/index.mjs";
|
|
|
20
20
|
import O from "../../../Iconfont/index.mjs";
|
|
21
21
|
import te from "../../../DetectionStatus/index.mjs";
|
|
22
22
|
const he = (n) => {
|
|
23
|
-
var
|
|
23
|
+
var P, z, F;
|
|
24
24
|
const {
|
|
25
25
|
datasetId: l,
|
|
26
26
|
isImageDetailVisible: o = !0,
|
|
@@ -38,7 +38,7 @@ const he = (n) => {
|
|
|
38
38
|
showLabelList: D = !0,
|
|
39
39
|
renderLabelItem: J,
|
|
40
40
|
onLoadingChange: w
|
|
41
|
-
} = n, Q = B(null), T = B({}), [
|
|
41
|
+
} = n, Q = B(null), T = B({}), [E, W] = h({}), [y, p] = h(), [a, R] = h(), [X, Y] = h(!1), [x, u] = h(!1);
|
|
42
42
|
K("rightarrow", () => {
|
|
43
43
|
v && v();
|
|
44
44
|
}), K("leftarrow", () => {
|
|
@@ -47,12 +47,12 @@ const he = (n) => {
|
|
|
47
47
|
X && N && N();
|
|
48
48
|
}, []), g(() => {
|
|
49
49
|
var s, t;
|
|
50
|
-
if (p(void 0), (e == null ? void 0 : e.id) !== (a == null ? void 0 : a.id) &&
|
|
50
|
+
if (p(void 0), (e == null ? void 0 : e.id) !== (a == null ? void 0 : a.id) && R(void 0), !o || !((s = e == null ? void 0 : e.labels) != null && s.length))
|
|
51
51
|
return;
|
|
52
52
|
const i = (t = a || e) == null ? void 0 : t.labels.reduce((f, j) => (f[j.id] ? ++f[j.id] : f[j.id] = 1, f), {});
|
|
53
53
|
W(i || {});
|
|
54
54
|
}, [o, e, a]), g(() => {
|
|
55
|
-
e != null && e.fileUrl &&
|
|
55
|
+
e != null && e.fileUrl && u(!0);
|
|
56
56
|
}, [e == null ? void 0 : e.fileUrl]), g(() => {
|
|
57
57
|
w && w(x);
|
|
58
58
|
}, [x, w]), g(() => {
|
|
@@ -60,14 +60,14 @@ const he = (n) => {
|
|
|
60
60
|
const i = [];
|
|
61
61
|
a.labels.forEach((s) => {
|
|
62
62
|
const t = r.find((f) => f.id === s.id);
|
|
63
|
-
t && i.push(
|
|
63
|
+
t && i.push(I(m({}, s), {
|
|
64
64
|
label: t.label
|
|
65
65
|
}));
|
|
66
|
-
}), a.labels = i,
|
|
66
|
+
}), a.labels = i, R(m({}, a));
|
|
67
67
|
}
|
|
68
68
|
}, [r]);
|
|
69
69
|
const Z = () => {
|
|
70
|
-
Q.current &&
|
|
70
|
+
Q.current && u(!1);
|
|
71
71
|
};
|
|
72
72
|
return window.onresize = Z, /* @__PURE__ */ b("div", {
|
|
73
73
|
className: "detection-image-detail",
|
|
@@ -93,7 +93,7 @@ const he = (n) => {
|
|
|
93
93
|
}), /* @__PURE__ */ b("div", {
|
|
94
94
|
className: "select-main",
|
|
95
95
|
ref: T,
|
|
96
|
-
children: [((
|
|
96
|
+
children: [((P = e == null ? void 0 : e.sampleFileName) == null ? void 0 : P.name) && /* @__PURE__ */ d("div", {
|
|
97
97
|
className: "img-detail-name-overlay",
|
|
98
98
|
children: e.sampleFileName.name
|
|
99
99
|
}), /* @__PURE__ */ d("div", {
|
|
@@ -104,25 +104,26 @@ const he = (n) => {
|
|
|
104
104
|
}), /* @__PURE__ */ d(se, {
|
|
105
105
|
disabled: G,
|
|
106
106
|
imageUrl: (e == null ? void 0 : e.fileUrl) || "",
|
|
107
|
-
pen:
|
|
108
|
-
labels: ((
|
|
107
|
+
pen: y,
|
|
108
|
+
labels: ((z = a ? a.labels : e == null ? void 0 : e.labels) == null ? void 0 : z.map((i) => {
|
|
109
109
|
var s;
|
|
110
|
-
return
|
|
110
|
+
return I(m({}, i), {
|
|
111
111
|
color: ((s = r.find((t) => t.id === i.id)) == null ? void 0 : s.color) || ""
|
|
112
112
|
});
|
|
113
113
|
})) || [],
|
|
114
|
-
onImageLoad: () =>
|
|
114
|
+
onImageLoad: () => u(!1),
|
|
115
|
+
onImageError: () => u(!1),
|
|
115
116
|
onChange: (i) => {
|
|
116
117
|
if (p(void 0), !e)
|
|
117
118
|
return;
|
|
118
|
-
const s =
|
|
119
|
+
const s = I(m({}, e), {
|
|
119
120
|
labels: i.map((t) => ({
|
|
120
121
|
id: t.id,
|
|
121
122
|
label: t.label,
|
|
122
123
|
box: t.box
|
|
123
124
|
}))
|
|
124
125
|
});
|
|
125
|
-
|
|
126
|
+
R(s), k && k(s);
|
|
126
127
|
},
|
|
127
128
|
isPreLabel: C,
|
|
128
129
|
renderLabelItem: J
|
|
@@ -142,13 +143,13 @@ const he = (n) => {
|
|
|
142
143
|
children: /* @__PURE__ */ d(ie, {
|
|
143
144
|
datasetId: l,
|
|
144
145
|
selectMode: "single",
|
|
145
|
-
data: ((F = Object.keys(
|
|
146
|
+
data: ((F = Object.keys(E)) == null ? void 0 : F.map((i) => {
|
|
146
147
|
const s = r.find((t) => t.id === i);
|
|
147
148
|
if (s)
|
|
148
|
-
return s.count =
|
|
149
|
+
return s.count = E[i], s;
|
|
149
150
|
}).filter((i) => !!i)) || [],
|
|
150
151
|
shortcut: !0,
|
|
151
|
-
selected:
|
|
152
|
+
selected: y ? [y] : [],
|
|
152
153
|
onSelectedChange: (i) => {
|
|
153
154
|
if (i.length > 2) {
|
|
154
155
|
console.warn("不支持选中多个标签");
|