@glodon-aiot/dataset-annotation 3.14.0-alpha.32 → 3.14.0-alpha.34
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/VLMAnnotation/RegionItem.mjs +1 -1
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useAIButtonHover.mjs +193 -0
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useDrawingMode.mjs +300 -237
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionSelection.mjs +158 -56
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/index.mjs +424 -397
- package/dist/es/components/VLMAnnotation/components/AIErrorTooltip/AIErrorTooltip.less.mjs +4 -0
- package/dist/es/components/VLMAnnotation/components/AIErrorTooltip/index.mjs +24 -0
- package/dist/es/components/VLMAnnotation/components/ZoomControls.mjs +1 -1
- package/dist/es/components/VLMAnnotation/constants.mjs +1 -1
- package/dist/es/components/VLMAnnotationDetail/MarkVLMBoxModal/QADetail/QAGenerationConfig.mjs +217 -167
- package/dist/es/components/VLMAnnotationDetail/MarkVLMBoxModal/QADetail/index.mjs +114 -122
- package/dist/es/components/VLMAnnotationDetail/VLMDetail/index.mjs +445 -0
- package/dist/es/components/VLMAnnotationDetail/VlmModal/index.mjs +249 -113
- package/dist/es/components/VLMAnnotationDetail/index.mjs +219 -213
- package/dist/es/index.mjs +1 -1
- package/dist/lib/index.js +4 -4
- package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useAIButtonHover.d.ts +16 -0
- package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useDrawingMode.d.ts +2 -1
- package/dist/src/components/VLMAnnotation/components/AIErrorTooltip/index.d.ts +8 -0
- package/dist/src/components/VLMAnnotation/constants.d.ts +2 -2
- package/dist/src/components/VLMAnnotationDetail/MarkVLMBoxModal/QADetail/QAGenerationConfig.d.ts +1 -0
- package/dist/src/components/VLMAnnotationDetail/VLMDetail/index.d.ts +21 -0
- package/dist/src/components/VLMAnnotationDetail/VlmModal/index.d.ts +11 -2
- package/package.json +2 -2
- package/dist/es/components/VLMAnnotationDetail/MarkVLMBoxModal/index.mjs +0 -455
- /package/dist/es/components/VLMAnnotationDetail/{MarkVLMBoxModal → VLMDetail}/style.less.mjs +0 -0
|
@@ -1,51 +1,90 @@
|
|
|
1
|
-
import { useEffect as
|
|
2
|
-
import { fabric as
|
|
3
|
-
import { SELECTED_RECT_FILL_COLOR as
|
|
4
|
-
const
|
|
5
|
-
canvas:
|
|
6
|
-
onRegionSelect:
|
|
7
|
-
createDeleteControl:
|
|
8
|
-
createOCRControl:
|
|
9
|
-
textLayersMapRef:
|
|
10
|
-
rectMapRef:
|
|
1
|
+
import { useEffect as W } from "react";
|
|
2
|
+
import { fabric as f } from "fabric";
|
|
3
|
+
import { SELECTED_RECT_FILL_COLOR as k, RECT_STROKE_COLOR as X, CONTROL_POINT_COLOR as j, CONTROL_POINT_SIZE as N, TRANSPARENT_FILL as Y, BASE_STROKE_WIDTH as F, AI_CONTROL_OFFSET_X as q, AI_CONTROL_OFFSET_Y as z, AI_ICON_SIZE as D } from "../../constants.mjs";
|
|
4
|
+
const G = ({
|
|
5
|
+
canvas: o,
|
|
6
|
+
onRegionSelect: l,
|
|
7
|
+
createDeleteControl: h,
|
|
8
|
+
createOCRControl: g,
|
|
9
|
+
textLayersMapRef: O,
|
|
10
|
+
rectMapRef: y
|
|
11
11
|
}) => {
|
|
12
|
-
|
|
13
|
-
if (!
|
|
12
|
+
W(() => {
|
|
13
|
+
if (!o)
|
|
14
14
|
return;
|
|
15
|
-
const
|
|
15
|
+
const C = () => {
|
|
16
16
|
const t = /* @__PURE__ */ new Set();
|
|
17
|
-
return
|
|
18
|
-
|
|
19
|
-
t.add(
|
|
17
|
+
return O.current.forEach((n) => {
|
|
18
|
+
n.forEach((c) => {
|
|
19
|
+
t.add(c);
|
|
20
20
|
});
|
|
21
21
|
}), t;
|
|
22
|
-
},
|
|
23
|
-
const t =
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
fill:
|
|
22
|
+
}, m = () => {
|
|
23
|
+
const t = C();
|
|
24
|
+
o.getObjects().forEach((n) => {
|
|
25
|
+
n instanceof f.Rect && !t.has(n) && n.set({
|
|
26
|
+
fill: Y
|
|
27
27
|
// 移除填充色
|
|
28
28
|
});
|
|
29
29
|
});
|
|
30
|
-
},
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
30
|
+
}, S = (t) => {
|
|
31
|
+
const n = t.getCoords();
|
|
32
|
+
if (!n || n.length < 4)
|
|
33
|
+
return null;
|
|
34
|
+
const c = q, u = z + D + 4, a = n[0], i = n[1], d = n[2], s = i, e = {
|
|
35
|
+
x: d.x - i.x,
|
|
36
|
+
y: d.y - i.y
|
|
37
|
+
}, r = {
|
|
38
|
+
x: a.x - i.x,
|
|
39
|
+
y: a.y - i.y
|
|
40
|
+
}, p = Math.sqrt(e.x * e.x + e.y * e.y), x = Math.sqrt(r.x * r.x + r.y * r.y), T = p > 1e-3 ? {
|
|
41
|
+
x: e.x / p,
|
|
42
|
+
y: e.y / p
|
|
43
|
+
} : {
|
|
44
|
+
x: 1,
|
|
45
|
+
y: 0
|
|
46
|
+
}, L = x > 1e-3 ? {
|
|
47
|
+
x: r.x / x,
|
|
48
|
+
y: r.y / x
|
|
49
|
+
} : {
|
|
50
|
+
x: 0,
|
|
51
|
+
y: -1
|
|
52
|
+
}, b = s.x + T.x * c - L.x * u, E = s.y + T.y * c - L.y * u, _ = o.viewportTransform;
|
|
53
|
+
if (!_)
|
|
54
|
+
return null;
|
|
55
|
+
const U = new f.Point(b, E), P = f.util.transformPoint(U, _), Z = o.getElement().getBoundingClientRect(), w = Z.left + P.x, B = Z.top + P.y;
|
|
56
|
+
return {
|
|
57
|
+
canvasCoords: {
|
|
58
|
+
x: b,
|
|
59
|
+
y: E
|
|
60
|
+
},
|
|
61
|
+
screenCoords: {
|
|
62
|
+
x: w,
|
|
63
|
+
y: B
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
}, R = () => {
|
|
67
|
+
var n, c;
|
|
68
|
+
m();
|
|
69
|
+
const t = o.getActiveObject();
|
|
70
|
+
if (t && t instanceof f.Rect) {
|
|
71
|
+
if (C().has(t)) {
|
|
72
|
+
o.discardActiveObject(), o.renderAll();
|
|
36
73
|
return;
|
|
37
74
|
}
|
|
38
|
-
const
|
|
75
|
+
const a = o.getZoom(), i = F / a;
|
|
39
76
|
t.set({
|
|
40
77
|
hasRotatingPoint: !1,
|
|
41
78
|
lockRotation: !0,
|
|
42
79
|
lockUniScaling: !1,
|
|
43
80
|
// 允许非等比缩放,控制点跟随鼠标
|
|
44
|
-
fill:
|
|
81
|
+
fill: k,
|
|
45
82
|
// 选中时添加填充色
|
|
83
|
+
stroke: X,
|
|
84
|
+
// 选中时取消高亮,使用普通边框颜色
|
|
46
85
|
strokeUniform: !0,
|
|
47
86
|
// 确保边框宽度不受缩放影响
|
|
48
|
-
strokeWidth:
|
|
87
|
+
strokeWidth: i,
|
|
49
88
|
// 确保边框宽度一致
|
|
50
89
|
objectCaching: !1,
|
|
51
90
|
// 禁用缓存,避免缩放时边框变虚
|
|
@@ -53,25 +92,57 @@ const b = ({
|
|
|
53
92
|
noScaleCache: !1,
|
|
54
93
|
cornerStyle: "circle",
|
|
55
94
|
// 设置控制点为圆形
|
|
56
|
-
cornerColor:
|
|
95
|
+
cornerColor: j,
|
|
57
96
|
// 设置控制点为紫色(填充色)
|
|
58
|
-
cornerSize:
|
|
97
|
+
cornerSize: N,
|
|
59
98
|
// 设置控制点大小(默认12,这里设置为6使其更小)
|
|
60
99
|
transparentCorners: !1
|
|
61
100
|
// 不透明,显示填充颜色
|
|
62
|
-
}), t.controls && t.controls.mtr && delete t.controls.mtr, t.controls.deleteControl || (t.controls.deleteControl =
|
|
63
|
-
const
|
|
64
|
-
|
|
101
|
+
}), t.controls && t.controls.mtr && delete t.controls.mtr, t.controls.deleteControl || (t.controls.deleteControl = h()), t.controls.ocrControl || (t.controls.ocrControl = g()), o.renderAll();
|
|
102
|
+
const d = S(t), s = y.current.get(t);
|
|
103
|
+
fetch("http://127.0.0.1:7243/ingest/f03da105-26de-4a72-9802-7a749afbd310", {
|
|
104
|
+
method: "POST",
|
|
105
|
+
headers: {
|
|
106
|
+
"Content-Type": "application/json"
|
|
107
|
+
},
|
|
108
|
+
body: JSON.stringify({
|
|
109
|
+
location: "useRegionSelection.ts:handleSelectionCreated",
|
|
110
|
+
message: "AI button position when region selected",
|
|
111
|
+
data: {
|
|
112
|
+
regionId: s == null ? void 0 : s.id,
|
|
113
|
+
aiButtonPosition: d,
|
|
114
|
+
rectCoords: (n = t.getCoords()) == null ? void 0 : n.map((e) => ({
|
|
115
|
+
x: e.x,
|
|
116
|
+
y: e.y
|
|
117
|
+
})),
|
|
118
|
+
canvasZoom: o.getZoom()
|
|
119
|
+
},
|
|
120
|
+
timestamp: Date.now(),
|
|
121
|
+
sessionId: "debug-session",
|
|
122
|
+
runId: "run1",
|
|
123
|
+
hypothesisId: "A"
|
|
124
|
+
})
|
|
125
|
+
}).catch(() => {
|
|
126
|
+
}), console.log("[useRegionSelection] Region selected - AI button position:", {
|
|
127
|
+
regionId: s == null ? void 0 : s.id,
|
|
128
|
+
aiButtonPosition: d,
|
|
129
|
+
rectCoords: (c = t.getCoords()) == null ? void 0 : c.map((e) => ({
|
|
130
|
+
x: e.x,
|
|
131
|
+
y: e.y
|
|
132
|
+
})),
|
|
133
|
+
canvasZoom: o.getZoom()
|
|
134
|
+
}), s && l && l(s);
|
|
65
135
|
}
|
|
66
|
-
},
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
136
|
+
}, I = () => {
|
|
137
|
+
var n, c;
|
|
138
|
+
m();
|
|
139
|
+
const t = o.getActiveObject();
|
|
140
|
+
if (t && t instanceof f.Rect) {
|
|
141
|
+
if (C().has(t)) {
|
|
142
|
+
o.discardActiveObject(), o.renderAll();
|
|
72
143
|
return;
|
|
73
144
|
}
|
|
74
|
-
const
|
|
145
|
+
const a = o.getZoom(), i = F / a;
|
|
75
146
|
t.set({
|
|
76
147
|
hasRotatingPoint: !1,
|
|
77
148
|
lockRotation: !0,
|
|
@@ -79,11 +150,11 @@ const b = ({
|
|
|
79
150
|
// 允许非等比缩放,控制点跟随鼠标
|
|
80
151
|
lockScalingFlip: !0,
|
|
81
152
|
// 禁止缩放时翻转
|
|
82
|
-
fill:
|
|
153
|
+
fill: k,
|
|
83
154
|
// 选中时添加填充色
|
|
84
155
|
strokeUniform: !0,
|
|
85
156
|
// 确保边框宽度不受缩放影响
|
|
86
|
-
strokeWidth:
|
|
157
|
+
strokeWidth: i,
|
|
87
158
|
// 确保边框宽度一致
|
|
88
159
|
objectCaching: !1,
|
|
89
160
|
// 禁用缓存,避免缩放时边框变虚
|
|
@@ -91,26 +162,57 @@ const b = ({
|
|
|
91
162
|
noScaleCache: !1,
|
|
92
163
|
cornerStyle: "circle",
|
|
93
164
|
// 设置控制点为圆形
|
|
94
|
-
cornerColor:
|
|
165
|
+
cornerColor: j,
|
|
95
166
|
// 设置控制点为紫色(填充色)
|
|
96
|
-
cornerSize:
|
|
167
|
+
cornerSize: N,
|
|
97
168
|
// 设置控制点大小(默认12,这里设置为6使其更小)
|
|
98
169
|
transparentCorners: !1
|
|
99
170
|
// 不透明,显示填充颜色
|
|
100
171
|
});
|
|
101
|
-
const
|
|
102
|
-
|
|
103
|
-
const S =
|
|
104
|
-
|
|
172
|
+
const d = t;
|
|
173
|
+
d.uniformScaling = !1, t.controls && t.controls.mtr && delete t.controls.mtr, t.controls.deleteControl || (t.controls.deleteControl = h()), t.controls.ocrControl || (t.controls.ocrControl = g()), o.renderAll();
|
|
174
|
+
const s = S(t), e = y.current.get(t);
|
|
175
|
+
fetch("http://127.0.0.1:7243/ingest/f03da105-26de-4a72-9802-7a749afbd310", {
|
|
176
|
+
method: "POST",
|
|
177
|
+
headers: {
|
|
178
|
+
"Content-Type": "application/json"
|
|
179
|
+
},
|
|
180
|
+
body: JSON.stringify({
|
|
181
|
+
location: "useRegionSelection.ts:handleSelectionUpdated",
|
|
182
|
+
message: "AI button position when region updated",
|
|
183
|
+
data: {
|
|
184
|
+
regionId: e == null ? void 0 : e.id,
|
|
185
|
+
aiButtonPosition: s,
|
|
186
|
+
rectCoords: (n = t.getCoords()) == null ? void 0 : n.map((r) => ({
|
|
187
|
+
x: r.x,
|
|
188
|
+
y: r.y
|
|
189
|
+
})),
|
|
190
|
+
canvasZoom: o.getZoom()
|
|
191
|
+
},
|
|
192
|
+
timestamp: Date.now(),
|
|
193
|
+
sessionId: "debug-session",
|
|
194
|
+
runId: "run1",
|
|
195
|
+
hypothesisId: "A"
|
|
196
|
+
})
|
|
197
|
+
}).catch(() => {
|
|
198
|
+
}), console.log("[useRegionSelection] Region updated - AI button position:", {
|
|
199
|
+
regionId: e == null ? void 0 : e.id,
|
|
200
|
+
aiButtonPosition: s,
|
|
201
|
+
rectCoords: (c = t.getCoords()) == null ? void 0 : c.map((r) => ({
|
|
202
|
+
x: r.x,
|
|
203
|
+
y: r.y
|
|
204
|
+
})),
|
|
205
|
+
canvasZoom: o.getZoom()
|
|
206
|
+
}), e && l && l(e);
|
|
105
207
|
}
|
|
106
|
-
},
|
|
107
|
-
|
|
208
|
+
}, A = () => {
|
|
209
|
+
m(), o.renderAll(), l && l(null);
|
|
108
210
|
};
|
|
109
|
-
return
|
|
110
|
-
|
|
211
|
+
return o.on("selection:created", R), o.on("selection:updated", I), o.on("selection:cleared", A), () => {
|
|
212
|
+
o.off("selection:created", R), o.off("selection:updated", I), o.off("selection:cleared", A);
|
|
111
213
|
};
|
|
112
|
-
}, [
|
|
214
|
+
}, [o, l, h, g, O, y]);
|
|
113
215
|
};
|
|
114
216
|
export {
|
|
115
|
-
|
|
217
|
+
G as useRegionSelection
|
|
116
218
|
};
|