@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,224 +1,237 @@
|
|
|
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 { useRef as
|
|
15
|
-
import { fabric as
|
|
16
|
-
import { useKeyPress as
|
|
17
|
-
import
|
|
1
|
+
var Ke = Object.defineProperty, $e = Object.defineProperties;
|
|
2
|
+
var Ge = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var Se = Object.getOwnPropertySymbols;
|
|
4
|
+
var qe = Object.prototype.hasOwnProperty, Je = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var Ae = (c, g, l) => g in c ? Ke(c, g, { enumerable: !0, configurable: !0, writable: !0, value: l }) : c[g] = l, ne = (c, g) => {
|
|
6
|
+
for (var l in g || (g = {}))
|
|
7
|
+
qe.call(g, l) && Ae(c, l, g[l]);
|
|
8
|
+
if (Se)
|
|
9
|
+
for (var l of Se(g))
|
|
10
|
+
Je.call(g, l) && Ae(c, l, g[l]);
|
|
11
|
+
return c;
|
|
12
|
+
}, we = (c, g) => $e(c, Ge(g));
|
|
13
|
+
import { jsxs as Oe, jsx as b } from "react/jsx-runtime";
|
|
14
|
+
import Qe, { useRef as C, useState as x, useCallback as w, useEffect as p, useImperativeHandle as Ve } from "react";
|
|
15
|
+
import { fabric as P } from "fabric";
|
|
16
|
+
import { useKeyPress as Y } from "ahooks";
|
|
17
|
+
import et from "classnames";
|
|
18
18
|
import "./style.less.mjs";
|
|
19
|
-
import
|
|
20
|
-
import { useOCRLoadingIcon as
|
|
21
|
-
import { useRegionNameText as
|
|
22
|
-
import { useCropRegionImage as
|
|
23
|
-
import { useDrawingMode as
|
|
24
|
-
import { useRegionLoader as
|
|
25
|
-
import { useCanvasSetup as
|
|
26
|
-
import { useTextLayouts as
|
|
27
|
-
import { useRegionUpdate as
|
|
28
|
-
import { useCanvasDrag as
|
|
29
|
-
import { useRegionSelection as
|
|
30
|
-
import { useOCRRecognition as
|
|
31
|
-
import { useDeleteRegion as
|
|
32
|
-
import { useDeleteControl as
|
|
33
|
-
import {
|
|
34
|
-
import {
|
|
35
|
-
import {
|
|
36
|
-
import {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
19
|
+
import tt from "../components/Toolbar.mjs";
|
|
20
|
+
import { useOCRLoadingIcon as ot } from "./hooks/useOCRLoadingIcon.mjs";
|
|
21
|
+
import { useRegionNameText as rt } from "./hooks/useRegionNameText.mjs";
|
|
22
|
+
import { useCropRegionImage as nt } from "./hooks/useCropRegionImage.mjs";
|
|
23
|
+
import { useDrawingMode as st } from "./hooks/useDrawingMode.mjs";
|
|
24
|
+
import { useRegionLoader as ct } from "./hooks/useRegionLoader.mjs";
|
|
25
|
+
import { useCanvasSetup as it } from "./hooks/useCanvasSetup.mjs";
|
|
26
|
+
import { useTextLayouts as at } from "./hooks/useTextLayouts.mjs";
|
|
27
|
+
import { useRegionUpdate as ft } from "./hooks/useRegionUpdate.mjs";
|
|
28
|
+
import { useCanvasDrag as ut } from "./hooks/useCanvasDrag.mjs";
|
|
29
|
+
import { useRegionSelection as dt } from "./hooks/useRegionSelection.mjs";
|
|
30
|
+
import { useOCRRecognition as mt } from "./hooks/useOCRRecognition.mjs";
|
|
31
|
+
import { useDeleteRegion as lt } from "./hooks/useDeleteRegion.mjs";
|
|
32
|
+
import { useDeleteControl as ht } from "./hooks/useDeleteControl.mjs";
|
|
33
|
+
import { useOCRControl as gt } from "./hooks/useOCRControl.mjs";
|
|
34
|
+
import { useCanvasZoom as Rt } from "./hooks/useCanvasZoom.mjs";
|
|
35
|
+
import { useRegionHover as Et } from "./hooks/useRegionHover.mjs";
|
|
36
|
+
import { useRegionBoundaryCheck as pt } from "./hooks/useRegionBoundaryCheck.mjs";
|
|
37
|
+
import { canvasToImageCoords as Ct, imageToCanvasCoords as Tt } from "./utils/coordinateUtils.mjs";
|
|
38
|
+
import { REGION_NAME_PREFIX as vt, DEFAULT_REGION_NAME as It, ZOOM_PRECISION_ERROR as kt, TEXT_LAYOUT_RECT_FILL_COLOR as Nt, TEXT_LAYOUT_RECT_STROKE_COLOR as St, TRANSPARENT_FILL as _e, SELECTED_RECT_FILL_COLOR as At, BASE_STROKE_WIDTH as se, ACTIVE_RECT_STROKE_COLOR as wt, RECT_STROKE_COLOR as Ot } from "../constants.mjs";
|
|
39
|
+
const _t = Qe.forwardRef(({
|
|
40
|
+
sample: c,
|
|
41
|
+
labelDefinitions: g,
|
|
42
|
+
labels: l,
|
|
43
|
+
onImageLoad: xe,
|
|
44
|
+
onChange: O,
|
|
45
|
+
onRegionSelect: ce,
|
|
46
|
+
onRegionChange: J,
|
|
47
|
+
ocrRecognize: Le,
|
|
48
|
+
activeLabelValue: R,
|
|
49
|
+
onClearActive: Q,
|
|
50
|
+
selectedRegion: T,
|
|
51
|
+
onAppendTextToActive: Me,
|
|
52
|
+
readOnly: h
|
|
53
|
+
}, De) => {
|
|
54
|
+
var Ie, ke;
|
|
55
|
+
const ie = C(null), k = C(null), [ye, Ue] = x(!0), [e, We] = x(), [L, be] = x(), [v, ae] = x(1), [N, j] = x(h || !1), [I, _] = x(!1), [V, Pe] = x({
|
|
54
56
|
left: 0,
|
|
55
57
|
top: 0
|
|
56
|
-
}), F =
|
|
58
|
+
}), F = C({
|
|
57
59
|
left: 0,
|
|
58
60
|
top: 0
|
|
59
|
-
}),
|
|
61
|
+
}), fe = C({
|
|
60
62
|
width: 0,
|
|
61
63
|
height: 0
|
|
62
|
-
}),
|
|
64
|
+
}), i = C(/* @__PURE__ */ new Map()), ue = C(null), de = C(void 0), me = C(!1), le = C(!1), z = C({
|
|
63
65
|
width: 0,
|
|
64
66
|
height: 0
|
|
65
|
-
}),
|
|
66
|
-
updateOCRLoadingIcon:
|
|
67
|
-
ocrLoadingIconMapRef:
|
|
68
|
-
} =
|
|
69
|
-
updateRegionNameText:
|
|
70
|
-
regionNameTextMapRef:
|
|
71
|
-
} =
|
|
72
|
-
|
|
73
|
-
const n = r.left || 0,
|
|
74
|
-
|
|
67
|
+
}), he = C(!1), {
|
|
68
|
+
updateOCRLoadingIcon: xt,
|
|
69
|
+
ocrLoadingIconMapRef: M
|
|
70
|
+
} = ot(e), {
|
|
71
|
+
updateRegionNameText: B,
|
|
72
|
+
regionNameTextMapRef: S
|
|
73
|
+
} = rt(e), ee = nt(c == null ? void 0 : c.fileUrl), je = w((o) => {
|
|
74
|
+
e && (S.current.forEach((t, r) => {
|
|
75
|
+
const n = r.left || 0, m = r.top || 0;
|
|
76
|
+
t.set({
|
|
75
77
|
left: n,
|
|
76
78
|
// 与标注框左边对齐
|
|
77
|
-
top:
|
|
79
|
+
top: m,
|
|
78
80
|
// 下边缘与标注框上边缘对齐(因为 originY 是 'bottom')
|
|
79
81
|
scaleX: 1 / o,
|
|
80
82
|
// 反向缩放,抵消画布缩放
|
|
81
83
|
scaleY: 1 / o
|
|
82
84
|
// 反向缩放,抵消画布缩放
|
|
83
85
|
});
|
|
84
|
-
}),
|
|
85
|
-
}, [
|
|
86
|
-
updateCanvas:
|
|
87
|
-
} =
|
|
88
|
-
sample:
|
|
89
|
-
image:
|
|
90
|
-
onImageLoad:
|
|
91
|
-
canvasRef:
|
|
92
|
-
containerRef:
|
|
93
|
-
canvasInitializedRef:
|
|
86
|
+
}), e.renderAll());
|
|
87
|
+
}, [e]), {
|
|
88
|
+
updateCanvas: X
|
|
89
|
+
} = it({
|
|
90
|
+
sample: c,
|
|
91
|
+
image: L,
|
|
92
|
+
onImageLoad: xe,
|
|
93
|
+
canvasRef: ie,
|
|
94
|
+
containerRef: k,
|
|
95
|
+
canvasInitializedRef: me,
|
|
94
96
|
bgImagePositionRef: F,
|
|
95
|
-
bgImageSizeRef:
|
|
96
|
-
rectMapRef:
|
|
97
|
-
updateTextLayersRef:
|
|
98
|
-
onRectPositionUpdated:
|
|
99
|
-
setCanvas:
|
|
100
|
-
setImage:
|
|
101
|
-
setScale:
|
|
102
|
-
setBgImagePosition:
|
|
103
|
-
setLoading:
|
|
104
|
-
}),
|
|
105
|
-
const o = Array.from(
|
|
106
|
-
o.forEach((
|
|
107
|
-
|
|
108
|
-
}),
|
|
109
|
-
const n =
|
|
110
|
-
n && (n.set("text",
|
|
111
|
-
}),
|
|
112
|
-
}, [
|
|
113
|
-
zoom:
|
|
114
|
-
} =
|
|
115
|
-
canvas:
|
|
116
|
-
setScale:
|
|
117
|
-
isZoomingRef:
|
|
118
|
-
}),
|
|
119
|
-
(o,
|
|
120
|
-
[
|
|
97
|
+
bgImageSizeRef: fe,
|
|
98
|
+
rectMapRef: i,
|
|
99
|
+
updateTextLayersRef: ue,
|
|
100
|
+
onRectPositionUpdated: je,
|
|
101
|
+
setCanvas: We,
|
|
102
|
+
setImage: be,
|
|
103
|
+
setScale: ae,
|
|
104
|
+
setBgImagePosition: Pe,
|
|
105
|
+
setLoading: Ue
|
|
106
|
+
}), Fe = w(() => {
|
|
107
|
+
const o = Array.from(i.current.values());
|
|
108
|
+
o.forEach((t, r) => {
|
|
109
|
+
t.name = `${vt}${r + 1}`;
|
|
110
|
+
}), i.current.forEach((t, r) => {
|
|
111
|
+
const n = S.current.get(r);
|
|
112
|
+
n && (n.set("text", t.name || It), e == null || e.renderAll());
|
|
113
|
+
}), O && O(o);
|
|
114
|
+
}, [O, e]), {
|
|
115
|
+
zoom: Xe
|
|
116
|
+
} = Rt({
|
|
117
|
+
canvas: e,
|
|
118
|
+
setScale: ae,
|
|
119
|
+
isZoomingRef: he
|
|
120
|
+
}), Z = w(
|
|
121
|
+
(o, t) => Ct(o, t, e, L, F),
|
|
122
|
+
[e, L, V]
|
|
121
123
|
// 添加 bgImagePosition 作为依赖,确保在图片位置更新后函数能正确工作
|
|
122
|
-
),
|
|
123
|
-
(o,
|
|
124
|
-
[
|
|
124
|
+
), K = w(
|
|
125
|
+
(o, t) => Tt(o, t, e, F),
|
|
126
|
+
[e, V]
|
|
125
127
|
// 添加 bgImagePosition 作为依赖,确保在图片位置更新后函数能正确工作
|
|
126
128
|
), {
|
|
127
|
-
updateTextLayers:
|
|
128
|
-
textLayersMapRef:
|
|
129
|
-
textLayoutContentMapRef:
|
|
130
|
-
} =
|
|
131
|
-
canvas:
|
|
132
|
-
imageToCanvasCoords:
|
|
133
|
-
activeLabelValue:
|
|
134
|
-
onAppendTextToActive:
|
|
129
|
+
updateTextLayers: $,
|
|
130
|
+
textLayersMapRef: d,
|
|
131
|
+
textLayoutContentMapRef: G
|
|
132
|
+
} = at({
|
|
133
|
+
canvas: e,
|
|
134
|
+
imageToCanvasCoords: K,
|
|
135
|
+
activeLabelValue: R,
|
|
136
|
+
onAppendTextToActive: Me
|
|
135
137
|
});
|
|
136
|
-
|
|
138
|
+
ue.current = $;
|
|
137
139
|
const {
|
|
138
|
-
performOCRIfNeeded:
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
140
|
+
performOCRIfNeeded: ge,
|
|
141
|
+
performOCR: q,
|
|
142
|
+
ocrRecognizingRef: Re,
|
|
143
|
+
ocrErrorRef: Ee
|
|
144
|
+
} = mt({
|
|
145
|
+
ocrRecognize: Le,
|
|
146
|
+
onChange: O,
|
|
147
|
+
updateTextLayers: $,
|
|
148
|
+
canvas: e,
|
|
149
|
+
rectMapRef: i,
|
|
150
|
+
textLayersMapRef: d,
|
|
151
|
+
textLayoutContentMapRef: G
|
|
149
152
|
}), {
|
|
150
|
-
updateRegionShapeAndImage:
|
|
151
|
-
} =
|
|
152
|
-
canvas:
|
|
153
|
-
image:
|
|
154
|
-
draggable:
|
|
155
|
-
canvasToImageCoords:
|
|
156
|
-
imageToCanvasCoords:
|
|
157
|
-
cropRegionImage:
|
|
158
|
-
onChange:
|
|
159
|
-
onRegionChange:
|
|
160
|
-
performOCRIfNeeded:
|
|
161
|
-
updateTextLayers:
|
|
162
|
-
rectMapRef:
|
|
163
|
-
regionNameTextMapRef:
|
|
164
|
-
ocrLoadingIconMapRef:
|
|
153
|
+
updateRegionShapeAndImage: pe
|
|
154
|
+
} = ft({
|
|
155
|
+
canvas: e,
|
|
156
|
+
image: L,
|
|
157
|
+
draggable: N,
|
|
158
|
+
canvasToImageCoords: Z,
|
|
159
|
+
imageToCanvasCoords: K,
|
|
160
|
+
cropRegionImage: ee,
|
|
161
|
+
onChange: O,
|
|
162
|
+
onRegionChange: J,
|
|
163
|
+
performOCRIfNeeded: ge,
|
|
164
|
+
updateTextLayers: $,
|
|
165
|
+
rectMapRef: i,
|
|
166
|
+
regionNameTextMapRef: S,
|
|
167
|
+
ocrLoadingIconMapRef: M
|
|
168
|
+
}), {
|
|
169
|
+
setupBoundaryCheck: Ce
|
|
170
|
+
} = pt({
|
|
171
|
+
canvas: e,
|
|
172
|
+
image: L,
|
|
173
|
+
canvasToImageCoords: Z,
|
|
174
|
+
imageToCanvasCoords: K,
|
|
175
|
+
bgImagePositionRef: F,
|
|
176
|
+
bgImageSizeRef: fe,
|
|
177
|
+
regionNameTextMapRef: S
|
|
165
178
|
});
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
}, [
|
|
169
|
-
|
|
170
|
-
o.forEach((
|
|
171
|
-
|
|
179
|
+
p(() => {
|
|
180
|
+
X();
|
|
181
|
+
}, [X]), p(() => {
|
|
182
|
+
e && (d.current.forEach((o) => {
|
|
183
|
+
o.forEach((t) => {
|
|
184
|
+
t.off("mousedown"), t.off("mouseover"), t.off("mouseout"), e.remove(t), G.current.delete(t);
|
|
172
185
|
});
|
|
173
|
-
}),
|
|
174
|
-
|
|
175
|
-
}),
|
|
176
|
-
|
|
177
|
-
}),
|
|
178
|
-
|
|
179
|
-
}),
|
|
180
|
-
}, [
|
|
181
|
-
if (!
|
|
186
|
+
}), d.current.clear(), S.current.forEach((o) => {
|
|
187
|
+
e.remove(o);
|
|
188
|
+
}), S.current.clear(), M.current.forEach((o) => {
|
|
189
|
+
e.remove(o);
|
|
190
|
+
}), M.current.clear(), i.current.forEach((o, t) => {
|
|
191
|
+
t.off("modified"), t.off("moved"), e.remove(t);
|
|
192
|
+
}), i.current.clear(), le.current = !1, de.current = void 0, e.renderAll());
|
|
193
|
+
}, [e, c == null ? void 0 : c.id]), p(() => {
|
|
194
|
+
if (!k.current)
|
|
182
195
|
return;
|
|
183
|
-
|
|
184
|
-
width:
|
|
185
|
-
height:
|
|
196
|
+
z.current = {
|
|
197
|
+
width: k.current.offsetWidth,
|
|
198
|
+
height: k.current.offsetHeight
|
|
186
199
|
};
|
|
187
200
|
const o = new ResizeObserver(() => {
|
|
188
|
-
if (!
|
|
201
|
+
if (!k.current || he.current)
|
|
189
202
|
return;
|
|
190
|
-
if (
|
|
191
|
-
const
|
|
192
|
-
if (Math.abs(
|
|
203
|
+
if (e) {
|
|
204
|
+
const s = e.getZoom();
|
|
205
|
+
if (Math.abs(s - v) > kt)
|
|
193
206
|
return;
|
|
194
207
|
}
|
|
195
|
-
const
|
|
196
|
-
(
|
|
197
|
-
width:
|
|
208
|
+
const t = k.current.offsetWidth, r = k.current.offsetHeight, n = z.current.width, m = z.current.height;
|
|
209
|
+
(t !== n || r !== m) && (z.current = {
|
|
210
|
+
width: t,
|
|
198
211
|
height: r
|
|
199
|
-
},
|
|
212
|
+
}, X());
|
|
200
213
|
});
|
|
201
|
-
return o.observe(
|
|
214
|
+
return o.observe(k.current), () => {
|
|
202
215
|
o.disconnect();
|
|
203
216
|
};
|
|
204
|
-
}, [
|
|
205
|
-
|
|
217
|
+
}, [X, e, v]), Y("ctrl", () => {
|
|
218
|
+
h || (I && (_(!1), y()), j(!0));
|
|
206
219
|
}, {
|
|
207
220
|
events: ["keydown"]
|
|
208
|
-
}),
|
|
209
|
-
|
|
221
|
+
}), Y("ctrl", () => {
|
|
222
|
+
h || j(!1);
|
|
210
223
|
}, {
|
|
211
224
|
events: ["keyup"]
|
|
212
|
-
}),
|
|
213
|
-
if (!
|
|
225
|
+
}), p(() => {
|
|
226
|
+
if (!e)
|
|
214
227
|
return;
|
|
215
|
-
const o =
|
|
216
|
-
|
|
228
|
+
const o = se / v, t = /* @__PURE__ */ new Set();
|
|
229
|
+
d.current.forEach((r) => {
|
|
217
230
|
r.forEach((n) => {
|
|
218
|
-
|
|
231
|
+
t.add(n);
|
|
219
232
|
});
|
|
220
|
-
}),
|
|
221
|
-
r instanceof
|
|
233
|
+
}), e.getObjects().forEach((r) => {
|
|
234
|
+
r instanceof P.Rect && !t.has(r) && r.set({
|
|
222
235
|
strokeWidth: o,
|
|
223
236
|
strokeUniform: !0,
|
|
224
237
|
objectCaching: !1,
|
|
@@ -226,12 +239,12 @@ const Wt = ({
|
|
|
226
239
|
statefullCache: !1,
|
|
227
240
|
noScaleCache: !1
|
|
228
241
|
});
|
|
229
|
-
}),
|
|
242
|
+
}), d.current.forEach((r) => {
|
|
230
243
|
r.forEach((n) => {
|
|
231
244
|
n.set({
|
|
232
|
-
fill:
|
|
245
|
+
fill: Nt,
|
|
233
246
|
// 确保填充色被保留
|
|
234
|
-
stroke:
|
|
247
|
+
stroke: St,
|
|
235
248
|
// 确保边框色被保留
|
|
236
249
|
strokeWidth: o,
|
|
237
250
|
// 根据缩放调整边框宽度,保持视觉一致
|
|
@@ -242,267 +255,378 @@ const Wt = ({
|
|
|
242
255
|
noScaleCache: !1
|
|
243
256
|
});
|
|
244
257
|
});
|
|
245
|
-
}),
|
|
246
|
-
const
|
|
258
|
+
}), S.current.forEach((r, n) => {
|
|
259
|
+
const m = n.left || 0, s = n.top || 0;
|
|
247
260
|
r.set({
|
|
248
|
-
left:
|
|
261
|
+
left: m,
|
|
249
262
|
// 与标注框左边对齐
|
|
250
|
-
top:
|
|
263
|
+
top: s,
|
|
251
264
|
// 下边缘与标注框上边缘对齐(因为 originY 是 'bottom')
|
|
252
|
-
scaleX: 1 /
|
|
265
|
+
scaleX: 1 / v,
|
|
253
266
|
// 反向缩放,抵消画布缩放
|
|
254
|
-
scaleY: 1 /
|
|
267
|
+
scaleY: 1 / v
|
|
255
268
|
// 反向缩放,抵消画布缩放
|
|
256
269
|
});
|
|
257
|
-
const
|
|
258
|
-
if (
|
|
259
|
-
const
|
|
260
|
-
n.getScaledHeight(),
|
|
261
|
-
left:
|
|
270
|
+
const a = M.current.get(n);
|
|
271
|
+
if (a) {
|
|
272
|
+
const u = n.getScaledWidth();
|
|
273
|
+
n.getScaledHeight(), a.set({
|
|
274
|
+
left: m,
|
|
262
275
|
// top 位置由动画控制,这里不更新
|
|
263
|
-
scaleX: 1 /
|
|
276
|
+
scaleX: 1 / v,
|
|
264
277
|
// 反向缩放,抵消画布缩放,保持固定视觉粗细
|
|
265
|
-
scaleY: 1 /
|
|
278
|
+
scaleY: 1 / v
|
|
266
279
|
// 反向缩放,抵消画布缩放,保持固定视觉粗细
|
|
267
280
|
});
|
|
268
|
-
const
|
|
269
|
-
if (
|
|
270
|
-
const
|
|
271
|
-
|
|
272
|
-
|
|
281
|
+
const f = a.getObjects();
|
|
282
|
+
if (f && f.length > 0) {
|
|
283
|
+
const E = u * v;
|
|
284
|
+
f.forEach((A) => {
|
|
285
|
+
A instanceof P.Rect && A.set("width", E);
|
|
273
286
|
});
|
|
274
287
|
}
|
|
275
288
|
}
|
|
276
|
-
}),
|
|
277
|
-
}, [
|
|
278
|
-
canvas:
|
|
279
|
-
draggable:
|
|
280
|
-
drawingMode:
|
|
281
|
-
textLayersMapRef:
|
|
289
|
+
}), e.renderAll();
|
|
290
|
+
}, [e, v]), ut({
|
|
291
|
+
canvas: e,
|
|
292
|
+
draggable: N,
|
|
293
|
+
drawingMode: I,
|
|
294
|
+
textLayersMapRef: d
|
|
295
|
+
});
|
|
296
|
+
const {
|
|
297
|
+
performDelete: D,
|
|
298
|
+
deleteDirectly: Ze
|
|
299
|
+
} = lt({
|
|
300
|
+
canvas: e,
|
|
301
|
+
onRegionChange: J,
|
|
302
|
+
updateRegionNames: Fe,
|
|
303
|
+
rectMapRef: i,
|
|
304
|
+
textLayersMapRef: d,
|
|
305
|
+
textLayoutContentMapRef: G,
|
|
306
|
+
regionNameTextMapRef: S,
|
|
307
|
+
ocrLoadingIconMapRef: M
|
|
282
308
|
});
|
|
309
|
+
w((o) => {
|
|
310
|
+
if (!e)
|
|
311
|
+
return;
|
|
312
|
+
let t = null;
|
|
313
|
+
i.current.forEach((r, n) => {
|
|
314
|
+
r.id === o && (t = n);
|
|
315
|
+
}), t && D(t);
|
|
316
|
+
}, [e, D]);
|
|
317
|
+
const He = w((o) => {
|
|
318
|
+
if (!e)
|
|
319
|
+
return;
|
|
320
|
+
let t = null;
|
|
321
|
+
i.current.forEach((r) => {
|
|
322
|
+
r.id === o && (t = r);
|
|
323
|
+
}), t && q(t);
|
|
324
|
+
}, [e, q]), Ye = w((o) => {
|
|
325
|
+
if (!e)
|
|
326
|
+
return;
|
|
327
|
+
const t = i.current.get(o);
|
|
328
|
+
t && q(t);
|
|
329
|
+
}, [e, q]);
|
|
330
|
+
Ve(De, () => ({
|
|
331
|
+
performOCRById: He,
|
|
332
|
+
ocrRecognizingRef: Re,
|
|
333
|
+
ocrErrorRef: Ee
|
|
334
|
+
}));
|
|
283
335
|
const {
|
|
284
|
-
|
|
285
|
-
} =
|
|
286
|
-
|
|
287
|
-
onRegionChange: H,
|
|
288
|
-
updateRegionNames: Me,
|
|
289
|
-
rectMapRef: a,
|
|
290
|
-
textLayersMapRef: m,
|
|
291
|
-
textLayoutContentMapRef: Y,
|
|
292
|
-
regionNameTextMapRef: C,
|
|
293
|
-
ocrLoadingIconMapRef: k
|
|
336
|
+
createDeleteControl: te
|
|
337
|
+
} = ht({
|
|
338
|
+
performDelete: D
|
|
294
339
|
}), {
|
|
295
|
-
|
|
296
|
-
} =
|
|
297
|
-
|
|
340
|
+
createOCRControl: oe
|
|
341
|
+
} = gt({
|
|
342
|
+
performOCR: Ye,
|
|
343
|
+
ocrRecognizingRef: Re,
|
|
344
|
+
ocrErrorRef: Ee,
|
|
345
|
+
rectMapRef: i
|
|
298
346
|
});
|
|
299
|
-
|
|
300
|
-
canvas:
|
|
301
|
-
onRegionSelect:
|
|
302
|
-
createDeleteControl:
|
|
303
|
-
|
|
304
|
-
|
|
347
|
+
dt({
|
|
348
|
+
canvas: e,
|
|
349
|
+
onRegionSelect: ce,
|
|
350
|
+
createDeleteControl: te,
|
|
351
|
+
createOCRControl: oe,
|
|
352
|
+
textLayersMapRef: d,
|
|
353
|
+
rectMapRef: i
|
|
305
354
|
});
|
|
306
355
|
const {
|
|
307
|
-
stopDraw:
|
|
308
|
-
} =
|
|
309
|
-
canvas:
|
|
310
|
-
drawingMode:
|
|
311
|
-
draggable:
|
|
312
|
-
setDrawingMode:
|
|
313
|
-
canvasToImageCoords:
|
|
314
|
-
labelDefinitions:
|
|
315
|
-
onChange:
|
|
316
|
-
cropRegionImage:
|
|
317
|
-
updateRegionShapeAndImage:
|
|
318
|
-
performOCRIfNeeded:
|
|
319
|
-
createDeleteControl:
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
356
|
+
stopDraw: y
|
|
357
|
+
} = st({
|
|
358
|
+
canvas: e,
|
|
359
|
+
drawingMode: I,
|
|
360
|
+
draggable: N,
|
|
361
|
+
setDrawingMode: _,
|
|
362
|
+
canvasToImageCoords: Z,
|
|
363
|
+
labelDefinitions: g,
|
|
364
|
+
onChange: O,
|
|
365
|
+
cropRegionImage: ee,
|
|
366
|
+
updateRegionShapeAndImage: pe,
|
|
367
|
+
performOCRIfNeeded: ge,
|
|
368
|
+
createDeleteControl: te,
|
|
369
|
+
createOCRControl: oe,
|
|
370
|
+
updateRegionNameText: B,
|
|
371
|
+
onRegionChange: J,
|
|
372
|
+
onRegionSelect: ce,
|
|
373
|
+
rectMapRef: i,
|
|
374
|
+
textLayersMapRef: d,
|
|
375
|
+
setupBoundaryCheck: Ce
|
|
325
376
|
});
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
}, [
|
|
329
|
-
|
|
330
|
-
}, [
|
|
331
|
-
if (!
|
|
377
|
+
p(() => {
|
|
378
|
+
R && (_(!1), y());
|
|
379
|
+
}, [R, y]), p(() => {
|
|
380
|
+
h && (j(!0), _(!1), y());
|
|
381
|
+
}, [h, y]), p(() => {
|
|
382
|
+
if (!e)
|
|
332
383
|
return;
|
|
333
384
|
const o = () => {
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
lockMovementX:
|
|
337
|
-
lockMovementY:
|
|
338
|
-
lockScalingX:
|
|
339
|
-
lockScalingY:
|
|
340
|
-
hasControls: !
|
|
385
|
+
e.getObjects().forEach((t) => {
|
|
386
|
+
t instanceof P.Rect && t.selectable && (t.set({
|
|
387
|
+
lockMovementX: h,
|
|
388
|
+
lockMovementY: h,
|
|
389
|
+
lockScalingX: h,
|
|
390
|
+
lockScalingY: h,
|
|
391
|
+
hasControls: !h
|
|
341
392
|
// 在只读模式下,如果有 activeLabelValue,我们可能希望它保持选中状态
|
|
342
393
|
// 但不允许用户通过点击来取消选中或选中其他(这个由 canvas.selection 控制)
|
|
343
|
-
}),
|
|
344
|
-
}),
|
|
394
|
+
}), h && t.controls);
|
|
395
|
+
}), e.requestRenderAll();
|
|
345
396
|
};
|
|
346
|
-
return o(),
|
|
347
|
-
|
|
397
|
+
return o(), e.on("object:added", o), () => {
|
|
398
|
+
e.off("object:added", o);
|
|
348
399
|
};
|
|
349
|
-
}, [
|
|
350
|
-
canvas:
|
|
351
|
-
sample:
|
|
352
|
-
image:
|
|
353
|
-
bgImagePosition:
|
|
354
|
-
canvasInitializedRef:
|
|
400
|
+
}, [e, h]), ct({
|
|
401
|
+
canvas: e,
|
|
402
|
+
sample: c,
|
|
403
|
+
image: L,
|
|
404
|
+
bgImagePosition: V,
|
|
405
|
+
canvasInitializedRef: me,
|
|
355
406
|
bgImagePositionRef: F,
|
|
356
|
-
sampleRef:
|
|
357
|
-
labelsLoadedRef:
|
|
358
|
-
rectMapRef:
|
|
359
|
-
textLayersMapRef:
|
|
360
|
-
textLayoutContentMapRef:
|
|
361
|
-
regionNameTextMapRef:
|
|
362
|
-
ocrLoadingIconMapRef:
|
|
363
|
-
imageToCanvasCoords:
|
|
364
|
-
updateRegionShapeAndImage:
|
|
365
|
-
createDeleteControl:
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
407
|
+
sampleRef: de,
|
|
408
|
+
labelsLoadedRef: le,
|
|
409
|
+
rectMapRef: i,
|
|
410
|
+
textLayersMapRef: d,
|
|
411
|
+
textLayoutContentMapRef: G,
|
|
412
|
+
regionNameTextMapRef: S,
|
|
413
|
+
ocrLoadingIconMapRef: M,
|
|
414
|
+
imageToCanvasCoords: K,
|
|
415
|
+
updateRegionShapeAndImage: pe,
|
|
416
|
+
createDeleteControl: te,
|
|
417
|
+
createOCRControl: oe,
|
|
418
|
+
updateRegionNameText: B,
|
|
419
|
+
updateTextLayers: $,
|
|
420
|
+
setupBoundaryCheck: Ce,
|
|
421
|
+
cropRegionImage: ee,
|
|
422
|
+
onChange: O
|
|
423
|
+
});
|
|
424
|
+
const Te = C([]);
|
|
425
|
+
p(() => {
|
|
426
|
+
if (!e)
|
|
427
|
+
return;
|
|
428
|
+
const o = Te.current, t = l != null ? l : [], r = new Set(o.map((s) => s.id)), n = new Set(t.map((s) => s.id));
|
|
429
|
+
if (t.length < o.length) {
|
|
430
|
+
const s = [];
|
|
431
|
+
i.current.forEach((a, u) => {
|
|
432
|
+
r.has(a.id) && !n.has(a.id) && s.push(u);
|
|
433
|
+
}), s.forEach((a) => {
|
|
434
|
+
Ze(a);
|
|
435
|
+
});
|
|
436
|
+
}
|
|
437
|
+
if (Te.current = t, !l || l.length === 0)
|
|
370
438
|
return;
|
|
371
|
-
let
|
|
372
|
-
|
|
373
|
-
var
|
|
374
|
-
const
|
|
375
|
-
if (!
|
|
439
|
+
let m = !1;
|
|
440
|
+
i.current.forEach((s, a) => {
|
|
441
|
+
var E, A;
|
|
442
|
+
const u = l.find((H) => H.id === s.id);
|
|
443
|
+
if (!u)
|
|
376
444
|
return;
|
|
377
|
-
const
|
|
445
|
+
const f = we(ne(ne({}, s), u), {
|
|
378
446
|
// Keep shape from canvas to avoid desync
|
|
379
|
-
shape:
|
|
380
|
-
image: (
|
|
381
|
-
textLayouts: (
|
|
447
|
+
shape: s.shape,
|
|
448
|
+
image: (E = u.image) != null ? E : s.image,
|
|
449
|
+
textLayouts: (A = u.textLayouts) != null ? A : s.textLayouts
|
|
382
450
|
});
|
|
383
|
-
(
|
|
384
|
-
}),
|
|
385
|
-
}, [
|
|
386
|
-
canvas:
|
|
387
|
-
drawingMode:
|
|
388
|
-
draggable:
|
|
389
|
-
textLayersMapRef:
|
|
390
|
-
}),
|
|
391
|
-
if (
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
451
|
+
(f.name !== s.name || f.content !== s.content || f.image !== s.image || f.textLayouts !== s.textLayouts) && (i.current.set(a, f), f.name !== s.name && B(a, f), m = !0);
|
|
452
|
+
}), m && (e == null || e.renderAll());
|
|
453
|
+
}, [l, e, B, D]), Et({
|
|
454
|
+
canvas: e,
|
|
455
|
+
drawingMode: I,
|
|
456
|
+
draggable: N,
|
|
457
|
+
textLayersMapRef: d
|
|
458
|
+
}), p(() => {
|
|
459
|
+
if (e)
|
|
460
|
+
if (T === null) {
|
|
461
|
+
const o = /* @__PURE__ */ new Set();
|
|
462
|
+
d.current.forEach((r) => {
|
|
463
|
+
r.forEach((n) => {
|
|
464
|
+
o.add(n);
|
|
465
|
+
});
|
|
466
|
+
}), e.getObjects().forEach((r) => {
|
|
467
|
+
r instanceof P.Rect && !o.has(r) && r.set({
|
|
468
|
+
fill: _e
|
|
469
|
+
// 移除填充色
|
|
470
|
+
});
|
|
471
|
+
}), e.getActiveObject() && (e.discardActiveObject(), e.renderAll());
|
|
472
|
+
} else {
|
|
473
|
+
const o = e.getActiveObject(), t = o ? i.current.get(o) : null;
|
|
474
|
+
if ((t == null ? void 0 : t.id) === (T == null ? void 0 : T.id))
|
|
475
|
+
return;
|
|
476
|
+
if (T) {
|
|
477
|
+
let r = null;
|
|
478
|
+
if (i.current.forEach((n, m) => {
|
|
479
|
+
n.id === T.id && (r = m);
|
|
480
|
+
}), r) {
|
|
481
|
+
const n = /* @__PURE__ */ new Set();
|
|
482
|
+
d.current.forEach((u) => {
|
|
483
|
+
u.forEach((f) => {
|
|
484
|
+
n.add(f);
|
|
485
|
+
});
|
|
486
|
+
}), e.getObjects().forEach((u) => {
|
|
487
|
+
u instanceof P.Rect && !n.has(u) && u.set({
|
|
488
|
+
fill: _e
|
|
489
|
+
// 移除填充色
|
|
490
|
+
});
|
|
491
|
+
});
|
|
492
|
+
const m = e.getZoom(), s = se / m, a = r;
|
|
493
|
+
a.set({
|
|
494
|
+
fill: At,
|
|
495
|
+
// 选中时添加填充色
|
|
496
|
+
strokeUniform: !0,
|
|
497
|
+
strokeWidth: s,
|
|
498
|
+
objectCaching: !1,
|
|
499
|
+
statefullCache: !1,
|
|
500
|
+
noScaleCache: !1
|
|
501
|
+
}), e.setActiveObject(a), e.renderAll();
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
}, [e, T, i, d]), p(() => {
|
|
506
|
+
var a;
|
|
507
|
+
if (!e)
|
|
407
508
|
return;
|
|
408
|
-
const o = (
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
509
|
+
const o = (a = R == null ? void 0 : R.region) == null ? void 0 : a.id, t = T == null ? void 0 : T.id, r = /* @__PURE__ */ new Set();
|
|
510
|
+
d.current.forEach((u) => {
|
|
511
|
+
u.forEach((f) => {
|
|
512
|
+
r.add(f);
|
|
513
|
+
});
|
|
514
|
+
});
|
|
515
|
+
let n = !1;
|
|
516
|
+
const m = e.getZoom(), s = se / m;
|
|
517
|
+
i.current.forEach((u, f) => {
|
|
518
|
+
if (r.has(f))
|
|
519
|
+
return;
|
|
520
|
+
const E = o === u.id;
|
|
521
|
+
if (t === u.id) {
|
|
522
|
+
const W = d.current.get(f);
|
|
523
|
+
W && W.length > 0 && W.forEach((Ne) => {
|
|
524
|
+
Ne.visible !== E && (Ne.set({
|
|
525
|
+
visible: E
|
|
526
|
+
}), n = !0);
|
|
418
527
|
});
|
|
528
|
+
return;
|
|
419
529
|
}
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
530
|
+
const H = f.stroke, re = E ? wt : Ot;
|
|
531
|
+
H !== re && (f.set({
|
|
532
|
+
stroke: re,
|
|
533
|
+
strokeWidth: s,
|
|
534
|
+
strokeUniform: !0
|
|
535
|
+
}), n = !0);
|
|
536
|
+
const U = d.current.get(f);
|
|
537
|
+
U && U.length > 0 && U.forEach((W) => {
|
|
538
|
+
W.visible !== E && (W.set({
|
|
539
|
+
visible: E
|
|
540
|
+
}), n = !0);
|
|
541
|
+
});
|
|
542
|
+
}), n && e.renderAll();
|
|
543
|
+
}, [e, R, T, d, i]), p(() => {
|
|
544
|
+
var n, m;
|
|
545
|
+
if (!e)
|
|
424
546
|
return;
|
|
425
|
-
const o = (n =
|
|
547
|
+
const o = (n = R == null ? void 0 : R.region) == null ? void 0 : n.id;
|
|
426
548
|
if (!o)
|
|
427
549
|
return;
|
|
428
|
-
let
|
|
429
|
-
if (
|
|
430
|
-
|
|
431
|
-
}), !
|
|
550
|
+
let t = null;
|
|
551
|
+
if (i.current.forEach((s, a) => {
|
|
552
|
+
s.id === o && (t = a);
|
|
553
|
+
}), !t)
|
|
432
554
|
return;
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
}),
|
|
436
|
-
}, [
|
|
437
|
-
if (!
|
|
555
|
+
t.bringToFront(), ((m = d.current.get(t)) != null ? m : []).forEach((s) => {
|
|
556
|
+
s.bringToFront();
|
|
557
|
+
}), e.renderAll();
|
|
558
|
+
}, [e, R, i, d]), p(() => {
|
|
559
|
+
if (!e || !R || !Q)
|
|
438
560
|
return;
|
|
439
|
-
const o = (
|
|
440
|
-
var
|
|
441
|
-
|
|
561
|
+
const o = (t) => {
|
|
562
|
+
var U;
|
|
563
|
+
if (I)
|
|
564
|
+
return;
|
|
565
|
+
const r = (U = t.e) == null ? void 0 : U.target;
|
|
442
566
|
if ((r == null ? void 0 : r.tagName) === "INPUT" || (r == null ? void 0 : r.tagName) === "TEXTAREA")
|
|
443
567
|
return;
|
|
444
|
-
const n =
|
|
445
|
-
x:
|
|
446
|
-
y:
|
|
447
|
-
width:
|
|
448
|
-
height:
|
|
449
|
-
} =
|
|
450
|
-
|
|
568
|
+
const n = e.getPointer(t.e), m = n.x, s = n.y, a = Z(m, s), u = R.region, {
|
|
569
|
+
x: f,
|
|
570
|
+
y: E,
|
|
571
|
+
width: A,
|
|
572
|
+
height: H
|
|
573
|
+
} = u.shape;
|
|
574
|
+
a.x >= f && a.x <= f + A && a.y >= E && a.y <= E + H || Q();
|
|
451
575
|
};
|
|
452
|
-
return
|
|
453
|
-
|
|
576
|
+
return e.on("mouse:down", o), () => {
|
|
577
|
+
e.off("mouse:down", o);
|
|
454
578
|
};
|
|
455
|
-
}, [
|
|
456
|
-
const
|
|
457
|
-
const
|
|
458
|
-
if ((
|
|
579
|
+
}, [e, R, Q, Z, I]);
|
|
580
|
+
const ve = w((o) => {
|
|
581
|
+
const t = o.target;
|
|
582
|
+
if ((t == null ? void 0 : t.tagName) === "INPUT" || (t == null ? void 0 : t.tagName) === "TEXTAREA" || !e || h)
|
|
459
583
|
return;
|
|
460
|
-
const r =
|
|
461
|
-
!r || !(r instanceof
|
|
462
|
-
}, [
|
|
463
|
-
|
|
464
|
-
const
|
|
465
|
-
(
|
|
584
|
+
const r = e.getActiveObject();
|
|
585
|
+
!r || !(r instanceof P.Rect) || D(r);
|
|
586
|
+
}, [e, D]);
|
|
587
|
+
Y("Delete", ve), Y("Backspace", ve), Y("r", (o) => {
|
|
588
|
+
const t = o.target;
|
|
589
|
+
(t == null ? void 0 : t.tagName) === "INPUT" || (t == null ? void 0 : t.tagName) === "TEXTAREA" || t != null && t.isContentEditable || h || !I && !N && _(!0);
|
|
466
590
|
}, {
|
|
467
591
|
exactMatch: !1
|
|
468
592
|
// 允许大小写
|
|
469
593
|
});
|
|
470
|
-
const
|
|
471
|
-
|
|
472
|
-
},
|
|
473
|
-
|
|
594
|
+
const ze = () => {
|
|
595
|
+
h || (I && (_(!1), y()), j(!N));
|
|
596
|
+
}, Be = () => {
|
|
597
|
+
h || (N && j(!1), _(!I));
|
|
474
598
|
};
|
|
475
|
-
return
|
|
476
|
-
|
|
477
|
-
}, []), /* @__PURE__ */
|
|
599
|
+
return p(() => () => {
|
|
600
|
+
e && e.dispose();
|
|
601
|
+
}, []), /* @__PURE__ */ Oe("div", {
|
|
478
602
|
style: {
|
|
479
603
|
width: "100%",
|
|
480
604
|
height: "100%",
|
|
481
605
|
display: "flex",
|
|
482
606
|
position: "relative"
|
|
483
607
|
},
|
|
484
|
-
children: [
|
|
608
|
+
children: [ye && /* @__PURE__ */ b("div", {
|
|
485
609
|
className: "vlm-loading-overlay",
|
|
486
|
-
children: /* @__PURE__ */
|
|
610
|
+
children: /* @__PURE__ */ b("div", {
|
|
487
611
|
className: "vlm-loading-spinner"
|
|
488
612
|
})
|
|
489
|
-
}), /* @__PURE__ */
|
|
613
|
+
}), /* @__PURE__ */ b("div", {
|
|
490
614
|
className: "vlm-marker-toolbar",
|
|
491
|
-
children: /* @__PURE__ */
|
|
492
|
-
drawingMode:
|
|
493
|
-
draggable:
|
|
494
|
-
scale:
|
|
495
|
-
onToggleDrawingMode:
|
|
496
|
-
onToggleDrag:
|
|
497
|
-
onZoom:
|
|
498
|
-
onFitToScreen:
|
|
499
|
-
readOnly:
|
|
615
|
+
children: /* @__PURE__ */ b(tt, {
|
|
616
|
+
drawingMode: I,
|
|
617
|
+
draggable: N,
|
|
618
|
+
scale: v,
|
|
619
|
+
onToggleDrawingMode: Be,
|
|
620
|
+
onToggleDrag: ze,
|
|
621
|
+
onZoom: Xe,
|
|
622
|
+
onFitToScreen: X,
|
|
623
|
+
readOnly: h
|
|
500
624
|
})
|
|
501
|
-
}), /* @__PURE__ */
|
|
502
|
-
ref:
|
|
503
|
-
className:
|
|
625
|
+
}), /* @__PURE__ */ Oe("div", {
|
|
626
|
+
ref: k,
|
|
627
|
+
className: et({
|
|
504
628
|
"vlm-label-maker-wrap": !0,
|
|
505
|
-
draggable:
|
|
629
|
+
draggable: N
|
|
506
630
|
}),
|
|
507
631
|
onContextMenu: (o) => {
|
|
508
632
|
o.preventDefault();
|
|
@@ -511,16 +635,17 @@ const Wt = ({
|
|
|
511
635
|
flex: 1,
|
|
512
636
|
position: "relative"
|
|
513
637
|
},
|
|
514
|
-
children: [(((
|
|
638
|
+
children: [(((Ie = c == null ? void 0 : c.sampleFileName) == null ? void 0 : Ie.originalName) || ((ke = c == null ? void 0 : c.sampleFileName) == null ? void 0 : ke.name)) && /* @__PURE__ */ b("div", {
|
|
515
639
|
className: "vlm-image-name",
|
|
516
|
-
children:
|
|
517
|
-
}), /* @__PURE__ */
|
|
640
|
+
children: c.sampleFileName.originalName || c.sampleFileName.name
|
|
641
|
+
}), /* @__PURE__ */ b("canvas", {
|
|
518
642
|
className: "vlm-label-maker-canvas",
|
|
519
|
-
ref:
|
|
643
|
+
ref: ie
|
|
520
644
|
})]
|
|
521
645
|
})]
|
|
522
646
|
});
|
|
523
|
-
};
|
|
647
|
+
});
|
|
648
|
+
_t.displayName = "VLMLabelMaker";
|
|
524
649
|
export {
|
|
525
|
-
|
|
650
|
+
_t as default
|
|
526
651
|
};
|