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