@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.
Files changed (40) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/Sculpt/Objects/Base/index.d.ts +16 -0
  3. package/dist/Sculpt/Objects/Line/index.d.ts +12 -1
  4. package/dist/Sculpt/Objects/Polygon/index.d.ts +12 -1
  5. package/dist/Sculpt/Objects/Polyline/index.d.ts +12 -1
  6. package/dist/Sculpt/index.d.ts +10 -3
  7. package/dist/index.cjs.js +57 -57
  8. package/dist/index.js +5011 -4885
  9. package/dist/index.umd.js +50 -50
  10. package/dist/shared-utils/promise/withResolvers.d.ts +10 -0
  11. package/dist/shared-utils/three/Magnifier.d.ts +1 -1
  12. package/dist/shared-utils/three/PointSelector/utils/PointSelectorHelper.d.ts +4 -1
  13. package/libs/Sculpt/Meshes/Line.js +15 -15
  14. package/libs/Sculpt/Meshes/Polygon.js +20 -20
  15. package/libs/Sculpt/Objects/Base/index.d.ts +16 -0
  16. package/libs/Sculpt/Objects/Base/index.js +58 -32
  17. package/libs/Sculpt/Objects/Box/index.js +31 -34
  18. package/libs/Sculpt/Objects/Circle/index.js +36 -39
  19. package/libs/Sculpt/Objects/Line/index.d.ts +12 -1
  20. package/libs/Sculpt/Objects/Line/index.js +104 -75
  21. package/libs/Sculpt/Objects/Point/index.js +13 -16
  22. package/libs/Sculpt/Objects/Polygon/index.d.ts +12 -1
  23. package/libs/Sculpt/Objects/Polygon/index.js +112 -84
  24. package/libs/Sculpt/Objects/Polyline/index.d.ts +12 -1
  25. package/libs/Sculpt/Objects/Polyline/index.js +97 -68
  26. package/libs/Sculpt/Objects/Prism/index.js +20 -23
  27. package/libs/Sculpt/Objects/Rectangle/index.js +36 -39
  28. package/libs/Sculpt/index.d.ts +10 -3
  29. package/libs/Sculpt/index.js +80 -65
  30. package/libs/base/BasePlugin.js +1 -1
  31. package/libs/index.js +127 -126
  32. package/libs/shared-utils/logger.js +1 -1
  33. package/libs/shared-utils/promise/withResolvers.d.ts +10 -0
  34. package/libs/shared-utils/promise/withResolvers.js +13 -0
  35. package/libs/shared-utils/tag.js +9 -9
  36. package/libs/shared-utils/three/Magnifier.d.ts +1 -1
  37. package/libs/shared-utils/three/Magnifier.js +12 -12
  38. package/libs/shared-utils/three/PointSelector/utils/PointSelectorHelper.d.ts +4 -1
  39. package/libs/shared-utils/three/PointSelector/utils/PointSelectorHelper.js +9 -9
  40. package/package.json +1 -1
@@ -1,53 +1,52 @@
1
- var j = Object.defineProperty, W = Object.defineProperties;
2
- var V = Object.getOwnPropertyDescriptors;
3
- var L = Object.getOwnPropertySymbols;
4
- var A = Object.prototype.hasOwnProperty, D = Object.prototype.propertyIsEnumerable;
5
- var w = (n, t, e) => t in n ? j(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e, f = (n, t) => {
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
- A.call(t, e) && w(n, e, t[e]);
8
- if (L)
9
- for (var e of L(t))
10
- D.call(t, e) && w(n, e, t[e]);
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
- }, u = (n, t) => W(n, V(t));
13
- var g = (n, t, e) => (w(n, typeof t != "symbol" ? t + "" : t, e), e);
14
- var C = (n, t, e) => new Promise((i, p) => {
15
- var a = (h) => {
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
- y(e.next(h));
18
- } catch (m) {
19
- p(m);
17
+ c(e.next(o));
18
+ } catch (a) {
19
+ P(a);
20
20
  }
21
- }, d = (h) => {
21
+ }, b = (o) => {
22
22
  try {
23
- y(e.throw(h));
24
- } catch (m) {
25
- p(m);
23
+ c(e.throw(o));
24
+ } catch (a) {
25
+ P(a);
26
26
  }
27
- }, y = (h) => h.done ? i(h.value) : Promise.resolve(h.value).then(a, d);
28
- y((e = e.apply(n, t)).next());
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 { hotkeys as F } from "../../../vendor/hotkeys-js/dist/hotkeys.esm.js";
31
- import { PolylineWithDotsMesh as b, PolylineMesh as x } from "../../Meshes/Polyline.js";
32
- import { BaseObject as O } from "../Base/index.js";
33
- import * as c from "three";
34
- import { PolylineEditor as T } from "./Editor.js";
35
- import { vector3ToArray as U } from "../../../shared-utils/three/vector3ToArray.js";
36
- const E = new c.Vector3();
37
- class G extends O {
38
- constructor(e, i) {
39
- super(e, i);
40
- g(this, "type", "Polyline");
41
- g(this, "polyLineMesh");
42
- e && (this.polyLineMesh = new b(f(f({}, e.style), e)), this.add(this.polyLineMesh)), this.editor = new T(this), F("esc", () => {
43
- this.stopCreating();
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 u(f({}, this.baseData), {
48
- points: U(this.applyObjectMatrixWorld(this.polyLineMesh.points)),
46
+ return M(p({}, this.baseData), {
47
+ points: N(this.applyObjectMatrixWorld(this.polyLineMesh.points)),
49
48
  style: {
50
- lineColor: new c.Color(this.polyLineMesh.lineColor).getHex(),
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 C(this, null, function* () {
80
+ return R(this, null, function* () {
66
81
  this.removeChildren();
67
- const i = new b(e);
68
- this.polyLineMesh = i, this.add(this.polyLineMesh), yield k(i, this.pointSelector, e), this.editor.enable();
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 k(n, t, e) {
73
- var y;
74
- const i = n.parent;
75
- if (!i)
87
+ function q(n, t, e) {
88
+ var x;
89
+ const s = n.parent;
90
+ if (!s)
76
91
  return;
77
- const p = (y = e == null ? void 0 : e.limit) != null ? y : "none", a = new x(n.style);
78
- i.add(a);
79
- const d = new x(u(f({}, n.style), { dashed: !0, lengthEnable: !1 }));
80
- return i.add(d), t.enable(), new Promise((h, m) => {
81
- const o = [];
82
- let l, s;
83
- const M = (r) => {
84
- const P = o.length === 0 ? r.point : l.clone();
85
- o.push(P), n.setPoints(o);
86
- }, v = (r) => {
87
- if (!(o != null && o.length) || !r)
88
- return;
89
- const P = o.at(-1).clone();
90
- p === "none" ? (l = r.point, a.setPoints([P, l])) : p === "xoz" ? (s = s != null ? s : new c.Plane().setFromNormalAndCoplanarPoint(new c.Vector3(0, 1, 0), o[0]), t.plane = s, l = s.projectPoint(r.point, E), a.setPoints([P, l]), d.setPoints([l, r.point])) : p === "y" && (o.length === 1 ? (l = r.point, a.setPoints([P, l])) : (s = s != null ? s : new c.Plane().setFromCoplanarPoints(o[0], o[1], new c.Vector3(0, 1, 0).add(o[0])), t.plane = s, l = s.projectPoint(r.point, E), a.setPoints([P, l]), d.setPoints([l, r.point])));
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
- t.on("select", M), t.on("intersectionUpdate", v), t.on("disable", () => {
93
- if (t.off("select", M), t.off("intersectionUpdate", v), t.plane = null, i.remove(a), i.remove(d), o.length < 2)
94
- return i.remove(n), m(new Error("Cancelled"));
95
- h();
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
- G as Polyline
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, C = Object.prototype.propertyIsEnumerable;
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
- C.call(e, t) && p(i, t, e[t]);
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 g = (i, e, t) => new Promise((o, n) => {
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 W } from "../Base/index.js";
31
- import * as j from "three";
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 k } from "./Editor.js";
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 X extends W {
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 k(this), t && (this.prismMesh = new x(c(c({}, t.style), t)), this.add(this.prismMesh)), z("esc", () => {
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 g(this, null, function* () {
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 g(this, null, function* () {
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 f = (a) => {
83
- P(), s();
84
- }, y = (a) => {
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 j.Line3(m, r)
86
+ line: new C.Line3(m, r)
90
87
  });
91
88
  M && i.setPoints({ heightPoint: M });
92
- }, P = () => {
93
- e.off("select", f), e.off("intersectionUpdate", y), e.off("disable", b), t.remove(o), e.disable();
89
+ }, y = () => {
90
+ e.off("select", g), e.off("intersectionUpdate", P), e.off("disable", b), t.remove(o), e.disable();
94
91
  }, b = () => {
95
- P(), t.remove(i), h(new Error("Cancelled"));
92
+ y(), t.remove(i), h(new Error("Cancelled"));
96
93
  };
97
- e.on("select", f), e.on("intersectionUpdate", y), e.on("disable", b);
94
+ e.on("select", g), e.on("intersectionUpdate", P), e.on("disable", b);
98
95
  });
99
96
  });
100
97
  }
101
98
  export {
102
- X as Prism
99
+ Q as Prism
103
100
  };
@@ -1,47 +1,44 @@
1
- var U = Object.defineProperty, k = Object.defineProperties;
2
- var B = Object.getOwnPropertyDescriptors;
1
+ var U = Object.defineProperty, B = Object.defineProperties;
2
+ var I = Object.getOwnPropertyDescriptors;
3
3
  var A = Object.getOwnPropertySymbols;
4
- var I = Object.prototype.hasOwnProperty, _ = Object.prototype.propertyIsEnumerable;
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
- I.call(t, e) && E(s, e, t[e]);
7
+ _.call(t, e) && E(s, e, t[e]);
8
8
  if (A)
9
9
  for (var e of A(t))
10
- _.call(t, e) && E(s, e, t[e]);
10
+ j.call(t, e) && E(s, e, t[e]);
11
11
  return s;
12
- }, u = (s, t) => k(s, B(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
- g(e.next(l));
17
+ m(e.next(l));
18
18
  } catch (h) {
19
19
  p(h);
20
20
  }
21
- }, m = (l) => {
21
+ }, g = (l) => {
22
22
  try {
23
- g(e.throw(l));
23
+ m(e.throw(l));
24
24
  } catch (h) {
25
25
  p(h);
26
26
  }
27
- }, g = (l) => l.done ? c(l.value) : Promise.resolve(l.value).then(a, m);
28
- g((e = e.apply(s, t)).next());
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 { hotkeys as j } from "../../../vendor/hotkeys-js/dist/hotkeys.esm.js";
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 G } from "./Editor.js";
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 S extends q {
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 G(this)), e && (this.rectangleMesh = new H(d(d({}, e.style), e)), this.add(this.rectangleMesh)), j("esc", () => {
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 J(this.rectangleMesh, this.pointSelector, e);
65
+ this.rectangleMesh = c, this.add(this.rectangleMesh), yield G(this.rectangleMesh, this.pointSelector, e);
69
66
  });
70
67
  }
71
68
  }
72
- function J(s, t, e) {
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 m = (N = e == null ? void 0 : e.limit) != null ? N : "none", g = (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 }));
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 f = new o.Plane(), C = () => {
83
- n.push(i.clone()), n.length === 1 ? (m === "xoz" && f.setFromNormalAndCoplanarPoint(new o.Vector3(0, 1, 0), n[0]), m === "none" && f.setFromNormalAndCoplanarPoint(v, n[0])) : n.length === 2 ? m === "y" ? (V(), c()) : y.setPoints([n[0], n[1]]) : n.length === 3 && (V(), c());
84
- }, x = (r) => {
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 && m === "y") {
94
- const w = 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());
95
- s.setPoints([n[0], w, r.point]);
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
- f ? (i = r.raycaster.ray.intersectPlane(f, P), h.setPoints([i, r.point])) : i = r.point.clone(), l.setPoints([O, i]);
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(f, P);
105
- if (g === "diagonal") {
106
- const w = 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();
107
- i = new o.Vector3().addVectors(b, F.multiplyScalar(w)), s.setPoints([n[0], i, n[1]]);
108
- } else if (g === "vertex") {
109
- const w = P.crossVectors(n[0].clone().sub(n[1]), f.normal).normalize();
110
- i = new o.Line3(n[1].clone().add(w), n[1].clone().sub(w)).closestPointToPoint(r.point, !1, P), s.setPoints([n[0], n[1], i]);
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", C), t.off("intersectionUpdate", x), t.off("disable", R), t.disable(), a == null || a.remove(l, y, h);
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", C), t.on("intersectionUpdate", x), t.on("disable", R);
116
+ t.on("select", x), t.on("intersectionUpdate", C), t.on("disable", R);
120
117
  });
121
118
  }
122
119
  export {
123
- S as Rectangle,
124
- J as createRectangle
120
+ Z as Rectangle,
121
+ G as createRectangle
125
122
  };
@@ -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(): void;
171
+ undo: () => void;
165
172
  /**
166
173
  * @description: 重做
167
174
  */
168
- redo(): void;
175
+ redo: () => void;
169
176
  /**
170
177
  * @description: 清空数据
171
178
  */