@glodon-aiot/dataset-annotation 3.17.0-alpha.4 → 3.17.0-beta.6
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.
|
@@ -1,64 +1,64 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
for (var
|
|
6
|
-
|
|
7
|
-
if (
|
|
8
|
-
for (var
|
|
9
|
-
|
|
10
|
-
return
|
|
1
|
+
var Y = Object.defineProperty;
|
|
2
|
+
var G = Object.getOwnPropertySymbols;
|
|
3
|
+
var v = Object.prototype.hasOwnProperty, z = Object.prototype.propertyIsEnumerable;
|
|
4
|
+
var H = (r, t, i) => t in r ? Y(r, t, { enumerable: !0, configurable: !0, writable: !0, value: i }) : r[t] = i, C = (r, t) => {
|
|
5
|
+
for (var i in t || (t = {}))
|
|
6
|
+
v.call(t, i) && H(r, i, t[i]);
|
|
7
|
+
if (G)
|
|
8
|
+
for (var i of G(t))
|
|
9
|
+
z.call(t, i) && H(r, i, t[i]);
|
|
10
|
+
return r;
|
|
11
11
|
};
|
|
12
|
-
import { useEffect as
|
|
13
|
-
import { fabric as
|
|
14
|
-
import { TRANSPARENT_FILL as
|
|
15
|
-
const
|
|
16
|
-
canvas:
|
|
12
|
+
import { useEffect as B } from "react";
|
|
13
|
+
import { fabric as X } from "fabric";
|
|
14
|
+
import { TRANSPARENT_FILL as g, RECT_STROKE_COLOR as j, BASE_STROKE_WIDTH as q, REGION_NAME_PREFIX as J } from "../../constants.mjs";
|
|
15
|
+
const I = ({
|
|
16
|
+
canvas: r,
|
|
17
17
|
sample: t,
|
|
18
|
-
image:
|
|
19
|
-
bgImagePosition:
|
|
20
|
-
canvasInitializedRef:
|
|
21
|
-
bgImagePositionRef:
|
|
22
|
-
sampleRef:
|
|
18
|
+
image: i,
|
|
19
|
+
bgImagePosition: Q,
|
|
20
|
+
canvasInitializedRef: K,
|
|
21
|
+
bgImagePositionRef: w,
|
|
22
|
+
sampleRef: S,
|
|
23
23
|
labelsLoadedRef: E,
|
|
24
|
-
rectMapRef:
|
|
25
|
-
textLayersMapRef:
|
|
26
|
-
textLayoutContentMapRef:
|
|
27
|
-
regionNameTextMapRef:
|
|
28
|
-
ocrLoadingIconMapRef:
|
|
29
|
-
imageToCanvasCoords:
|
|
24
|
+
rectMapRef: s,
|
|
25
|
+
textLayersMapRef: m,
|
|
26
|
+
textLayoutContentMapRef: N,
|
|
27
|
+
regionNameTextMapRef: y,
|
|
28
|
+
ocrLoadingIconMapRef: _,
|
|
29
|
+
imageToCanvasCoords: x,
|
|
30
30
|
updateRegionShapeAndImage: k,
|
|
31
|
-
createDeleteControl:
|
|
32
|
-
createOCRControl:
|
|
33
|
-
updateRegionNameText:
|
|
34
|
-
updateTextLayers:
|
|
35
|
-
setupBoundaryCheck:
|
|
36
|
-
cropRegionImage:
|
|
37
|
-
onChange:
|
|
31
|
+
createDeleteControl: F,
|
|
32
|
+
createOCRControl: W,
|
|
33
|
+
updateRegionNameText: U,
|
|
34
|
+
updateTextLayers: Z,
|
|
35
|
+
setupBoundaryCheck: $,
|
|
36
|
+
cropRegionImage: A,
|
|
37
|
+
onChange: V
|
|
38
38
|
}) => {
|
|
39
|
-
|
|
40
|
-
if (!
|
|
39
|
+
B(() => {
|
|
40
|
+
if (!r || !(t != null && t.labels) || !i || !K.current || w.current.left === 0 && w.current.top === 0)
|
|
41
41
|
return;
|
|
42
|
-
|
|
43
|
-
const f =
|
|
42
|
+
S.current !== t ? (S.current = t, E.current = !1, s.current.forEach((n, c) => {
|
|
43
|
+
const f = m.current.get(c);
|
|
44
44
|
f && (f.forEach((e) => {
|
|
45
|
-
e.off("mousedown"), e.off("mouseover"), e.off("mouseout"),
|
|
46
|
-
}),
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
const d =
|
|
50
|
-
d && (
|
|
51
|
-
}),
|
|
52
|
-
if (
|
|
45
|
+
e.off("mousedown"), e.off("mouseover"), e.off("mouseout"), N.current.delete(e), r.remove(e);
|
|
46
|
+
}), m.current.delete(c));
|
|
47
|
+
const u = y.current.get(c);
|
|
48
|
+
u && (c.off("moved"), c.off("modified"), r.remove(u), y.current.delete(c));
|
|
49
|
+
const d = _.current.get(c);
|
|
50
|
+
d && (r.remove(d), _.current.delete(c)), r.remove(c);
|
|
51
|
+
}), s.current.clear(), t.labels.forEach((n, c) => {
|
|
52
|
+
if (n.shape.name !== "rect")
|
|
53
53
|
return;
|
|
54
|
-
const f =
|
|
54
|
+
const f = x(n.shape.x, n.shape.y), u = r.getZoom(), d = q / u, e = new X.Rect({
|
|
55
55
|
left: f.x,
|
|
56
56
|
top: f.y,
|
|
57
|
-
width:
|
|
58
|
-
height:
|
|
59
|
-
fill:
|
|
57
|
+
width: n.shape.width,
|
|
58
|
+
height: n.shape.height,
|
|
59
|
+
fill: g,
|
|
60
60
|
// 无填充色
|
|
61
|
-
stroke:
|
|
61
|
+
stroke: j,
|
|
62
62
|
strokeWidth: d,
|
|
63
63
|
strokeUniform: !0,
|
|
64
64
|
// 边框宽度不受缩放影响
|
|
@@ -81,30 +81,27 @@ const a = ({
|
|
|
81
81
|
k(e);
|
|
82
82
|
}), e.on("moved", () => {
|
|
83
83
|
k(e);
|
|
84
|
-
}),
|
|
85
|
-
const
|
|
86
|
-
|
|
87
|
-
if (
|
|
88
|
-
const l =
|
|
89
|
-
|
|
90
|
-
const S = Array.from(u.current.values());
|
|
91
|
-
w(S);
|
|
92
|
-
}
|
|
84
|
+
}), r.add(e), $(e), e.controls.deleteControl = F(), e.controls.ocrControl = W();
|
|
85
|
+
const o = C({}, n);
|
|
86
|
+
o.name || (o.name = `${J}${c + 1}`), s.current.set(e, o), U(e, o), o.textLayouts && o.textLayouts.length > 0 && Z(e, o), o.image || A(o).then((h) => {
|
|
87
|
+
if (h) {
|
|
88
|
+
const l = s.current.get(e);
|
|
89
|
+
l && (l.image = h);
|
|
93
90
|
}
|
|
94
|
-
}).catch((
|
|
95
|
-
console.error("Failed to crop region image:",
|
|
91
|
+
}).catch((h) => {
|
|
92
|
+
console.error("Failed to crop region image:", h);
|
|
96
93
|
});
|
|
97
|
-
}), E.current = !0,
|
|
98
|
-
if (
|
|
94
|
+
}), E.current = !0, r.renderAll()) : !E.current && t.labels.length > 0 && (t.labels.forEach((n, c) => {
|
|
95
|
+
if (n.shape.name !== "rect" || Array.from(s.current.values()).find((l) => l.shape.x === n.shape.x && l.shape.y === n.shape.y && l.shape.width === n.shape.width && l.shape.height === n.shape.height))
|
|
99
96
|
return;
|
|
100
|
-
const
|
|
101
|
-
left:
|
|
102
|
-
top:
|
|
103
|
-
width:
|
|
104
|
-
height:
|
|
105
|
-
fill:
|
|
97
|
+
const u = x(n.shape.x, n.shape.y), d = r.getZoom(), e = q / d, o = new X.Rect({
|
|
98
|
+
left: u.x,
|
|
99
|
+
top: u.y,
|
|
100
|
+
width: n.shape.width,
|
|
101
|
+
height: n.shape.height,
|
|
102
|
+
fill: g,
|
|
106
103
|
// 无填充色
|
|
107
|
-
stroke:
|
|
104
|
+
stroke: j,
|
|
108
105
|
strokeWidth: e,
|
|
109
106
|
strokeUniform: !0,
|
|
110
107
|
// 边框宽度不受缩放影响
|
|
@@ -123,51 +120,48 @@ const a = ({
|
|
|
123
120
|
statefullCache: !1,
|
|
124
121
|
noScaleCache: !1
|
|
125
122
|
});
|
|
126
|
-
|
|
127
|
-
k(
|
|
128
|
-
}),
|
|
129
|
-
k(
|
|
130
|
-
}),
|
|
131
|
-
const
|
|
132
|
-
|
|
123
|
+
o.on("modified", () => {
|
|
124
|
+
k(o);
|
|
125
|
+
}), o.on("moved", () => {
|
|
126
|
+
k(o);
|
|
127
|
+
}), r.add(o), $(o), o.controls.deleteControl = F(), o.controls.ocrControl = W();
|
|
128
|
+
const h = C({}, n);
|
|
129
|
+
h.name || (h.name = `${J}${c + 1}`), s.current.set(o, h), U(o, h), h.textLayouts && h.textLayouts.length > 0 && Z(o, h), h.image || A(h).then((l) => {
|
|
133
130
|
if (l) {
|
|
134
|
-
const
|
|
135
|
-
|
|
136
|
-
const z = Array.from(u.current.values());
|
|
137
|
-
w(z);
|
|
138
|
-
}
|
|
131
|
+
const P = s.current.get(o);
|
|
132
|
+
P && (P.image = l);
|
|
139
133
|
}
|
|
140
134
|
}).catch((l) => {
|
|
141
135
|
console.error("Failed to crop region image:", l);
|
|
142
136
|
});
|
|
143
|
-
}), E.current = !0,
|
|
137
|
+
}), E.current = !0, r.renderAll());
|
|
144
138
|
}, [
|
|
145
|
-
|
|
139
|
+
r,
|
|
146
140
|
t,
|
|
147
141
|
t == null ? void 0 : t.labels,
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
N,
|
|
151
|
-
w,
|
|
152
|
-
// 添加 bgImagePosition 作为依赖,确保在位置设置后触发加载
|
|
142
|
+
i,
|
|
143
|
+
Q,
|
|
153
144
|
A,
|
|
145
|
+
V,
|
|
146
|
+
// 添加 bgImagePosition 作为依赖,确保在位置设置后触发加载
|
|
147
|
+
x,
|
|
154
148
|
k,
|
|
155
|
-
$,
|
|
156
149
|
Z,
|
|
157
|
-
W,
|
|
158
150
|
U,
|
|
159
|
-
|
|
151
|
+
F,
|
|
152
|
+
W,
|
|
153
|
+
K,
|
|
154
|
+
w,
|
|
155
|
+
S,
|
|
156
|
+
E,
|
|
157
|
+
s,
|
|
160
158
|
m,
|
|
159
|
+
N,
|
|
161
160
|
y,
|
|
162
|
-
E,
|
|
163
|
-
u,
|
|
164
161
|
_,
|
|
165
|
-
|
|
166
|
-
x,
|
|
167
|
-
F,
|
|
168
|
-
K
|
|
162
|
+
$
|
|
169
163
|
]);
|
|
170
164
|
};
|
|
171
165
|
export {
|
|
172
|
-
|
|
166
|
+
I as useRegionLoader
|
|
173
167
|
};
|
|
@@ -1,90 +1,53 @@
|
|
|
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 A } from "react";
|
|
2
|
+
import { fabric as a } from "fabric";
|
|
3
|
+
import { SELECTED_RECT_FILL_COLOR as L, RECT_STROKE_COLOR as T, CONTROL_POINT_COLOR as R, CONTROL_POINT_SIZE as E, TRANSPARENT_FILL as k, BASE_STROKE_WIDTH as g } from "../../constants.mjs";
|
|
4
|
+
const x = ({
|
|
5
|
+
canvas: e,
|
|
6
|
+
onRegionSelect: o,
|
|
7
|
+
createDeleteControl: n,
|
|
8
|
+
createOCRControl: s,
|
|
9
|
+
textLayersMapRef: C,
|
|
10
|
+
rectMapRef: i
|
|
11
11
|
}) => {
|
|
12
|
-
|
|
13
|
-
if (!
|
|
12
|
+
A(() => {
|
|
13
|
+
if (!e)
|
|
14
14
|
return;
|
|
15
|
-
const
|
|
15
|
+
const f = () => {
|
|
16
16
|
const t = /* @__PURE__ */ new Set();
|
|
17
|
-
return
|
|
18
|
-
|
|
19
|
-
t.add(
|
|
17
|
+
return C.current.forEach((r) => {
|
|
18
|
+
r.forEach((l) => {
|
|
19
|
+
t.add(l);
|
|
20
20
|
});
|
|
21
21
|
}), t;
|
|
22
|
-
},
|
|
23
|
-
const t =
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
fill:
|
|
22
|
+
}, d = () => {
|
|
23
|
+
const t = f();
|
|
24
|
+
e.getObjects().forEach((r) => {
|
|
25
|
+
r instanceof a.Rect && !t.has(r) && r.set({
|
|
26
|
+
fill: k
|
|
27
27
|
// 移除填充色
|
|
28
28
|
});
|
|
29
29
|
});
|
|
30
|
-
},
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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();
|
|
30
|
+
}, h = () => {
|
|
31
|
+
d();
|
|
32
|
+
const t = e.getActiveObject();
|
|
33
|
+
if (t && t instanceof a.Rect) {
|
|
34
|
+
if (f().has(t)) {
|
|
35
|
+
e.discardActiveObject(), e.renderAll();
|
|
73
36
|
return;
|
|
74
37
|
}
|
|
75
|
-
const
|
|
38
|
+
const l = e.getZoom(), u = g / l;
|
|
76
39
|
t.set({
|
|
77
40
|
hasRotatingPoint: !1,
|
|
78
41
|
lockRotation: !0,
|
|
79
42
|
lockUniScaling: !1,
|
|
80
43
|
// 允许非等比缩放,控制点跟随鼠标
|
|
81
|
-
fill:
|
|
44
|
+
fill: L,
|
|
82
45
|
// 选中时添加填充色
|
|
83
|
-
stroke:
|
|
46
|
+
stroke: T,
|
|
84
47
|
// 选中时取消高亮,使用普通边框颜色
|
|
85
48
|
strokeUniform: !0,
|
|
86
49
|
// 确保边框宽度不受缩放影响
|
|
87
|
-
strokeWidth:
|
|
50
|
+
strokeWidth: u,
|
|
88
51
|
// 确保边框宽度一致
|
|
89
52
|
objectCaching: !1,
|
|
90
53
|
// 禁用缓存,避免缩放时边框变虚
|
|
@@ -92,57 +55,25 @@ const G = ({
|
|
|
92
55
|
noScaleCache: !1,
|
|
93
56
|
cornerStyle: "circle",
|
|
94
57
|
// 设置控制点为圆形
|
|
95
|
-
cornerColor:
|
|
58
|
+
cornerColor: R,
|
|
96
59
|
// 设置控制点为紫色(填充色)
|
|
97
|
-
cornerSize:
|
|
60
|
+
cornerSize: E,
|
|
98
61
|
// 设置控制点大小(默认12,这里设置为6使其更小)
|
|
99
62
|
transparentCorners: !1
|
|
100
63
|
// 不透明,显示填充颜色
|
|
101
|
-
}), t.controls && t.controls.mtr && delete t.controls.mtr, t.controls.deleteControl || (t.controls.deleteControl =
|
|
102
|
-
const
|
|
103
|
-
|
|
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);
|
|
64
|
+
}), t.controls && t.controls.mtr && delete t.controls.mtr, t.controls.deleteControl || (t.controls.deleteControl = n()), t.controls.ocrControl || (t.controls.ocrControl = s()), e.renderAll();
|
|
65
|
+
const c = i.current.get(t);
|
|
66
|
+
c && o && o(c);
|
|
135
67
|
}
|
|
136
|
-
},
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
o.discardActiveObject(), o.renderAll();
|
|
68
|
+
}, O = () => {
|
|
69
|
+
d();
|
|
70
|
+
const t = e.getActiveObject();
|
|
71
|
+
if (t && t instanceof a.Rect) {
|
|
72
|
+
if (f().has(t)) {
|
|
73
|
+
e.discardActiveObject(), e.renderAll();
|
|
143
74
|
return;
|
|
144
75
|
}
|
|
145
|
-
const
|
|
76
|
+
const l = e.getZoom(), u = g / l;
|
|
146
77
|
t.set({
|
|
147
78
|
hasRotatingPoint: !1,
|
|
148
79
|
lockRotation: !0,
|
|
@@ -150,11 +81,11 @@ const G = ({
|
|
|
150
81
|
// 允许非等比缩放,控制点跟随鼠标
|
|
151
82
|
lockScalingFlip: !0,
|
|
152
83
|
// 禁止缩放时翻转
|
|
153
|
-
fill:
|
|
84
|
+
fill: L,
|
|
154
85
|
// 选中时添加填充色
|
|
155
86
|
strokeUniform: !0,
|
|
156
87
|
// 确保边框宽度不受缩放影响
|
|
157
|
-
strokeWidth:
|
|
88
|
+
strokeWidth: u,
|
|
158
89
|
// 确保边框宽度一致
|
|
159
90
|
objectCaching: !1,
|
|
160
91
|
// 禁用缓存,避免缩放时边框变虚
|
|
@@ -162,57 +93,26 @@ const G = ({
|
|
|
162
93
|
noScaleCache: !1,
|
|
163
94
|
cornerStyle: "circle",
|
|
164
95
|
// 设置控制点为圆形
|
|
165
|
-
cornerColor:
|
|
96
|
+
cornerColor: R,
|
|
166
97
|
// 设置控制点为紫色(填充色)
|
|
167
|
-
cornerSize:
|
|
98
|
+
cornerSize: E,
|
|
168
99
|
// 设置控制点大小(默认12,这里设置为6使其更小)
|
|
169
100
|
transparentCorners: !1
|
|
170
101
|
// 不透明,显示填充颜色
|
|
171
102
|
});
|
|
172
|
-
const
|
|
173
|
-
|
|
174
|
-
const
|
|
175
|
-
|
|
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);
|
|
103
|
+
const c = t;
|
|
104
|
+
c.uniformScaling = !1, t.controls && t.controls.mtr && delete t.controls.mtr, t.controls.deleteControl || (t.controls.deleteControl = n()), t.controls.ocrControl || (t.controls.ocrControl = s()), e.renderAll();
|
|
105
|
+
const S = i.current.get(t);
|
|
106
|
+
S && o && o(S);
|
|
207
107
|
}
|
|
208
|
-
},
|
|
209
|
-
|
|
108
|
+
}, m = () => {
|
|
109
|
+
d(), e.renderAll(), o && o(null);
|
|
210
110
|
};
|
|
211
|
-
return
|
|
212
|
-
|
|
111
|
+
return e.on("selection:created", h), e.on("selection:updated", O), e.on("selection:cleared", m), () => {
|
|
112
|
+
e.off("selection:created", h), e.off("selection:updated", O), e.off("selection:cleared", m);
|
|
213
113
|
};
|
|
214
|
-
}, [
|
|
114
|
+
}, [e, o, n, s, C, i]);
|
|
215
115
|
};
|
|
216
116
|
export {
|
|
217
|
-
|
|
117
|
+
x as useRegionSelection
|
|
218
118
|
};
|