@realsee/dnalogel 3.48.0 → 3.48.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.
Files changed (35) hide show
  1. package/CHANGELOG.md +3 -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/index.d.ts +5 -2
  5. package/dist/index.cjs.js +32 -32
  6. package/dist/index.js +2038 -1973
  7. package/dist/index.umd.js +31 -31
  8. package/dist/shared-utils/promise/withResolvers.d.ts +10 -0
  9. package/dist/shared-utils/three/Magnifier.d.ts +1 -1
  10. package/dist/shared-utils/three/PointSelector/utils/PointSelectorHelper.d.ts +4 -1
  11. package/libs/Sculpt/Meshes/Line.js +15 -15
  12. package/libs/Sculpt/Objects/Base/index.d.ts +16 -0
  13. package/libs/Sculpt/Objects/Base/index.js +58 -32
  14. package/libs/Sculpt/Objects/Box/index.js +31 -34
  15. package/libs/Sculpt/Objects/Circle/index.js +36 -39
  16. package/libs/Sculpt/Objects/Line/index.d.ts +12 -1
  17. package/libs/Sculpt/Objects/Line/index.js +104 -75
  18. package/libs/Sculpt/Objects/Point/index.js +13 -16
  19. package/libs/Sculpt/Objects/Polygon/index.js +18 -21
  20. package/libs/Sculpt/Objects/Polyline/index.js +27 -30
  21. package/libs/Sculpt/Objects/Prism/index.js +16 -19
  22. package/libs/Sculpt/Objects/Rectangle/index.js +36 -39
  23. package/libs/Sculpt/index.d.ts +5 -2
  24. package/libs/Sculpt/index.js +80 -65
  25. package/libs/base/BasePlugin.js +1 -1
  26. package/libs/index.js +127 -126
  27. package/libs/shared-utils/logger.js +1 -1
  28. package/libs/shared-utils/promise/withResolvers.d.ts +10 -0
  29. package/libs/shared-utils/promise/withResolvers.js +13 -0
  30. package/libs/shared-utils/tag.js +9 -9
  31. package/libs/shared-utils/three/Magnifier.d.ts +1 -1
  32. package/libs/shared-utils/three/Magnifier.js +12 -12
  33. package/libs/shared-utils/three/PointSelector/utils/PointSelectorHelper.d.ts +4 -1
  34. package/libs/shared-utils/three/PointSelector/utils/PointSelectorHelper.js +9 -9
  35. package/package.json +1 -1
@@ -0,0 +1,10 @@
1
+ interface PromiseWithResolvers<T> {
2
+ promise: Promise<T>;
3
+ resolve: (value: T | PromiseLike<T>) => void;
4
+ reject: (reason?: any) => void;
5
+ }
6
+ /**
7
+ * @description Promise.withResolvers polyfill
8
+ */
9
+ export declare function withResolvers<T>(): PromiseWithResolvers<T>;
10
+ export {};
@@ -57,13 +57,13 @@ export declare class Magnifier {
57
57
  y: number;
58
58
  }): void;
59
59
  resetOffset(): void;
60
+ render(): void;
60
61
  protected getRenderCenter(): THREE.Vector3 | {
61
62
  x: number;
62
63
  y: number;
63
64
  };
64
65
  private _appendTo;
65
66
  private autoFixPCPosition;
66
- private render;
67
67
  private initStyle;
68
68
  private getPanOffset;
69
69
  private onPanstart;
@@ -27,7 +27,10 @@ export declare class PointSelectorHelper {
27
27
  position: PointIntersection | undefined;
28
28
  magnifier: Magnifier | null;
29
29
  pointHelper: PointHelperAbstract | null;
30
- private state;
30
+ state: {
31
+ enabled: boolean;
32
+ visible: boolean;
33
+ };
31
34
  private group;
32
35
  constructor(five: Five, options?: PointSelectorHelperConfig);
33
36
  show: () => void;
@@ -1,17 +1,17 @@
1
1
  var _ = Object.defineProperty;
2
- var b = Object.getOwnPropertySymbols;
3
- var k = Object.prototype.hasOwnProperty, S = Object.prototype.propertyIsEnumerable;
2
+ var m = Object.getOwnPropertySymbols;
3
+ var k = Object.prototype.hasOwnProperty, p = Object.prototype.propertyIsEnumerable;
4
4
  var f = (o, s, e) => s in o ? _(o, s, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[s] = e, y = (o, s) => {
5
5
  for (var e in s || (s = {}))
6
6
  k.call(s, e) && f(o, e, s[e]);
7
- if (b)
8
- for (var e of b(s))
9
- S.call(s, e) && f(o, e, s[e]);
7
+ if (m)
8
+ for (var e of m(s))
9
+ p.call(s, e) && f(o, e, s[e]);
10
10
  return o;
11
11
  };
12
12
  var l = (o, s, e) => (f(o, typeof s != "symbol" ? s + "" : s, e), e);
13
13
  import * as u from "three";
14
- import { DEFAULT_LINE_COLOR as D, DEFAULT_LINE_WIDTH as p, DEFAULT_HIGHLIGHT_OPACITY as T } from "../typings/style.js";
14
+ import { DEFAULT_LINE_COLOR as b, DEFAULT_LINE_WIDTH as S, DEFAULT_HIGHLIGHT_OPACITY as D } from "../typings/style.js";
15
15
  import { LineGeometry as L, LineMaterial as w, THREE_Line2 as I } from "../../shared-utils/five/FiveLine.js";
16
16
  import { anyPositionToVector3 as H } from "../../shared-utils/positionToVector3.js";
17
17
  import { IObject3D as R } from "../../shared-utils/three/IObject3D.js";
@@ -21,7 +21,7 @@ import { centerPoint as C } from "../../shared-utils/three/centerPoint.js";
21
21
  import { LightTag as x } from "../../shared-utils/tag.js";
22
22
  import { removeAllTag as v } from "../utils/removeAllTag.js";
23
23
  import { getLengthHTML as W } from "../utils/Meshes/getLengthHTML.js";
24
- import { applyObjectMatrixWorld as m } from "../../shared-utils/three/applyObjectMatrixWorld.js";
24
+ import { applyObjectMatrixWorld as T } from "../../shared-utils/three/applyObjectMatrixWorld.js";
25
25
  import "../../shared-utils/three/THREESphere.js";
26
26
  import "animejs";
27
27
  import { notNil as c } from "../../shared-utils/isNil.js";
@@ -66,14 +66,14 @@ class Q extends R {
66
66
  l(this, "lastRenderLengthItem");
67
67
  this.paramsStyle = e != null ? e : {};
68
68
  const i = new L(), t = new E({
69
- color: new u.Color((h = e == null ? void 0 : e.lineColor) != null ? h : D),
70
- linewidth: (r = e == null ? void 0 : e.lineWidth) != null ? r : p,
69
+ color: new u.Color((h = e == null ? void 0 : e.lineColor) != null ? h : b),
70
+ linewidth: (r = e == null ? void 0 : e.lineWidth) != null ? r : S,
71
71
  dashScale: 40,
72
72
  opacity: (d = e == null ? void 0 : e.opacity) != null ? d : 1,
73
73
  transparent: !0,
74
74
  dashed: (a = e == null ? void 0 : e.dashed) != null ? a : !1
75
75
  }), n = new E({
76
- color: new u.Color((g = e == null ? void 0 : e.lineColor) != null ? g : D),
76
+ color: new u.Color((g = e == null ? void 0 : e.lineColor) != null ? g : b),
77
77
  linewidth: t.linewidth * 0.9,
78
78
  dashScale: t.dashScale,
79
79
  opacity: t.opacity * 0.8,
@@ -118,7 +118,7 @@ class Q extends R {
118
118
  updateMatrixWorld(e) {
119
119
  var i;
120
120
  if (super.updateMatrixWorld(e), this.points) {
121
- const t = (i = m(this, this.points)) == null ? void 0 : i.map((n) => n.toArray().join(",")).join(",");
121
+ const t = (i = T(this, this.points)) == null ? void 0 : i.map((n) => n.toArray().join(",")).join(",");
122
122
  t !== this.lastRenderLengthItem && (this.updateLengthItems(), this.lastRenderLengthItem = t);
123
123
  }
124
124
  }
@@ -145,7 +145,7 @@ class Q extends R {
145
145
  i ? t === "depthTest" ? (this.line.material.depthTest = !1, this.backLine.visible = !1) : t === "translucence" && (this.line.material.depthTest = !0, this.backLine.visible = !0, this.line.material.opacity === 1 ? this.backLine.material.setDashed(!0) : this.backLine.material.setDashed(this.line.material.dashed)) : (this.line.material.depthTest = !0, this.backLine.visible = !1), this.needsRender = !0;
146
146
  }
147
147
  highlight() {
148
- this.highlighted || (this.highlighted = !0, this.opacityBeforeHighlight = this.line.material.opacity, this.line.material.opacity = this.opacityBeforeHighlight * T, this.backLine.material.opacity = this.backLine.material.opacity * T, this.needsRender = !0);
148
+ this.highlighted || (this.highlighted = !0, this.opacityBeforeHighlight = this.line.material.opacity, this.line.material.opacity = this.opacityBeforeHighlight * D, this.backLine.material.opacity = this.backLine.material.opacity * D, this.needsRender = !0);
149
149
  }
150
150
  unhighlight() {
151
151
  this.highlighted && (this.highlighted = !1, this.line.material.opacity = this.opacityBeforeHighlight, this.backLine.material.opacity = 0.2, this.needsRender = !0);
@@ -158,10 +158,10 @@ class Q extends R {
158
158
  return e();
159
159
  if (!this.five)
160
160
  return console.error("Five not found");
161
- const i = m(this, this.points).map((t, n) => {
161
+ const i = this.points.map((t, n) => {
162
162
  if (n !== 0)
163
- return [m(this, this.points[n - 1]), t];
164
- }).filter(c);
163
+ return [this.points[n - 1], t];
164
+ }).filter(c).map((t) => T(this, t));
165
165
  i.forEach(([t, n], h) => {
166
166
  var a;
167
167
  const r = C(t, n);
@@ -64,6 +64,22 @@ Config extends BaseObjectConfig = BaseObjectConfig> extends IObject3D {
64
64
  constructor(data?: Partial<ImportData>, config?: Partial<Config>);
65
65
  on: <T extends keyof FiveDomEventMap>(event: T, callback: FiveDomEventMap[T], config?: EventHandlerConfig) => void;
66
66
  off: (event?: keyof FiveDomEventMap, callback?: (e: import("../../../shared-utils/five/FiveDomEvents").FiveDomEvent) => any, ...args: any[]) => void;
67
+ /**
68
+ * @description 撤销
69
+ */
70
+ undo(): void;
71
+ /**
72
+ * @description 重做
73
+ */
74
+ redo(): void;
75
+ /**
76
+ * @description 是否可以撤销
77
+ */
78
+ canUndo(): void;
79
+ /**
80
+ * @description 是否可以重做
81
+ */
82
+ canRedo(): void;
67
83
  /**
68
84
  * @description 停止创建当前物体,等同于`esc`
69
85
  */
@@ -1,49 +1,51 @@
1
1
  var a = Object.defineProperty;
2
2
  var u = Object.getOwnPropertySymbols;
3
- var m = Object.prototype.hasOwnProperty, g = Object.prototype.propertyIsEnumerable;
4
- var n = (s, t, e) => t in s ? a(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e, d = (s, t) => {
3
+ var f = Object.prototype.hasOwnProperty, g = Object.prototype.propertyIsEnumerable;
4
+ var l = (o, t, e) => t in o ? a(o, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[t] = e, p = (o, t) => {
5
5
  for (var e in t || (t = {}))
6
- m.call(t, e) && n(s, e, t[e]);
6
+ f.call(t, e) && l(o, e, t[e]);
7
7
  if (u)
8
8
  for (var e of u(t))
9
- g.call(t, e) && n(s, e, t[e]);
10
- return s;
9
+ g.call(t, e) && l(o, e, t[e]);
10
+ return o;
11
11
  };
12
- var o = (s, t, e) => (n(s, typeof t != "symbol" ? t + "" : t, e), e);
13
- import { hotkeys as p } from "../../../vendor/hotkeys-js/dist/hotkeys.esm.js";
14
- import { Sculpt as l } from "../../index.js";
12
+ var r = (o, t, e) => (l(o, typeof t != "symbol" ? t + "" : t, e), e);
13
+ import { hotkeys as c } from "../../../vendor/hotkeys-js/dist/hotkeys.esm.js";
14
+ import { Sculpt as n } from "../../index.js";
15
15
  import { IObject3D as b } from "../../../shared-utils/three/IObject3D.js";
16
16
  import { applyObjectMatrixWorld as y } from "../../../shared-utils/three/applyObjectMatrixWorld.js";
17
- import { removeAllTag as v } from "../../utils/removeAllTag.js";
18
- const f = /* @__PURE__ */ new Map();
19
- class D extends b {
20
- constructor(e, r) {
17
+ import { removeAllTag as M } from "../../utils/removeAllTag.js";
18
+ const m = /* @__PURE__ */ new Map();
19
+ class x extends b {
20
+ constructor(e, s) {
21
21
  super();
22
- o(this, "name", "Sculpt");
23
- o(this, "isSculptObject", !0);
24
- o(this, "draggable");
22
+ r(this, "name", "Sculpt");
23
+ r(this, "isSculptObject", !0);
24
+ r(this, "draggable");
25
25
  /**
26
26
  * @description 是否被选中
27
27
  */
28
- o(this, "selected");
28
+ r(this, "selected");
29
29
  /**
30
30
  * @description 配置
31
31
  */
32
- o(this, "config");
33
- o(this, "editor");
34
- o(this, "on", (e, r, i) => l.modules.fiveDomEvents.addEventListener(this, e, r, i));
35
- o(this, "off", (...e) => l.modules.fiveDomEvents.removeEventListener(this, ...e));
36
- e != null && e.id && (this.uuid = e.id), this.config = d({ canEdit: !0, occlusionVisibility: !0, occlusionMode: "translucence" }, r), e != null && e.style && (e.style.occlusionVisibility = this.config.occlusionVisibility, e.style.occlusionMode = this.config.occlusionMode), this.addEventListener("removed", () => {
37
- v(this);
38
- }), this.config.canEdit && (p("backspace, delete", () => {
32
+ r(this, "config");
33
+ r(this, "editor");
34
+ r(this, "on", (e, s, i) => n.modules.fiveDomEvents.addEventListener(this, e, s, i));
35
+ r(this, "off", (...e) => n.modules.fiveDomEvents.removeEventListener(this, ...e));
36
+ e != null && e.id && (this.uuid = e.id), this.config = p({ canEdit: !0, occlusionVisibility: !0, occlusionMode: "translucence" }, s), e != null && e.style && (e.style.occlusionVisibility = this.config.occlusionVisibility, e.style.occlusionMode = this.config.occlusionMode), this.addEventListener("removed", () => {
37
+ M(this);
38
+ }), c("esc", () => {
39
+ this.stopCreating();
40
+ }), this.config.canEdit && (c("backspace, delete", () => {
39
41
  this.selected && this.delete();
40
42
  }), this.on("click", () => {
41
- var c, h;
43
+ var h, d;
42
44
  if (this.pointSelector.enabled)
43
45
  return;
44
- let i = f.get(this.parent.uuid);
45
- i && (i.selected = !1, i.unhighlight(), (c = i.editor) == null || c.disable()), f.set(this.parent.uuid, this), this.selected = !0, this.highlight(), (h = this.editor) == null || h.enable();
46
- }), p("esc", () => {
46
+ let i = m.get(this.parent.uuid);
47
+ i && (i.selected = !1, i.unhighlight(), (h = i.editor) == null || h.disable()), m.set(this.parent.uuid, this), this.selected = !0, this.highlight(), (d = this.editor) == null || d.enable();
48
+ }), c("esc", () => {
47
49
  var i;
48
50
  this.selected = !1, this.unhighlight(), !this.pointSelector.enabled && ((i = this.editor) == null || i.disable());
49
51
  }));
@@ -55,13 +57,37 @@ class D extends b {
55
57
  };
56
58
  }
57
59
  get pointSelector() {
58
- return l.modules.pointSelector;
60
+ return n.modules.pointSelector;
61
+ }
62
+ /**
63
+ * @description 撤销
64
+ */
65
+ undo() {
66
+ throw new Error("Method not implemented.");
67
+ }
68
+ /**
69
+ * @description 重做
70
+ */
71
+ redo() {
72
+ throw new Error("Method not implemented.");
73
+ }
74
+ /**
75
+ * @description 是否可以撤销
76
+ */
77
+ canUndo() {
78
+ throw new Error("Method not implemented.");
79
+ }
80
+ /**
81
+ * @description 是否可以重做
82
+ */
83
+ canRedo() {
84
+ throw new Error("Method not implemented.");
59
85
  }
60
86
  /**
61
87
  * @description 停止创建当前物体,等同于`esc`
62
88
  */
63
89
  stopCreating() {
64
- l.modules.pointSelector.disable();
90
+ n.modules.pointSelector.disable();
65
91
  }
66
92
  /**
67
93
  * @description 从场景中删除当前物体,并且移除事件监听
@@ -84,10 +110,10 @@ class D extends b {
84
110
  return this.updateMatrixWorld(), y(this, e);
85
111
  }
86
112
  applyObjectQuaternion(e) {
87
- const r = this.quaternion.clone();
88
- return Array.isArray(e) ? e.map((i) => i.clone().applyQuaternion(r)) : e.clone().applyQuaternion(r);
113
+ const s = this.quaternion.clone();
114
+ return Array.isArray(e) ? e.map((i) => i.clone().applyQuaternion(s)) : e.clone().applyQuaternion(s);
89
115
  }
90
116
  }
91
117
  export {
92
- D as BaseObject
118
+ x as BaseObject
93
119
  };
@@ -1,53 +1,50 @@
1
1
  var E = Object.defineProperty, v = Object.defineProperties;
2
- var C = Object.getOwnPropertyDescriptors;
2
+ var H = Object.getOwnPropertyDescriptors;
3
3
  var u = Object.getOwnPropertySymbols;
4
- var H = Object.prototype.hasOwnProperty, O = Object.prototype.propertyIsEnumerable;
5
- var b = (o, e, t) => e in o ? E(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t, c = (o, e) => {
4
+ var O = Object.prototype.hasOwnProperty, C = Object.prototype.propertyIsEnumerable;
5
+ var b = (o, e, t) => e in o ? E(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t, m = (o, e) => {
6
6
  for (var t in e || (e = {}))
7
- H.call(e, t) && b(o, t, e[t]);
7
+ O.call(e, t) && b(o, t, e[t]);
8
8
  if (u)
9
9
  for (var t of u(e))
10
- O.call(e, t) && b(o, t, e[t]);
10
+ C.call(e, t) && b(o, t, e[t]);
11
11
  return o;
12
- }, M = (o, e) => v(o, C(e));
12
+ }, M = (o, e) => v(o, H(e));
13
13
  var d = (o, e, t) => (b(o, typeof e != "symbol" ? e + "" : e, t), t);
14
- var p = (o, e, t) => new Promise((n, i) => {
14
+ var f = (o, e, t) => new Promise((n, i) => {
15
15
  var a = (s) => {
16
16
  try {
17
17
  r(t.next(s));
18
18
  } catch (h) {
19
19
  i(h);
20
20
  }
21
- }, m = (s) => {
21
+ }, c = (s) => {
22
22
  try {
23
23
  r(t.throw(s));
24
24
  } catch (h) {
25
25
  i(h);
26
26
  }
27
- }, r = (s) => s.done ? n(s.value) : Promise.resolve(s.value).then(a, m);
27
+ }, r = (s) => s.done ? n(s.value) : Promise.resolve(s.value).then(a, c);
28
28
  r((t = t.apply(o, e)).next());
29
29
  });
30
- import { hotkeys as L } from "../../../vendor/hotkeys-js/dist/hotkeys.esm.js";
31
- import { BaseObject as W } from "../Base/index.js";
32
- import * as j from "three";
33
- import { BoxEditor as N } from "./Editor.js";
30
+ import { BaseObject as L } from "../Base/index.js";
31
+ import * as W from "three";
32
+ import { BoxEditor as j } from "./Editor.js";
34
33
  import { BoxMesh as w } from "../../Meshes/Box.js";
35
- import { createRectangle as R } from "../Rectangle/index.js";
36
- import { LineMesh as T } from "../../Meshes/Line.js";
37
- import { getNormal as U } from "../../../shared-utils/three/getNormal.js";
38
- import { rayOnLine as k } from "../../utils/three/rayOnLine.js";
34
+ import { createRectangle as N } from "../Rectangle/index.js";
35
+ import { LineMesh as R } from "../../Meshes/Line.js";
36
+ import { getNormal as T } from "../../../shared-utils/three/getNormal.js";
37
+ import { rayOnLine as U } from "../../utils/three/rayOnLine.js";
39
38
  import { vector3ToArray as B } from "../../../shared-utils/three/vector3ToArray.js";
40
- class X extends W {
39
+ class Q extends L {
41
40
  constructor(t, n) {
42
41
  super(t, n);
43
42
  d(this, "type", "Box");
44
43
  d(this, "boxMesh");
45
- this.editor = new N(this), t && (this.boxMesh = new w(c(c({}, t.style), t)), this.add(this.boxMesh)), L("esc", () => {
46
- this.stopCreating();
47
- });
44
+ this.editor = new j(this), t && (this.boxMesh = new w(m(m({}, t.style), t)), this.add(this.boxMesh));
48
45
  }
49
46
  get data() {
50
- return M(c({}, this.baseData), {
47
+ return M(m({}, this.baseData), {
51
48
  points: B(this.applyObjectMatrixWorld(this.boxMesh.bottomPlane.points)),
52
49
  heightPoint: B(this.applyObjectMatrixWorld(this.boxMesh.heightPoint)),
53
50
  style: {
@@ -66,40 +63,40 @@ class X extends W {
66
63
  (t = this.boxMesh) == null || t.unhighlight();
67
64
  }
68
65
  create(t) {
69
- return p(this, null, function* () {
66
+ return f(this, null, function* () {
70
67
  this.removeChildren(), this.boxMesh = new w(t), this.add(this.boxMesh), yield z(this.boxMesh, this.pointSelector), this.editor.enable();
71
68
  });
72
69
  }
73
70
  }
74
71
  function z(o, e) {
75
- return p(this, null, function* () {
76
- return yield R(o.bottomPlane, e), new Promise((t, n) => {
72
+ return f(this, null, function* () {
73
+ return yield N(o.bottomPlane, e), new Promise((t, n) => {
77
74
  const i = o.parent;
78
75
  if (!i) {
79
76
  n(new Error("No container"));
80
77
  return;
81
78
  }
82
- const a = new T(), m = U(o.bottomPlane.points).normalize(), r = o.bottomPlane.builtPoints.at(-1), s = r.clone().add(m.clone().multiplyScalar(10)), h = r.clone().sub(m.clone().multiplyScalar(10));
79
+ const a = new R(), c = T(o.bottomPlane.points).normalize(), r = o.bottomPlane.builtPoints.at(-1), s = r.clone().add(c.clone().multiplyScalar(10)), h = r.clone().sub(c.clone().multiplyScalar(10));
83
80
  a.setPoints([s, h]), i.add(a), e.enable();
84
- const f = (l) => {
81
+ const p = (l) => {
85
82
  g(), t();
86
83
  }, x = (l) => {
87
84
  if (!(l != null && l.raycaster))
88
85
  return;
89
- const P = k({
86
+ const y = U({
90
87
  raycaster: l.raycaster,
91
- line: new j.Line3(s, h)
88
+ line: new W.Line3(s, h)
92
89
  });
93
- P && o.setPoints({ heightPoint: P });
90
+ y && o.setPoints({ heightPoint: y });
94
91
  }, g = () => {
95
- e.off("select", f), e.off("intersectionUpdate", x), e.off("disable", y), e.disable(), i == null || i.remove(a);
96
- }, y = () => {
92
+ e.off("select", p), e.off("intersectionUpdate", x), e.off("disable", P), e.disable(), i == null || i.remove(a);
93
+ }, P = () => {
97
94
  g(), i == null || i.remove(o), n(new Error("Cancelled"));
98
95
  };
99
- e.on("select", f), e.on("intersectionUpdate", x), e.on("disable", y);
96
+ e.on("select", p), e.on("intersectionUpdate", x), e.on("disable", P);
100
97
  });
101
98
  });
102
99
  }
103
100
  export {
104
- X as Box
101
+ Q as Box
105
102
  };
@@ -1,52 +1,49 @@
1
- var v = Object.defineProperty, x = Object.defineProperties;
1
+ var C = Object.defineProperty, x = Object.defineProperties;
2
2
  var O = Object.getOwnPropertyDescriptors;
3
3
  var M = Object.getOwnPropertySymbols;
4
4
  var T = Object.prototype.hasOwnProperty, j = Object.prototype.propertyIsEnumerable;
5
- var d = (t, r, e) => r in t ? v(t, r, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[r] = e, m = (t, r) => {
5
+ var m = (t, r, e) => r in t ? C(t, r, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[r] = e, d = (t, r) => {
6
6
  for (var e in r || (r = {}))
7
- T.call(r, e) && d(t, e, r[e]);
7
+ T.call(r, e) && m(t, e, r[e]);
8
8
  if (M)
9
9
  for (var e of M(r))
10
- j.call(r, e) && d(t, e, r[e]);
10
+ j.call(r, e) && m(t, e, r[e]);
11
11
  return t;
12
12
  }, g = (t, r) => x(t, O(r));
13
- var f = (t, r, e) => (d(t, typeof r != "symbol" ? r + "" : r, e), e);
14
- var w = (t, r, e) => new Promise((o, i) => {
13
+ var f = (t, r, e) => (m(t, typeof r != "symbol" ? r + "" : r, e), e);
14
+ var w = (t, r, e) => new Promise((c, i) => {
15
15
  var a = (n) => {
16
16
  try {
17
- c(e.next(n));
17
+ o(e.next(n));
18
18
  } catch (h) {
19
19
  i(h);
20
20
  }
21
21
  }, s = (n) => {
22
22
  try {
23
- c(e.throw(n));
23
+ o(e.throw(n));
24
24
  } catch (h) {
25
25
  i(h);
26
26
  }
27
- }, c = (n) => n.done ? o(n.value) : Promise.resolve(n.value).then(a, s);
28
- c((e = e.apply(t, r)).next());
27
+ }, o = (n) => n.done ? c(n.value) : Promise.resolve(n.value).then(a, s);
28
+ o((e = e.apply(t, r)).next());
29
29
  });
30
- import { hotkeys as A } from "../../../vendor/hotkeys-js/dist/hotkeys.esm.js";
31
- import { BaseObject as H } from "../Base/index.js";
30
+ import { BaseObject as A } from "../Base/index.js";
32
31
  import * as y from "three";
33
- import { PolylineMesh as N } from "../../Meshes/Polyline.js";
34
- import { CircleEditor as U } from "./Editor.js";
32
+ import { PolylineMesh as H } from "../../Meshes/Polyline.js";
33
+ import { CircleEditor as N } from "./Editor.js";
35
34
  import { CircleWithEdgeMesh as b } from "../../Meshes/CircleWithEdge.js";
36
- import { vector3ToArray as C } from "../../../shared-utils/three/vector3ToArray.js";
37
- class V extends H {
38
- constructor(e, o) {
39
- super(e, o);
35
+ import { vector3ToArray as E } from "../../../shared-utils/three/vector3ToArray.js";
36
+ class R extends A {
37
+ constructor(e, c) {
38
+ super(e, c);
40
39
  f(this, "type", "Circle");
41
40
  f(this, "circleMesh");
42
- this.editor = new U(this), e && (this.circleMesh = new b(m(m({}, e.style), e)), this.add(this.circleMesh)), A("esc", () => {
43
- this.stopCreating();
44
- });
41
+ this.editor = new N(this), e && (this.circleMesh = new b(d(d({}, e.style), e)), this.add(this.circleMesh));
45
42
  }
46
43
  get data() {
47
- return g(m({}, this.baseData), {
48
- center: C(this.applyObjectMatrixWorld(this.circleMesh.center)),
49
- normal: C(this.applyObjectQuaternion(this.circleMesh.normal)),
44
+ return g(d({}, this.baseData), {
45
+ center: E(this.applyObjectMatrixWorld(this.circleMesh.center)),
46
+ normal: E(this.applyObjectQuaternion(this.circleMesh.normal)),
50
47
  radius: this.circleMesh.radius,
51
48
  style: {
52
49
  color: this.circleMesh.color.getHex()
@@ -66,21 +63,21 @@ class V extends H {
66
63
  this.children.forEach((i) => {
67
64
  i.parent === this && this.remove(i);
68
65
  }), this.children.length = 0;
69
- const o = new b(e);
70
- this.circleMesh = o, this.add(this.circleMesh), yield W(this.circleMesh, this.pointSelector), this.editor.enable();
66
+ const c = new b(e);
67
+ this.circleMesh = c, this.add(this.circleMesh), yield U(this.circleMesh, this.pointSelector), this.editor.enable();
71
68
  });
72
69
  }
73
70
  }
74
- function W(t, r) {
75
- return new Promise((e, o) => {
71
+ function U(t, r) {
72
+ return new Promise((e, c) => {
76
73
  const i = t.parent;
77
74
  if (!i) {
78
- o(new Error("No container"));
75
+ c(new Error("No container"));
79
76
  return;
80
77
  }
81
- const a = new N({ dashed: !0 });
78
+ const a = new H({ dashed: !0 });
82
79
  i.add(a), r.enable();
83
- let s, c;
80
+ let s, o;
84
81
  const n = (l) => {
85
82
  if (l) {
86
83
  if (!s) {
@@ -90,25 +87,25 @@ function W(t, r) {
90
87
  };
91
88
  return;
92
89
  }
93
- s && c && (p(), e());
90
+ s && o && (p(), e());
94
91
  }
95
92
  }, h = (l) => {
96
93
  if (!l || !s)
97
94
  return;
98
- const E = new y.Plane().setFromNormalAndCoplanarPoint(s.normal, s.point);
99
- if (c = l.raycaster.ray.intersectPlane(E, new y.Vector3()), c) {
100
- const P = s.point.distanceTo(c);
101
- t.setPoints({ center: s.point, normal: s.normal, radius: P });
95
+ const P = new y.Plane().setFromNormalAndCoplanarPoint(s.normal, s.point);
96
+ if (o = l.raycaster.ray.intersectPlane(P, new y.Vector3()), o) {
97
+ const v = s.point.distanceTo(o);
98
+ t.setPoints({ center: s.point, normal: s.normal, radius: v });
102
99
  }
103
100
  }, p = () => {
104
101
  r.off("select", n), r.off("intersectionUpdate", h), r.off("disable", u), r.disable(), i == null || i.remove(a);
105
102
  }, u = () => {
106
- p(), i == null || i.remove(t, a), o(new Error("Cancelled"));
103
+ p(), i == null || i.remove(t, a), c(new Error("Cancelled"));
107
104
  };
108
105
  r.on("select", n), r.on("intersectionUpdate", h), r.on("disable", u);
109
106
  });
110
107
  }
111
108
  export {
112
- V as Circle,
113
- W as createCircle
109
+ R as Circle,
110
+ U as createCircle
114
111
  };
@@ -11,6 +11,7 @@ export interface LineImportData extends BaseImportData, LineData {
11
11
  export declare class Line extends BaseObject<LineImportData> {
12
12
  readonly type = "Line";
13
13
  lineMesh: LineWithDotsMesh;
14
+ private creatingLine?;
14
15
  get data(): {
15
16
  points: [number, number, number][];
16
17
  style: {
@@ -24,10 +25,20 @@ export declare class Line extends BaseObject<LineImportData> {
24
25
  constructor(data?: LineImportData, config?: Partial<BaseObjectConfig>);
25
26
  highlight(): void;
26
27
  unhighlight(): void;
28
+ canUndo(): void;
29
+ canRedo(): void;
30
+ undo(): void;
31
+ redo(): void;
27
32
  create(params?: Partial<LineMeshStyle & CreateLimitConfig>): Promise<void>;
28
33
  }
29
34
  /**
30
35
  * @description 绘制线段
31
36
  * @param config.limit 限制折线绘制的平面; `xoz` 限制在水平面; `y` 限制垂直面; `none` 不限制;默认 `none`
32
37
  */
33
- export declare function createLine(lineMesh: LineMesh, pointSelector: PointSelector, config?: Partial<CreateLimitConfig>): Promise<void>;
38
+ export declare function createLine(lineMesh: LineMesh, pointSelector: PointSelector, config?: Partial<CreateLimitConfig>): {
39
+ finished: Promise<void>;
40
+ canUndo: () => boolean;
41
+ canRedo: () => boolean;
42
+ undo: () => void;
43
+ redo: () => void;
44
+ };