@glodon-aiot/dataset-annotation 3.10.0-alpha.16 → 3.10.0-alpha.17
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,45 +1,54 @@
|
|
|
1
|
-
function
|
|
2
|
-
|
|
3
|
-
let h = -1, s = -1,
|
|
4
|
-
e.on("mouse:down", (
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}), e.on("mouse:up", (g) => {
|
|
9
|
-
if (s === -1 && h === -1)
|
|
1
|
+
function Y(e, n) {
|
|
2
|
+
T(e);
|
|
3
|
+
let h = -1, s = -1, p = 0, m = 0, w = !1;
|
|
4
|
+
e.on("mouse:down:before", (d) => {
|
|
5
|
+
const f = d.target, u = e.getActiveObject();
|
|
6
|
+
if (f && f !== e.backgroundImage && u === f) {
|
|
7
|
+
e.skipTargetFind = !1;
|
|
10
8
|
return;
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
}
|
|
10
|
+
u && (e.discardActiveObject(), e.renderAll()), e.skipTargetFind = !0;
|
|
11
|
+
}), e.on("mouse:down", (d) => {
|
|
12
|
+
if (!e.skipTargetFind)
|
|
13
13
|
return;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
w = !0, h = -1, s = -1, p = 0, m = 0;
|
|
15
|
+
const f = e.getZoom();
|
|
16
|
+
s = d.e.offsetX / f, h = d.e.offsetY / f;
|
|
17
|
+
}), e.on("mouse:up", (d) => {
|
|
18
|
+
if (e.skipTargetFind = !1, !w || (w = !1, s === -1 && h === -1))
|
|
19
|
+
return;
|
|
20
|
+
const f = e.getZoom(), u = d.e.offsetX > e.getWidth() ? e.getWidth() / f : d.e.offsetX / f, b = d.e.offsetY > e.getHeight() ? e.getHeight() / f : d.e.offsetY / f;
|
|
21
|
+
if (p = Math.abs(u - s), m = Math.abs(b - h), p === 0 || m === 0)
|
|
22
|
+
return;
|
|
23
|
+
const y = e.viewportTransform ? e.viewportTransform[4] / f : 0, F = e.viewportTransform ? e.viewportTransform[5] / f : 0;
|
|
24
|
+
let r = h > b ? b : h, i = s > u ? u : s, l = p, g = m;
|
|
25
|
+
r = r - F, i = i - y;
|
|
26
|
+
const I = () => {
|
|
27
|
+
var o, k;
|
|
19
28
|
const t = e.backgroundImage;
|
|
20
|
-
t && typeof t != "string" && ((o = t.aCoords) != null && o.tl.x, (
|
|
21
|
-
},
|
|
29
|
+
t && typeof t != "string" && ((o = t.aCoords) != null && o.tl.x, (k = t.aCoords) != null && k.tl.y), t && typeof t != "string" && t.top !== void 0 && t.height !== void 0 && t.left !== void 0 && t.width !== void 0 && (r < t.top && (g = g - (t.top - r), r = t.top), r + g > t.top + t.height && (g = t.top + t.height - r + g - g, r = t.height + t.top - g), i < t.left && (l = l - (t.left - i), i = t.left), i + l > t.left + t.width && (l = t.left + t.width - i + l - l, i = t.width + t.left - l));
|
|
30
|
+
}, X = (t) => {
|
|
22
31
|
const o = e.backgroundImage;
|
|
23
32
|
return !(o && typeof o != "string" && o.top !== void 0 && o.height !== void 0 && o.left !== void 0 && o.width !== void 0 && (t[0] < o.left || t[1] < o.top || t[0] > o.left + o.width || t[1] > o.top + o.height));
|
|
24
33
|
};
|
|
25
|
-
|
|
26
|
-
const c = [[
|
|
27
|
-
|
|
34
|
+
I();
|
|
35
|
+
const c = [[i, r], [i + l, r], [i + l, r + g], [i, r + g]];
|
|
36
|
+
n && c.every((t) => X(t)) && n({
|
|
28
37
|
id: "",
|
|
29
38
|
color: "#cccccc",
|
|
30
39
|
label: "未知",
|
|
31
40
|
box: c
|
|
32
|
-
}),
|
|
41
|
+
}), T(e);
|
|
33
42
|
});
|
|
34
43
|
}
|
|
35
|
-
const
|
|
36
|
-
e.off("mouse:down"), e.off("mouse:up");
|
|
44
|
+
const T = (e) => {
|
|
45
|
+
e.off("mouse:down"), e.off("mouse:down:before"), e.off("mouse:up"), e.skipTargetFind = !1;
|
|
37
46
|
};
|
|
38
|
-
function
|
|
47
|
+
function j(e, n, h) {
|
|
39
48
|
if (!h)
|
|
40
|
-
return
|
|
49
|
+
return Y(e, n), e;
|
|
41
50
|
}
|
|
42
51
|
export {
|
|
43
|
-
|
|
44
|
-
|
|
52
|
+
j as drawable,
|
|
53
|
+
T as stopDraw
|
|
45
54
|
};
|