@realsee/dnalogel 3.48.0 → 3.48.2
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/CHANGELOG.md +6 -0
- package/dist/Sculpt/Objects/Base/index.d.ts +16 -0
- package/dist/Sculpt/Objects/Line/index.d.ts +12 -1
- package/dist/Sculpt/Objects/Polygon/index.d.ts +12 -1
- package/dist/Sculpt/Objects/Polyline/index.d.ts +12 -1
- package/dist/Sculpt/index.d.ts +10 -3
- package/dist/index.cjs.js +57 -57
- package/dist/index.js +5011 -4885
- package/dist/index.umd.js +50 -50
- package/dist/shared-utils/promise/withResolvers.d.ts +10 -0
- package/dist/shared-utils/three/Magnifier.d.ts +1 -1
- package/dist/shared-utils/three/PointSelector/utils/PointSelectorHelper.d.ts +4 -1
- package/libs/Sculpt/Meshes/Line.js +15 -15
- package/libs/Sculpt/Meshes/Polygon.js +20 -20
- package/libs/Sculpt/Objects/Base/index.d.ts +16 -0
- package/libs/Sculpt/Objects/Base/index.js +58 -32
- package/libs/Sculpt/Objects/Box/index.js +31 -34
- package/libs/Sculpt/Objects/Circle/index.js +36 -39
- package/libs/Sculpt/Objects/Line/index.d.ts +12 -1
- package/libs/Sculpt/Objects/Line/index.js +104 -75
- package/libs/Sculpt/Objects/Point/index.js +13 -16
- package/libs/Sculpt/Objects/Polygon/index.d.ts +12 -1
- package/libs/Sculpt/Objects/Polygon/index.js +112 -84
- package/libs/Sculpt/Objects/Polyline/index.d.ts +12 -1
- package/libs/Sculpt/Objects/Polyline/index.js +97 -68
- package/libs/Sculpt/Objects/Prism/index.js +20 -23
- package/libs/Sculpt/Objects/Rectangle/index.js +36 -39
- package/libs/Sculpt/index.d.ts +10 -3
- package/libs/Sculpt/index.js +80 -65
- package/libs/base/BasePlugin.js +1 -1
- package/libs/index.js +127 -126
- package/libs/shared-utils/logger.js +1 -1
- package/libs/shared-utils/promise/withResolvers.d.ts +10 -0
- package/libs/shared-utils/promise/withResolvers.js +13 -0
- package/libs/shared-utils/tag.js +9 -9
- package/libs/shared-utils/three/Magnifier.d.ts +1 -1
- package/libs/shared-utils/three/Magnifier.js +12 -12
- package/libs/shared-utils/three/PointSelector/utils/PointSelectorHelper.d.ts +4 -1
- package/libs/shared-utils/three/PointSelector/utils/PointSelectorHelper.js +9 -9
- package/package.json +1 -1
|
@@ -1,53 +1,52 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
1
|
+
var F = Object.defineProperty, T = Object.defineProperties;
|
|
2
|
+
var k = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var E = Object.getOwnPropertySymbols;
|
|
4
|
+
var z = Object.prototype.hasOwnProperty, B = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var v = (n, t, e) => t in n ? F(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e, p = (n, t) => {
|
|
6
6
|
for (var e in t || (t = {}))
|
|
7
|
-
|
|
8
|
-
if (
|
|
9
|
-
for (var e of
|
|
10
|
-
|
|
7
|
+
z.call(t, e) && v(n, e, t[e]);
|
|
8
|
+
if (E)
|
|
9
|
+
for (var e of E(t))
|
|
10
|
+
B.call(t, e) && v(n, e, t[e]);
|
|
11
11
|
return n;
|
|
12
|
-
},
|
|
13
|
-
var
|
|
14
|
-
var
|
|
15
|
-
var
|
|
12
|
+
}, M = (n, t) => T(n, k(t));
|
|
13
|
+
var y = (n, t, e) => (v(n, typeof t != "symbol" ? t + "" : t, e), e);
|
|
14
|
+
var R = (n, t, e) => new Promise((s, P) => {
|
|
15
|
+
var w = (o) => {
|
|
16
16
|
try {
|
|
17
|
-
|
|
18
|
-
} catch (
|
|
19
|
-
|
|
17
|
+
c(e.next(o));
|
|
18
|
+
} catch (a) {
|
|
19
|
+
P(a);
|
|
20
20
|
}
|
|
21
|
-
},
|
|
21
|
+
}, b = (o) => {
|
|
22
22
|
try {
|
|
23
|
-
|
|
24
|
-
} catch (
|
|
25
|
-
|
|
23
|
+
c(e.throw(o));
|
|
24
|
+
} catch (a) {
|
|
25
|
+
P(a);
|
|
26
26
|
}
|
|
27
|
-
},
|
|
28
|
-
|
|
27
|
+
}, c = (o) => o.done ? s(o.value) : Promise.resolve(o.value).then(w, b);
|
|
28
|
+
c((e = e.apply(n, t)).next());
|
|
29
29
|
});
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import
|
|
33
|
-
import
|
|
34
|
-
import {
|
|
35
|
-
import {
|
|
36
|
-
const
|
|
37
|
-
class
|
|
38
|
-
constructor(e,
|
|
39
|
-
super(e,
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
});
|
|
30
|
+
import { PolylineWithDotsMesh as U, PolylineMesh as W } from "../../Meshes/Polyline.js";
|
|
31
|
+
import { BaseObject as H } from "../Base/index.js";
|
|
32
|
+
import * as d from "three";
|
|
33
|
+
import { PolylineEditor as I } from "./Editor.js";
|
|
34
|
+
import { vector3ToArray as N } from "../../../shared-utils/three/vector3ToArray.js";
|
|
35
|
+
import { withResolvers as _ } from "../../../shared-utils/promise/withResolvers.js";
|
|
36
|
+
const V = new d.Vector3();
|
|
37
|
+
class Z extends H {
|
|
38
|
+
constructor(e, s) {
|
|
39
|
+
super(e, s);
|
|
40
|
+
y(this, "type", "Polyline");
|
|
41
|
+
y(this, "polyLineMesh");
|
|
42
|
+
y(this, "creatingObject");
|
|
43
|
+
e && (this.polyLineMesh = new U(p(p({}, e.style), e)), this.add(this.polyLineMesh)), this.editor = new I(this);
|
|
45
44
|
}
|
|
46
45
|
get data() {
|
|
47
|
-
return
|
|
48
|
-
points:
|
|
46
|
+
return M(p({}, this.baseData), {
|
|
47
|
+
points: N(this.applyObjectMatrixWorld(this.polyLineMesh.points)),
|
|
49
48
|
style: {
|
|
50
|
-
lineColor: new
|
|
49
|
+
lineColor: new d.Color(this.polyLineMesh.lineColor).getHex(),
|
|
51
50
|
lineWidth: this.polyLineMesh.lineWidth,
|
|
52
51
|
dashed: this.polyLineMesh.dashed
|
|
53
52
|
}
|
|
@@ -61,41 +60,71 @@ class G extends O {
|
|
|
61
60
|
var e;
|
|
62
61
|
(e = this.polyLineMesh) == null || e.unhighlight();
|
|
63
62
|
}
|
|
63
|
+
canUndo() {
|
|
64
|
+
var e;
|
|
65
|
+
(e = this.creatingObject) == null || e.canUndo();
|
|
66
|
+
}
|
|
67
|
+
canRedo() {
|
|
68
|
+
var e;
|
|
69
|
+
(e = this.creatingObject) == null || e.canRedo();
|
|
70
|
+
}
|
|
71
|
+
undo() {
|
|
72
|
+
var e;
|
|
73
|
+
(e = this.creatingObject) == null || e.undo();
|
|
74
|
+
}
|
|
75
|
+
redo() {
|
|
76
|
+
var e;
|
|
77
|
+
(e = this.creatingObject) == null || e.redo();
|
|
78
|
+
}
|
|
64
79
|
create(e) {
|
|
65
|
-
return
|
|
80
|
+
return R(this, null, function* () {
|
|
66
81
|
this.removeChildren();
|
|
67
|
-
const
|
|
68
|
-
this.polyLineMesh =
|
|
82
|
+
const s = new U(e);
|
|
83
|
+
this.polyLineMesh = s, this.add(this.polyLineMesh), this.creatingObject = q(s, this.pointSelector, e), yield this.creatingObject.finished, this.editor.enable();
|
|
69
84
|
});
|
|
70
85
|
}
|
|
71
86
|
}
|
|
72
|
-
function
|
|
73
|
-
var
|
|
74
|
-
const
|
|
75
|
-
if (!
|
|
87
|
+
function q(n, t, e) {
|
|
88
|
+
var x;
|
|
89
|
+
const s = n.parent;
|
|
90
|
+
if (!s)
|
|
76
91
|
return;
|
|
77
|
-
const
|
|
78
|
-
|
|
79
|
-
const
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
92
|
+
const { promise: P, resolve: w, reject: b } = _(), c = (x = e == null ? void 0 : e.limit) != null ? x : "none", o = new W(n.style);
|
|
93
|
+
s.add(o);
|
|
94
|
+
const a = new W(M(p({}, n.style), { dashed: !0, lengthEnable: !1 }));
|
|
95
|
+
s.add(a), t.enable();
|
|
96
|
+
const i = [];
|
|
97
|
+
let r, l, j;
|
|
98
|
+
const f = [], O = () => i.length > 0, L = () => f.length > 0, A = () => {
|
|
99
|
+
O() && (f.push(i.pop()), n.setPoints(i), g(j), t.pointSelectorHelper.magnifier.render());
|
|
100
|
+
}, D = () => {
|
|
101
|
+
L() && (i.push(f.pop()), n.setPoints(i), g(j), t.pointSelectorHelper.magnifier.render());
|
|
102
|
+
}, C = (h) => {
|
|
103
|
+
f.length = 0;
|
|
104
|
+
const m = i.length === 0 ? h.point : r.clone();
|
|
105
|
+
i.push(m), n.setPoints(i);
|
|
106
|
+
}, g = (h) => {
|
|
107
|
+
const m = () => {
|
|
108
|
+
o.setPoints([]), a.setPoints([]), r = null;
|
|
91
109
|
};
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
}
|
|
110
|
+
if (!(i != null && i.length) || !h)
|
|
111
|
+
return m();
|
|
112
|
+
j = h;
|
|
113
|
+
const u = i.at(-1).clone();
|
|
114
|
+
c === "none" ? (r = h.point, o.setPoints([u, r])) : c === "xoz" ? (l = l != null ? l : new d.Plane().setFromNormalAndCoplanarPoint(new d.Vector3(0, 1, 0), i[0]), t.plane = l, r = l.projectPoint(h.point, V), o.setPoints([u, r]), a.setPoints([r, h.point])) : c === "y" && (i.length === 1 ? (r = h.point, o.setPoints([u, r])) : (l = l != null ? l : new d.Plane().setFromCoplanarPoints(i[0], i[1], new d.Vector3(0, 1, 0).add(i[0])), t.plane = l, r = l.projectPoint(h.point, V), o.setPoints([u, r]), a.setPoints([r, h.point])));
|
|
115
|
+
};
|
|
116
|
+
return t.on("select", C), t.on("intersectionUpdate", g), t.on("disable", () => {
|
|
117
|
+
if (t.off("select", C), t.off("intersectionUpdate", g), t.plane = null, s.remove(o), s.remove(a), i.length < 2)
|
|
118
|
+
return s.remove(n), b(new Error("Cancelled"));
|
|
119
|
+
w();
|
|
120
|
+
}), {
|
|
121
|
+
finished: P,
|
|
122
|
+
canUndo: O,
|
|
123
|
+
canRedo: L,
|
|
124
|
+
undo: A,
|
|
125
|
+
redo: D
|
|
126
|
+
};
|
|
98
127
|
}
|
|
99
128
|
export {
|
|
100
|
-
|
|
129
|
+
Z as Polyline
|
|
101
130
|
};
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
var E = Object.defineProperty, L = Object.defineProperties;
|
|
2
2
|
var O = Object.getOwnPropertyDescriptors;
|
|
3
3
|
var u = Object.getOwnPropertySymbols;
|
|
4
|
-
var v = Object.prototype.hasOwnProperty,
|
|
4
|
+
var v = Object.prototype.hasOwnProperty, W = Object.prototype.propertyIsEnumerable;
|
|
5
5
|
var p = (i, e, t) => e in i ? E(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t, c = (i, e) => {
|
|
6
6
|
for (var t in e || (e = {}))
|
|
7
7
|
v.call(e, t) && p(i, t, e[t]);
|
|
8
8
|
if (u)
|
|
9
9
|
for (var t of u(e))
|
|
10
|
-
|
|
10
|
+
W.call(e, t) && p(i, t, e[t]);
|
|
11
11
|
return i;
|
|
12
12
|
}, w = (i, e) => L(i, O(e));
|
|
13
13
|
var d = (i, e, t) => (p(i, typeof e != "symbol" ? e + "" : e, t), t);
|
|
14
|
-
var
|
|
14
|
+
var f = (i, e, t) => new Promise((o, n) => {
|
|
15
15
|
var l = (s) => {
|
|
16
16
|
try {
|
|
17
17
|
r(t.next(s));
|
|
@@ -27,24 +27,21 @@ var g = (i, e, t) => new Promise((o, n) => {
|
|
|
27
27
|
}, r = (s) => s.done ? o(s.value) : Promise.resolve(s.value).then(l, m);
|
|
28
28
|
r((t = t.apply(i, e)).next());
|
|
29
29
|
});
|
|
30
|
-
import { BaseObject as
|
|
31
|
-
import * as
|
|
30
|
+
import { BaseObject as j } from "../Base/index.js";
|
|
31
|
+
import * as C from "three";
|
|
32
32
|
import { createPolygon as T } from "../Polygon/index.js";
|
|
33
33
|
import { PrismMesh as x } from "../../Meshes/Prism.js";
|
|
34
34
|
import { LineMesh as U } from "../../Meshes/Line.js";
|
|
35
|
-
import { PrismEditor as
|
|
36
|
-
import { hotkeys as z } from "../../../vendor/hotkeys-js/dist/hotkeys.esm.js";
|
|
35
|
+
import { PrismEditor as z } from "./Editor.js";
|
|
37
36
|
import { rayOnLine as A } from "../../utils/three/rayOnLine.js";
|
|
38
37
|
import { getNormal as B } from "../../../shared-utils/three/getNormal.js";
|
|
39
38
|
import { vector3ToArray as H } from "../../../shared-utils/three/vector3ToArray.js";
|
|
40
|
-
class
|
|
39
|
+
class Q extends j {
|
|
41
40
|
constructor(t, o) {
|
|
42
41
|
super(t, o);
|
|
43
42
|
d(this, "type", "Prism");
|
|
44
43
|
d(this, "prismMesh");
|
|
45
|
-
this.editor = new
|
|
46
|
-
this.stopCreating();
|
|
47
|
-
});
|
|
44
|
+
this.editor = new z(this), t && (this.prismMesh = new x(c(c({}, t.style), t)), this.add(this.prismMesh));
|
|
48
45
|
}
|
|
49
46
|
get data() {
|
|
50
47
|
return w(c({}, this.baseData), {
|
|
@@ -66,38 +63,38 @@ class X extends W {
|
|
|
66
63
|
(t = this.prismMesh) == null || t.unhighlight();
|
|
67
64
|
}
|
|
68
65
|
create(t) {
|
|
69
|
-
return
|
|
66
|
+
return f(this, null, function* () {
|
|
70
67
|
this.prismMesh = new x(t), this.add(this.prismMesh), yield D(this.prismMesh, this.pointSelector), this.editor.enable();
|
|
71
68
|
});
|
|
72
69
|
}
|
|
73
70
|
}
|
|
74
71
|
function D(i, e) {
|
|
75
|
-
return
|
|
72
|
+
return f(this, null, function* () {
|
|
76
73
|
const t = i.parent;
|
|
77
|
-
yield T(i.bottomPolygon, e);
|
|
74
|
+
yield T(i.bottomPolygon, e).finished;
|
|
78
75
|
const o = new U();
|
|
79
76
|
o.name = "LineHelper", t.add(o);
|
|
80
77
|
const n = i.bottomPolygon.points.at(-1), l = B(i.bottomPolygon.points).normalize(), m = n.clone().add(l.clone().multiplyScalar(10)), r = n.clone().sub(l.clone().multiplyScalar(10));
|
|
81
78
|
return o.setPoints([m, r]), e.enable(), new Promise((s, h) => {
|
|
82
|
-
const
|
|
83
|
-
|
|
84
|
-
},
|
|
79
|
+
const g = (a) => {
|
|
80
|
+
y(), s();
|
|
81
|
+
}, P = (a) => {
|
|
85
82
|
if (!(a != null && a.raycaster))
|
|
86
83
|
return;
|
|
87
84
|
const M = A({
|
|
88
85
|
raycaster: a.raycaster,
|
|
89
|
-
line: new
|
|
86
|
+
line: new C.Line3(m, r)
|
|
90
87
|
});
|
|
91
88
|
M && i.setPoints({ heightPoint: M });
|
|
92
|
-
},
|
|
93
|
-
e.off("select",
|
|
89
|
+
}, y = () => {
|
|
90
|
+
e.off("select", g), e.off("intersectionUpdate", P), e.off("disable", b), t.remove(o), e.disable();
|
|
94
91
|
}, b = () => {
|
|
95
|
-
|
|
92
|
+
y(), t.remove(i), h(new Error("Cancelled"));
|
|
96
93
|
};
|
|
97
|
-
e.on("select",
|
|
94
|
+
e.on("select", g), e.on("intersectionUpdate", P), e.on("disable", b);
|
|
98
95
|
});
|
|
99
96
|
});
|
|
100
97
|
}
|
|
101
98
|
export {
|
|
102
|
-
|
|
99
|
+
Q as Prism
|
|
103
100
|
};
|
|
@@ -1,47 +1,44 @@
|
|
|
1
|
-
var U = Object.defineProperty,
|
|
2
|
-
var
|
|
1
|
+
var U = Object.defineProperty, B = Object.defineProperties;
|
|
2
|
+
var I = Object.getOwnPropertyDescriptors;
|
|
3
3
|
var A = Object.getOwnPropertySymbols;
|
|
4
|
-
var
|
|
4
|
+
var _ = Object.prototype.hasOwnProperty, j = Object.prototype.propertyIsEnumerable;
|
|
5
5
|
var E = (s, t, e) => t in s ? U(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e, d = (s, t) => {
|
|
6
6
|
for (var e in t || (t = {}))
|
|
7
|
-
|
|
7
|
+
_.call(t, e) && E(s, e, t[e]);
|
|
8
8
|
if (A)
|
|
9
9
|
for (var e of A(t))
|
|
10
|
-
|
|
10
|
+
j.call(t, e) && E(s, e, t[e]);
|
|
11
11
|
return s;
|
|
12
|
-
}, u = (s, t) =>
|
|
12
|
+
}, u = (s, t) => B(s, I(t));
|
|
13
13
|
var L = (s, t, e) => (E(s, typeof t != "symbol" ? t + "" : t, e), e);
|
|
14
14
|
var D = (s, t, e) => new Promise((c, p) => {
|
|
15
15
|
var a = (l) => {
|
|
16
16
|
try {
|
|
17
|
-
|
|
17
|
+
m(e.next(l));
|
|
18
18
|
} catch (h) {
|
|
19
19
|
p(h);
|
|
20
20
|
}
|
|
21
|
-
},
|
|
21
|
+
}, g = (l) => {
|
|
22
22
|
try {
|
|
23
|
-
|
|
23
|
+
m(e.throw(l));
|
|
24
24
|
} catch (h) {
|
|
25
25
|
p(h);
|
|
26
26
|
}
|
|
27
|
-
},
|
|
28
|
-
|
|
27
|
+
}, m = (l) => l.done ? c(l.value) : Promise.resolve(l.value).then(a, g);
|
|
28
|
+
m((e = e.apply(s, t)).next());
|
|
29
29
|
});
|
|
30
|
-
import {
|
|
31
|
-
import { BaseObject as q } from "../Base/index.js";
|
|
30
|
+
import { BaseObject as k } from "../Base/index.js";
|
|
32
31
|
import * as o from "three";
|
|
33
32
|
import { PolylineWithDotsMesh as M } from "../../Meshes/Polyline.js";
|
|
34
|
-
import { RectangleEditor as
|
|
33
|
+
import { RectangleEditor as q } from "./Editor.js";
|
|
35
34
|
import { RectangleWithEdgeMesh as H } from "../../Meshes/RectangleWithEdge.js";
|
|
36
35
|
const P = new o.Vector3();
|
|
37
|
-
class
|
|
36
|
+
class Z extends k {
|
|
38
37
|
constructor(e, c) {
|
|
39
38
|
super(e, c);
|
|
40
39
|
L(this, "type", "Rectangle");
|
|
41
40
|
L(this, "rectangleMesh");
|
|
42
|
-
this.config.canEdit && (this.editor = new
|
|
43
|
-
this.stopCreating();
|
|
44
|
-
});
|
|
41
|
+
this.config.canEdit && (this.editor = new q(this)), e && (this.rectangleMesh = new H(d(d({}, e.style), e)), this.add(this.rectangleMesh));
|
|
45
42
|
}
|
|
46
43
|
get data() {
|
|
47
44
|
return u(d({}, this.baseData), {
|
|
@@ -65,23 +62,23 @@ class S extends q {
|
|
|
65
62
|
return D(this, null, function* () {
|
|
66
63
|
this.removeChildren();
|
|
67
64
|
const c = new H(e);
|
|
68
|
-
this.rectangleMesh = c, this.add(this.rectangleMesh), yield
|
|
65
|
+
this.rectangleMesh = c, this.add(this.rectangleMesh), yield G(this.rectangleMesh, this.pointSelector, e);
|
|
69
66
|
});
|
|
70
67
|
}
|
|
71
68
|
}
|
|
72
|
-
function
|
|
69
|
+
function G(s, t, e) {
|
|
73
70
|
return new Promise((c, p) => {
|
|
74
71
|
var N, T;
|
|
75
72
|
const a = s.parent;
|
|
76
73
|
if (!a)
|
|
77
74
|
return p(new Error("No container"));
|
|
78
|
-
const
|
|
75
|
+
const g = (N = e == null ? void 0 : e.limit) != null ? N : "none", m = (T = e == null ? void 0 : e.drawMethod) != null ? T : "diagonal", l = new M(u(d({}, s.style), { dashed: !0, lengthEnable: !0 })), h = new M(u(d({}, s.style), { dashed: !0, lengthEnable: !1 })), y = new M(u(d({}, s.style), { dashed: !1, lengthEnable: !1 }));
|
|
79
76
|
a.add(l, y, h), t.enable();
|
|
80
77
|
const n = [];
|
|
81
78
|
let i = new o.Vector3(), v = new o.Vector3();
|
|
82
|
-
const
|
|
83
|
-
n.push(i.clone()), n.length === 1 ? (
|
|
84
|
-
},
|
|
79
|
+
const w = new o.Plane(), x = () => {
|
|
80
|
+
n.push(i.clone()), n.length === 1 ? (g === "xoz" && w.setFromNormalAndCoplanarPoint(new o.Vector3(0, 1, 0), n[0]), g === "none" && w.setFromNormalAndCoplanarPoint(v, n[0])) : n.length === 2 ? g === "y" ? (V(), c()) : y.setPoints([n[0], n[1]]) : n.length === 3 && (V(), c());
|
|
81
|
+
}, C = (r) => {
|
|
85
82
|
var W;
|
|
86
83
|
if (!(r != null && r.raycaster))
|
|
87
84
|
return;
|
|
@@ -90,36 +87,36 @@ function J(s, t, e) {
|
|
|
90
87
|
i = r.point.clone(), v = r.face.normal;
|
|
91
88
|
return;
|
|
92
89
|
}
|
|
93
|
-
if (n.length === 1 &&
|
|
94
|
-
const
|
|
95
|
-
s.setPoints([n[0],
|
|
90
|
+
if (n.length === 1 && g === "y") {
|
|
91
|
+
const f = new o.Line3(new o.Vector3(0, 1, 0).add(n[0]), new o.Vector3(0, -1, 0).add(n[0])).closestPointToPoint(r.point, !1, new o.Vector3());
|
|
92
|
+
s.setPoints([n[0], f, r.point]);
|
|
96
93
|
return;
|
|
97
94
|
}
|
|
98
95
|
if (n.length === 1) {
|
|
99
|
-
|
|
96
|
+
w ? (i = r.raycaster.ray.intersectPlane(w, P), h.setPoints([i, r.point])) : i = r.point.clone(), l.setPoints([O, i]);
|
|
100
97
|
return;
|
|
101
98
|
}
|
|
102
99
|
if (n.length === 2) {
|
|
103
100
|
a.remove(l);
|
|
104
|
-
const z = r.raycaster.ray.intersectPlane(
|
|
105
|
-
if (
|
|
106
|
-
const
|
|
107
|
-
i = new o.Vector3().addVectors(b, F.multiplyScalar(
|
|
108
|
-
} else if (
|
|
109
|
-
const
|
|
110
|
-
i = new o.Line3(n[1].clone().add(
|
|
101
|
+
const z = r.raycaster.ray.intersectPlane(w, P);
|
|
102
|
+
if (m === "diagonal") {
|
|
103
|
+
const f = n[0].distanceTo(n[1]) / 2, b = new o.Vector3().lerpVectors(n[0], n[1], 0.5), F = new o.Vector3().subVectors(z, b).normalize();
|
|
104
|
+
i = new o.Vector3().addVectors(b, F.multiplyScalar(f)), s.setPoints([n[0], i, n[1]]);
|
|
105
|
+
} else if (m === "vertex") {
|
|
106
|
+
const f = P.crossVectors(n[0].clone().sub(n[1]), w.normal).normalize();
|
|
107
|
+
i = new o.Line3(n[1].clone().add(f), n[1].clone().sub(f)).closestPointToPoint(r.point, !1, P), s.setPoints([n[0], n[1], i]);
|
|
111
108
|
}
|
|
112
109
|
return;
|
|
113
110
|
}
|
|
114
111
|
}, V = () => {
|
|
115
|
-
t.off("select",
|
|
112
|
+
t.off("select", x), t.off("intersectionUpdate", C), t.off("disable", R), t.disable(), a == null || a.remove(l, y, h);
|
|
116
113
|
}, R = () => {
|
|
117
114
|
V(), a == null || a.remove(s), p(new Error("Cancelled"));
|
|
118
115
|
};
|
|
119
|
-
t.on("select",
|
|
116
|
+
t.on("select", x), t.on("intersectionUpdate", C), t.on("disable", R);
|
|
120
117
|
});
|
|
121
118
|
}
|
|
122
119
|
export {
|
|
123
|
-
|
|
124
|
-
|
|
120
|
+
Z as Rectangle,
|
|
121
|
+
G as createRectangle
|
|
125
122
|
};
|
package/libs/Sculpt/index.d.ts
CHANGED
|
@@ -67,7 +67,11 @@ export declare class Sculpt extends Subscribe<Event> {
|
|
|
67
67
|
id: string;
|
|
68
68
|
type: string;
|
|
69
69
|
} | {
|
|
70
|
-
readonly points: [number, number, number][];
|
|
70
|
+
readonly points: [number, number, number][]; /**
|
|
71
|
+
* @description: 点击事件
|
|
72
|
+
* @param {BuiltInItem} item 点击的物体
|
|
73
|
+
* 返回 false 来禁用 Five 默认行为
|
|
74
|
+
*/
|
|
71
75
|
readonly heightPoint: [number, number, number];
|
|
72
76
|
readonly style: {
|
|
73
77
|
readonly color: number;
|
|
@@ -109,6 +113,7 @@ export declare class Sculpt extends Subscribe<Event> {
|
|
|
109
113
|
get items(): BuiltInItem[];
|
|
110
114
|
private five;
|
|
111
115
|
private theme;
|
|
116
|
+
private creatingItem;
|
|
112
117
|
constructor(five: Five, theme?: Theme);
|
|
113
118
|
/**
|
|
114
119
|
* @description: 加载数据 展示
|
|
@@ -158,14 +163,16 @@ export declare class Sculpt extends Subscribe<Event> {
|
|
|
158
163
|
* @description: 开始绘制 Box
|
|
159
164
|
*/
|
|
160
165
|
createBox(params?: Parameters<Box['create']>[0]): Promise<Box>;
|
|
166
|
+
canUndo(): false | void;
|
|
167
|
+
canRedo(): false | void;
|
|
161
168
|
/**
|
|
162
169
|
* @description: 撤销
|
|
163
170
|
*/
|
|
164
|
-
undo()
|
|
171
|
+
undo: () => void;
|
|
165
172
|
/**
|
|
166
173
|
* @description: 重做
|
|
167
174
|
*/
|
|
168
|
-
redo()
|
|
175
|
+
redo: () => void;
|
|
169
176
|
/**
|
|
170
177
|
* @description: 清空数据
|
|
171
178
|
*/
|