@glodon-aiot/dataset-annotation 3.14.0-alpha.30 → 3.14.0-alpha.32
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,26 +1,26 @@
|
|
|
1
1
|
import { useEffect as b } from "react";
|
|
2
|
-
import { fabric as
|
|
2
|
+
import { fabric as c } from "fabric";
|
|
3
3
|
const O = ({
|
|
4
4
|
canvas: e,
|
|
5
5
|
draggable: i,
|
|
6
6
|
drawingMode: f,
|
|
7
7
|
textLayersMapRef: n
|
|
8
8
|
}) => {
|
|
9
|
-
const
|
|
10
|
-
const
|
|
9
|
+
const u = () => {
|
|
10
|
+
const s = /* @__PURE__ */ new Set();
|
|
11
11
|
return n.current.forEach((l) => {
|
|
12
12
|
l.forEach((r) => {
|
|
13
|
-
|
|
13
|
+
s.add(r);
|
|
14
14
|
});
|
|
15
|
-
}),
|
|
15
|
+
}), s;
|
|
16
16
|
};
|
|
17
17
|
b(() => {
|
|
18
18
|
if (!e || f) {
|
|
19
19
|
if (e) {
|
|
20
20
|
e.selection = !1, e.skipTargetFind = !1;
|
|
21
|
-
const o =
|
|
21
|
+
const o = u();
|
|
22
22
|
e.getObjects().forEach((t) => {
|
|
23
|
-
t instanceof
|
|
23
|
+
t instanceof c.Rect && o.has(t) ? t.set({
|
|
24
24
|
evented: !0,
|
|
25
25
|
selectable: !1,
|
|
26
26
|
lockMovementX: !0,
|
|
@@ -36,15 +36,15 @@ const O = ({
|
|
|
36
36
|
lockScalingX: !1,
|
|
37
37
|
lockScalingY: !1
|
|
38
38
|
});
|
|
39
|
-
}), e.defaultCursor = "default"
|
|
39
|
+
}), e.defaultCursor = "default";
|
|
40
40
|
}
|
|
41
41
|
return;
|
|
42
42
|
}
|
|
43
43
|
if (!i) {
|
|
44
44
|
e.selection = !1, e.skipTargetFind = !1;
|
|
45
|
-
const o =
|
|
45
|
+
const o = u();
|
|
46
46
|
e.getObjects().forEach((t) => {
|
|
47
|
-
t instanceof
|
|
47
|
+
t instanceof c.Rect && o.has(t) ? t.set({
|
|
48
48
|
evented: !0,
|
|
49
49
|
selectable: !1,
|
|
50
50
|
lockMovementX: !0,
|
|
@@ -60,7 +60,7 @@ const O = ({
|
|
|
60
60
|
lockScalingX: !1,
|
|
61
61
|
lockScalingY: !1
|
|
62
62
|
});
|
|
63
|
-
}), e.defaultCursor = "default"
|
|
63
|
+
}), e.defaultCursor = "default";
|
|
64
64
|
return;
|
|
65
65
|
}
|
|
66
66
|
e.selection = !1, e.skipTargetFind = !0, e.getActiveObject() && (e.discardActiveObject(), e.renderAll()), e.getObjects().forEach((o) => {
|
|
@@ -77,21 +77,21 @@ const O = ({
|
|
|
77
77
|
let l = !1;
|
|
78
78
|
const r = (o) => {
|
|
79
79
|
e.getActiveObject() && (e.discardActiveObject(), e.renderAll()), l = !0, e.selection = !1, e.skipTargetFind = !0, e.setCursor("grabbing");
|
|
80
|
-
},
|
|
80
|
+
}, k = (o) => {
|
|
81
81
|
if (l && o && o.e) {
|
|
82
|
-
const t = o.e, m = new
|
|
82
|
+
const t = o.e, m = new c.Point(t.movementX, t.movementY);
|
|
83
83
|
e.relativePan(m);
|
|
84
84
|
}
|
|
85
|
-
},
|
|
85
|
+
}, d = () => {
|
|
86
86
|
l = !1, e.selection = !1, e.skipTargetFind = !0, e.defaultCursor = "grab", e.setCursor("grab"), e.getActiveObject() && (e.discardActiveObject(), e.renderAll());
|
|
87
87
|
}, g = () => {
|
|
88
88
|
e.setCursor("grabbing");
|
|
89
89
|
};
|
|
90
|
-
return e.on("mouse:down", r), e.on("mouse:move",
|
|
91
|
-
e.off("mouse:down", r), e.off("mouse:move",
|
|
92
|
-
const o =
|
|
90
|
+
return e.on("mouse:down", r), e.on("mouse:move", k), e.on("mouse:up", d), e.on("mouse:down:before", g), () => {
|
|
91
|
+
e.off("mouse:down", r), e.off("mouse:move", k), e.off("mouse:up", d), e.off("mouse:down:before", g), e.selection = !1, e.skipTargetFind = !1;
|
|
92
|
+
const o = u();
|
|
93
93
|
e.getObjects().forEach((t) => {
|
|
94
|
-
t instanceof
|
|
94
|
+
t instanceof c.Rect && o.has(t) ? t.set({
|
|
95
95
|
evented: !0,
|
|
96
96
|
selectable: !1,
|
|
97
97
|
lockMovementX: !0,
|