@realsee/dnalogel 3.76.0-alpha.1 → 3.77.0-alpha.0

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,4 +1,5 @@
1
1
  import type * as THREE from 'three';
2
+ import type { Direction, Direction4 } from './Direction';
2
3
  export type HelperEventMap = {
3
4
  wantToMove: (position: THREE.Vector3) => void;
4
5
  moveBefore: (position: THREE.Vector3) => THREE.Vector3 | null | undefined;
@@ -7,9 +8,9 @@ export type HelperEventMap = {
7
8
  move: (position: THREE.Vector3) => void;
8
9
  rotate: (quaternion: THREE.Quaternion) => void;
9
10
  scale: (scale: THREE.Vector3) => void;
10
- moveStart: () => void;
11
- rotateStart: () => void;
12
- scaleStart: () => void;
11
+ moveStart: (direction?: Direction) => void;
12
+ rotateStart: (direction?: Direction) => void;
13
+ scaleStart: (direction?: Direction | Direction4) => void;
13
14
  moveEnd: () => void;
14
15
  rotateEnd: () => void;
15
16
  scaleEnd: () => void;
@@ -1,7 +1,7 @@
1
- var o = Object.defineProperty;
2
- var s = (r, e, t) => e in r ? o(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
- var n = (r, e, t) => (s(r, typeof e != "symbol" ? e + "" : e, t), t);
4
- class l {
1
+ var s = Object.defineProperty;
2
+ var i = (o, e, t) => e in o ? s(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
3
+ var n = (o, e, t) => (i(o, typeof e != "symbol" ? e + "" : e, t), t);
4
+ class u {
5
5
  constructor(e, t) {
6
6
  n(this, "five");
7
7
  n(this, "measureController");
@@ -16,15 +16,18 @@ class l {
16
16
  n(this, "onMouseDown", (e) => {
17
17
  e.button === 2 && (e.preventDefault(), this.measureController.save().changeMode("Watch"));
18
18
  });
19
- this.five = t, this.measureController = e, this.five.getElement() && document.body.addEventListener("keydown", this.onKeyDown);
19
+ this.five = t, this.measureController = e;
20
+ const r = this.five.getElement();
21
+ r && (document.body.addEventListener("keydown", this.onKeyDown), r.addEventListener("mousedown", this.onMouseDown));
20
22
  }
21
23
  dispose() {
22
- this.five.getElement() && document.body.removeEventListener("keydown", this.onKeyDown);
24
+ const e = this.five.getElement();
25
+ e && (document.body.removeEventListener("keydown", this.onKeyDown), e.removeEventListener("mousedown", this.onMouseDown));
23
26
  }
24
27
  escape() {
25
28
  return this.measureController.getCurrentMode() === "Watch" ? this.measureController.disable() : this.measureController.save().changeMode("Watch");
26
29
  }
27
30
  }
28
31
  export {
29
- l as ShortcutKeyController
32
+ u as ShortcutKeyController
30
33
  };
@@ -2,9 +2,21 @@ import type * as THREE from 'three';
2
2
  import { IObject3D } from '../../../shared-utils/three/IObject3D';
3
3
  import type { AddObject3DHelperConfig } from '../../../Object3DHelperPlugin';
4
4
  import { Subscribe } from '../../../shared-utils/Subscribe';
5
+ import type { Direction, Direction4 } from '../../../shared-utils/Object3DHelper/typings/Direction';
6
+ export type ObjectUpdateType = 'move' | 'rotate' | 'scale';
7
+ export interface ObjectUpdateParams {
8
+ /** 操作类型:移动、旋转、缩放 */
9
+ type: ObjectUpdateType;
10
+ /** 开始时间戳 */
11
+ start_timestamp: number;
12
+ /** 结束时间戳 */
13
+ end_timestamp?: number;
14
+ /** 轴向 */
15
+ axis?: Direction | Direction4;
16
+ }
5
17
  export declare class BaseEditor<OriginObject extends THREE.Object3D = THREE.Object3D> extends IObject3D {
6
18
  hooks: Subscribe<{
7
- objectUpdate: () => void;
19
+ objectUpdate: (params?: ObjectUpdateParams) => void;
8
20
  }>;
9
21
  protected originObject: OriginObject;
10
22
  constructor(originObject: OriginObject);
@@ -20,9 +32,16 @@ export declare class BaseEditor<OriginObject extends THREE.Object3D = THREE.Obje
20
32
  export declare class BaseEditorWithObjectHelper<OriginObject extends THREE.Object3D = THREE.Object3D> extends BaseEditor<OriginObject> {
21
33
  private get helper();
22
34
  private objectHelperConfig;
35
+ private currentOperation;
23
36
  constructor(originObject: OriginObject, objectHelperConfig?: AddObject3DHelperConfig | (() => AddObject3DHelperConfig));
24
37
  enable(): void;
25
38
  disable(): void;
26
39
  initialHelperMatrix(): void;
40
+ private onMoveStart;
41
+ private onRotateStart;
42
+ private onScaleStart;
43
+ private onMoveEnd;
44
+ private onRotateEnd;
45
+ private onScaleEnd;
27
46
  private onObjectUpdate;
28
47
  }
@@ -1,24 +1,24 @@
1
- var b = Object.defineProperty;
1
+ var d = Object.defineProperty;
2
2
  var l = Object.getOwnPropertySymbols;
3
- var h = Object.prototype.hasOwnProperty, j = Object.prototype.propertyIsEnumerable;
4
- var c = (o, t, e) => t in o ? b(o, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[t] = e, n = (o, t) => {
5
- for (var e in t || (t = {}))
6
- h.call(t, e) && c(o, e, t[e]);
3
+ var j = Object.prototype.hasOwnProperty, m = Object.prototype.propertyIsEnumerable;
4
+ var s = (r, e, t) => e in r ? d(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t, b = (r, e) => {
5
+ for (var t in e || (e = {}))
6
+ j.call(e, t) && s(r, t, e[t]);
7
7
  if (l)
8
- for (var e of l(t))
9
- j.call(t, e) && c(o, e, t[e]);
10
- return o;
8
+ for (var t of l(e))
9
+ m.call(e, t) && s(r, t, e[t]);
10
+ return r;
11
11
  };
12
- var r = (o, t, e) => (c(o, typeof t != "symbol" ? t + "" : t, e), e);
13
- import { Sculpt as s } from "../../index.js";
14
- import { IObject3D as a } from "../../../shared-utils/three/IObject3D.js";
15
- import { Subscribe as d } from "../../../shared-utils/Subscribe.js";
16
- class O extends a {
17
- constructor(e) {
12
+ var o = (r, e, t) => (s(r, typeof e != "symbol" ? e + "" : e, t), t);
13
+ import { Sculpt as n } from "../../index.js";
14
+ import { IObject3D as u } from "../../../shared-utils/three/IObject3D.js";
15
+ import { Subscribe as O } from "../../../shared-utils/Subscribe.js";
16
+ class f extends u {
17
+ constructor(t) {
18
18
  super();
19
- r(this, "hooks", new d());
20
- r(this, "originObject");
21
- this.originObject = e;
19
+ o(this, "hooks", new O());
20
+ o(this, "originObject");
21
+ this.originObject = t;
22
22
  }
23
23
  /**
24
24
  * @description: 开启编辑器
@@ -33,36 +33,92 @@ class O extends a {
33
33
  this.originObject.remove(this);
34
34
  }
35
35
  }
36
- class u extends O {
37
- constructor(e, i) {
38
- super(e);
39
- r(this, "objectHelperConfig");
40
- r(this, "onObjectUpdate", () => {
41
- this.hooks.emit("objectUpdate");
36
+ class k extends f {
37
+ constructor(t, i) {
38
+ super(t);
39
+ o(this, "objectHelperConfig");
40
+ // 记录当前操作的类型、开始时间和轴向
41
+ o(this, "currentOperation", null);
42
+ // 记录移动操作开始
43
+ o(this, "onMoveStart", (t) => {
44
+ this.currentOperation = {
45
+ type: "move",
46
+ startTime: Date.now(),
47
+ axis: t
48
+ };
49
+ });
50
+ // 记录旋转操作开始
51
+ o(this, "onRotateStart", (t) => {
52
+ this.currentOperation = {
53
+ type: "rotate",
54
+ startTime: Date.now(),
55
+ axis: t
56
+ };
57
+ });
58
+ // 记录缩放操作开始
59
+ o(this, "onScaleStart", (t) => {
60
+ this.currentOperation = {
61
+ type: "scale",
62
+ startTime: Date.now(),
63
+ axis: t
64
+ };
65
+ });
66
+ // 移动中的处理(可选),可以在这里做一些实时处理,暂时不触发 objectUpdate
67
+ // private onMove = () => {
68
+ // }
69
+ // // 旋转中的处理
70
+ // private onRotate = () => {
71
+ // }
72
+ // // 缩放中的处理
73
+ // private onScale = () => {
74
+ // }
75
+ // 移动结束,触发 objectUpdate
76
+ o(this, "onMoveEnd", () => {
77
+ this.onObjectUpdate();
78
+ });
79
+ // 旋转结束,触发 objectUpdate
80
+ o(this, "onRotateEnd", () => {
81
+ this.onObjectUpdate();
82
+ });
83
+ // 缩放结束,触发 objectUpdate
84
+ o(this, "onScaleEnd", () => {
85
+ this.onObjectUpdate();
86
+ });
87
+ // 统一的触发 objectUpdate 方法
88
+ o(this, "onObjectUpdate", () => {
89
+ if (!this.currentOperation)
90
+ return;
91
+ const t = {
92
+ type: this.currentOperation.type,
93
+ start_timestamp: this.currentOperation.startTime,
94
+ end_timestamp: Date.now(),
95
+ axis: this.currentOperation.axis
96
+ };
97
+ this.hooks.emit("objectUpdate", t), this.currentOperation = null;
42
98
  });
43
99
  this.objectHelperConfig = i;
44
100
  }
45
101
  get helper() {
46
- var e;
47
- return (e = s.modules.object3DHelper.getObject3DHelper(this.originObject)) == null ? void 0 : e.helper;
102
+ var t;
103
+ return (t = n.modules.object3DHelper.getObject3DHelper(this.originObject)) == null ? void 0 : t.helper;
48
104
  }
49
105
  enable() {
50
106
  super.enable();
51
- const e = typeof this.objectHelperConfig == "function" ? this.objectHelperConfig() : this.objectHelperConfig;
52
- s.modules.object3DHelper.addObject3DHelper(this.originObject, n({ positionFrom: "boundingBox" }, e));
53
- const i = s.modules.object3DHelper.getObject3DHelper(this.originObject).helper;
54
- i.hooks.on("move", this.onObjectUpdate), i.hooks.on("rotate", this.onObjectUpdate), i.hooks.on("scale", this.onObjectUpdate);
107
+ const t = typeof this.objectHelperConfig == "function" ? this.objectHelperConfig() : this.objectHelperConfig;
108
+ n.modules.object3DHelper.addObject3DHelper(this.originObject, b({ positionFrom: "boundingBox" }, t));
109
+ const i = n.modules.object3DHelper.getObject3DHelper(this.originObject).helper;
110
+ i.hooks.on("moveStart", this.onMoveStart), i.hooks.on("rotateStart", this.onRotateStart), i.hooks.on("scaleStart", this.onScaleStart), i.hooks.on("moveEnd", this.onMoveEnd), i.hooks.on("rotateEnd", this.onRotateEnd), i.hooks.on("scaleEnd", this.onScaleEnd);
55
111
  }
56
112
  disable() {
57
- var e, i, p;
58
- super.disable(), (e = this.helper) == null || e.hooks.off("move", this.onObjectUpdate), (i = this.helper) == null || i.hooks.off("rotate", this.onObjectUpdate), (p = this.helper) == null || p.hooks.off("scale", this.onObjectUpdate), s.modules.object3DHelper.removeObject3DHelper(this.originObject);
113
+ var t, i, a, h, c, p;
114
+ super.disable(), (t = this.helper) == null || t.hooks.off("moveStart", this.onMoveStart), (i = this.helper) == null || i.hooks.off("rotateStart", this.onRotateStart), (a = this.helper) == null || a.hooks.off("scaleStart", this.onScaleStart), (h = this.helper) == null || h.hooks.off("moveEnd", this.onMoveEnd), (c = this.helper) == null || c.hooks.off("rotateEnd", this.onRotateEnd), (p = this.helper) == null || p.hooks.off("scaleEnd", this.onScaleEnd), n.modules.object3DHelper.removeObject3DHelper(this.originObject);
59
115
  }
60
116
  initialHelperMatrix() {
61
- var e;
62
- (e = this.helper) == null || e.initialHelperMatrix();
117
+ var t;
118
+ (t = this.helper) == null || t.initialHelperMatrix();
63
119
  }
64
120
  }
65
121
  export {
66
- O as BaseEditor,
67
- u as BaseEditorWithObjectHelper
122
+ f as BaseEditor,
123
+ k as BaseEditorWithObjectHelper
68
124
  };
@@ -9,6 +9,9 @@ export interface BoxImportData extends BaseImportData, BoxData {
9
9
  type: LiteralString<'Box'>;
10
10
  style?: Partial<BoxStyle>;
11
11
  }
12
+ export type BoxCreateConfig = Partial<BoxStyle & CreateLimitConfig & DrawMethodConfig> & {
13
+ onPointPlaced?: () => void;
14
+ };
12
15
  export declare class Box extends BaseObject<BoxImportData> {
13
16
  readonly type = "Box";
14
17
  boxMesh: BoxMesh;
@@ -30,7 +33,7 @@ export declare class Box extends BaseObject<BoxImportData> {
30
33
  setData(data: Partial<BoxImportData>): void;
31
34
  highlight(): void;
32
35
  unhighlight(): void;
33
- create(params?: Partial<BoxStyle & CreateLimitConfig & DrawMethodConfig>): Promise<void>;
36
+ create(params?: BoxCreateConfig): Promise<void>;
34
37
  /**
35
38
  * 获取盒子在世界坐标中的6个面的几何信息
36
39
  * 返回顺序:bottom、top、side0~side3(自底面第0点起顺时针)
@@ -42,4 +45,4 @@ export declare class Box extends BaseObject<BoxImportData> {
42
45
  normal: THREE.Vector3;
43
46
  }>;
44
47
  }
45
- export declare function createBox(boxMesh: BoxMesh, pointSelector: PointSelector, config?: Partial<CreateLimitConfig & DrawMethodConfig>): Promise<void>;
48
+ export declare function createBox(boxMesh: BoxMesh, pointSelector: PointSelector, config?: BoxCreateConfig): Promise<void>;
@@ -1,34 +1,34 @@
1
1
  var R = Object.defineProperty, _ = Object.defineProperties;
2
2
  var C = Object.getOwnPropertyDescriptors;
3
- var W = Object.getOwnPropertySymbols;
3
+ var O = Object.getOwnPropertySymbols;
4
4
  var L = Object.prototype.hasOwnProperty, T = Object.prototype.propertyIsEnumerable;
5
- var d = (e, o, t) => o in e ? R(e, o, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[o] = t, m = (e, o) => {
5
+ var x = (e, o, t) => o in e ? R(e, o, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[o] = t, d = (e, o) => {
6
6
  for (var t in o || (o = {}))
7
- L.call(o, t) && d(e, t, o[t]);
8
- if (W)
9
- for (var t of W(o))
10
- T.call(o, t) && d(e, t, o[t]);
7
+ L.call(o, t) && x(e, t, o[t]);
8
+ if (O)
9
+ for (var t of O(o))
10
+ T.call(o, t) && x(e, t, o[t]);
11
11
  return e;
12
- }, O = (e, o) => _(e, C(o));
13
- var b = (e, o, t) => (d(e, typeof o != "symbol" ? o + "" : o, t), t);
14
- var p = (e, o, t) => new Promise((r, a) => {
15
- var i = (h) => {
12
+ }, M = (e, o) => _(e, C(o));
13
+ var p = (e, o, t) => (x(e, typeof o != "symbol" ? o + "" : o, t), t);
14
+ var c = (e, o, t) => new Promise((n, a) => {
15
+ var s = (h) => {
16
16
  try {
17
- s(t.next(h));
17
+ i(t.next(h));
18
18
  } catch (l) {
19
19
  a(l);
20
20
  }
21
- }, n = (h) => {
21
+ }, r = (h) => {
22
22
  try {
23
- s(t.throw(h));
23
+ i(t.throw(h));
24
24
  } catch (l) {
25
25
  a(l);
26
26
  }
27
- }, s = (h) => h.done ? r(h.value) : Promise.resolve(h.value).then(i, n);
28
- s((t = t.apply(e, o)).next());
27
+ }, i = (h) => h.done ? n(h.value) : Promise.resolve(h.value).then(s, r);
28
+ i((t = t.apply(e, o)).next());
29
29
  });
30
30
  import { BaseObject as N } from "../Base/index.js";
31
- import * as x from "three";
31
+ import * as P from "three";
32
32
  import { BoxMeshEditor as A } from "../../Editors/BoxMeshEditor.js";
33
33
  import { BoxMesh as E } from "../../Meshes/Box.js";
34
34
  import { createRectangle as D } from "../Rectangle/index.js";
@@ -40,18 +40,18 @@ import { RectangleWithEdgeMesh as G } from "../../Meshes/RectangleWithEdge.js";
40
40
  import { centerPoint as B } from "../../../shared-utils/three/centerPoint.js";
41
41
  import { anyPositionToVector3 as v } from "../../../shared-utils/positionToVector3.js";
42
42
  class ot extends N {
43
- constructor(t, r) {
44
- super(t, r);
45
- b(this, "type", "Box");
46
- b(this, "boxMesh");
47
- b(this, "_editor");
48
- t && (this.boxMesh = new E(m(m({}, t.style), t)), this.add(this.boxMesh));
43
+ constructor(t, n) {
44
+ super(t, n);
45
+ p(this, "type", "Box");
46
+ p(this, "boxMesh");
47
+ p(this, "_editor");
48
+ t && (this.boxMesh = new E(d(d({}, t.style), t)), this.add(this.boxMesh));
49
49
  }
50
50
  get editor() {
51
51
  return this._editor || (this._editor = new A(this.boxMesh)), this._editor;
52
52
  }
53
53
  get data() {
54
- return O(m({}, this.baseData), {
54
+ return M(d({}, this.baseData), {
55
55
  points: j(this.applyObjectMatrixWorld(this.boxMesh.bottomPositions, this.boxMesh)),
56
56
  heightPoint: j(this.applyObjectMatrixWorld(this.boxMesh.topPosition, this.boxMesh)),
57
57
  style: {
@@ -77,7 +77,7 @@ class ot extends N {
77
77
  (t = this.boxMesh) == null || t.unhighlight();
78
78
  }
79
79
  create(t) {
80
- return p(this, null, function* () {
80
+ return c(this, null, function* () {
81
81
  this.removeChildren(), this.boxMesh = new E(t), this.add(this.boxMesh), yield $(this.boxMesh, this.pointSelector, t), this.config.defaultAction && this.editor.enable();
82
82
  });
83
83
  }
@@ -88,52 +88,58 @@ class ot extends N {
88
88
  getWorldFacesGeometry() {
89
89
  if (!this.boxMesh)
90
90
  return [];
91
- const t = this.applyObjectMatrixWorld(this.boxMesh.bottomPositions, this.boxMesh), r = this.applyObjectMatrixWorld(this.boxMesh.topPositions, this.boxMesh);
92
- if (!t || !r || t.length !== 4 || r.length !== 4)
91
+ const t = this.applyObjectMatrixWorld(this.boxMesh.bottomPositions, this.boxMesh), n = this.applyObjectMatrixWorld(this.boxMesh.topPositions, this.boxMesh);
92
+ if (!t || !n || t.length !== 4 || n.length !== 4)
93
93
  return [];
94
- const a = [], i = (n, s) => {
95
- const h = new x.Triangle(s[0], s[1], s[2]).getNormal(new x.Vector3()), l = B(...s);
96
- a.push({ name: n, vertices: s, center: l, normal: h });
94
+ const a = [], s = (r, i) => {
95
+ const h = new P.Triangle(i[0], i[1], i[2]).getNormal(new P.Vector3()), l = B(...i);
96
+ a.push({ name: r, vertices: i, center: l, normal: h });
97
97
  };
98
- i("bottom", [t[0], t[1], t[2], t[3]]), i("top", [r[0], r[1], r[2], r[3]]);
99
- for (let n = 0; n < 4; n++) {
100
- const s = (n + 1) % 4;
101
- i(`side${n}`, [t[n], t[s], r[s], r[n]]);
98
+ s("bottom", [t[0], t[1], t[2], t[3]]), s("top", [n[0], n[1], n[2], n[3]]);
99
+ for (let r = 0; r < 4; r++) {
100
+ const i = (r + 1) % 4;
101
+ s(`side${r}`, [t[r], t[i], n[i], n[r]]);
102
102
  }
103
103
  return a;
104
104
  }
105
105
  }
106
106
  function $(e, o, t) {
107
- return p(this, null, function* () {
108
- return new Promise((r, a) => p(this, null, function* () {
109
- const i = e.parent;
110
- if (!i) {
107
+ return c(this, null, function* () {
108
+ return new Promise((n, a) => c(this, null, function* () {
109
+ const s = e.parent;
110
+ if (!s) {
111
111
  a(new Error("No container"));
112
112
  return;
113
113
  }
114
- const n = new G(e.style);
115
- i.add(n), yield D(n, o, t), i.remove(n), e.setPoints({ points: n.points });
116
- const s = new F(), h = U(e.bottomPositions), l = B(...e.bottomPositions), f = l.clone().add(h.clone().multiplyScalar(100)), M = l.clone().sub(h.clone().multiplyScalar(100));
117
- s.setPoints([f, M]), i.add(s), o.enable();
118
- const g = (c) => {
119
- P(), r();
120
- }, y = (c) => {
121
- if (!(c != null && c.raycaster))
114
+ const r = new G(e.style);
115
+ s.add(r), yield D(r, o, M(d({}, t), {
116
+ onPointPlaced: () => {
117
+ var m;
118
+ (m = t == null ? void 0 : t.onPointPlaced) == null || m.call(t);
119
+ }
120
+ })), s.remove(r), e.setPoints({ points: r.points });
121
+ const i = new F(), h = U(e.bottomPositions), l = B(...e.bottomPositions), y = l.clone().add(h.clone().multiplyScalar(100)), u = l.clone().sub(h.clone().multiplyScalar(100));
122
+ i.setPoints([y, u]), s.add(i), o.enable();
123
+ const f = (m) => {
124
+ var b;
125
+ (b = t == null ? void 0 : t.onPointPlaced) == null || b.call(t), g(), n();
126
+ }, w = (m) => {
127
+ if (!(m != null && m.raycaster))
122
128
  return;
123
- const w = V({
124
- raycaster: c.raycaster,
125
- line: new x.Line3(f, M)
129
+ const b = V({
130
+ raycaster: m.raycaster,
131
+ line: new P.Line3(y, u)
126
132
  });
127
- if (w) {
128
- const H = w.clone().sub(l);
133
+ if (b) {
134
+ const H = b.clone().sub(l);
129
135
  e.setPoints({ heightPoint: e.bottomPositions[0].clone().add(H) });
130
136
  }
131
- }, P = () => {
132
- o.off("select", g), o.off("intersectionUpdate", y), o.off("disable", u), o.disable(), i == null || i.remove(s);
133
- }, u = () => {
134
- P(), i == null || i.remove(e), a(new Error("Cancelled"));
137
+ }, g = () => {
138
+ o.off("select", f), o.off("intersectionUpdate", w), o.off("disable", W), o.disable(), s == null || s.remove(i);
139
+ }, W = () => {
140
+ g(), s == null || s.remove(e), a(new Error("Cancelled"));
135
141
  };
136
- o.on("select", g), o.on("intersectionUpdate", y), o.on("disable", u);
142
+ o.on("select", f), o.on("intersectionUpdate", w), o.on("disable", W);
137
143
  }));
138
144
  });
139
145
  }
@@ -1,31 +1,31 @@
1
1
  var _ = Object.defineProperty, j = Object.defineProperties;
2
2
  var E = Object.getOwnPropertyDescriptors;
3
- var u = Object.getOwnPropertySymbols;
3
+ var g = Object.getOwnPropertySymbols;
4
4
  var L = Object.prototype.hasOwnProperty, A = Object.prototype.propertyIsEnumerable;
5
- var d = (s, t, i) => t in s ? _(s, t, { enumerable: !0, configurable: !0, writable: !0, value: i }) : s[t] = i, p = (s, t) => {
6
- for (var i in t || (t = {}))
7
- L.call(t, i) && d(s, i, t[i]);
8
- if (u)
9
- for (var i of u(t))
10
- A.call(t, i) && d(s, i, t[i]);
5
+ var P = (s, i, t) => i in s ? _(s, i, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[i] = t, d = (s, i) => {
6
+ for (var t in i || (i = {}))
7
+ L.call(i, t) && P(s, t, i[t]);
8
+ if (g)
9
+ for (var t of g(i))
10
+ A.call(i, t) && P(s, t, i[t]);
11
11
  return s;
12
- }, w = (s, t) => j(s, E(t));
13
- var c = (s, t, i) => (d(s, typeof t != "symbol" ? t + "" : t, i), i);
14
- var f = (s, t, i) => new Promise((o, r) => {
12
+ }, w = (s, i) => j(s, E(i));
13
+ var c = (s, i, t) => (P(s, typeof i != "symbol" ? i + "" : i, t), t);
14
+ var M = (s, i, t) => new Promise((o, r) => {
15
15
  var n = (e) => {
16
16
  try {
17
- h(i.next(e));
17
+ h(t.next(e));
18
18
  } catch (l) {
19
19
  r(l);
20
20
  }
21
- }, a = (e) => {
21
+ }, p = (e) => {
22
22
  try {
23
- h(i.throw(e));
23
+ h(t.throw(e));
24
24
  } catch (l) {
25
25
  r(l);
26
26
  }
27
- }, h = (e) => e.done ? o(e.value) : Promise.resolve(e.value).then(n, a);
28
- h((i = i.apply(s, t)).next());
27
+ }, h = (e) => e.done ? o(e.value) : Promise.resolve(e.value).then(n, p);
28
+ h((t = t.apply(s, i)).next());
29
29
  });
30
30
  import { BaseObject as C } from "../Base/index.js";
31
31
  import * as R from "three";
@@ -39,18 +39,18 @@ import { vector3ToArray as x } from "../../../shared-utils/three/vector3ToArray.
39
39
  import { AreaMesh as V } from "../../Meshes/Area.js";
40
40
  import { anyPositionToVector3 as H } from "../../../shared-utils/positionToVector3.js";
41
41
  class $ extends C {
42
- constructor(i, o) {
43
- super(i, o);
42
+ constructor(t, o) {
43
+ super(t, o);
44
44
  c(this, "type", "Prism");
45
45
  c(this, "prismMesh");
46
46
  c(this, "_editor");
47
- i && (this.prismMesh = new v(p(p({}, i.style), i)), this.add(this.prismMesh));
47
+ t && (this.prismMesh = new v(d(d({}, t.style), t)), this.add(this.prismMesh));
48
48
  }
49
49
  get editor() {
50
50
  return this._editor || (this._editor = new U(this.prismMesh)), this._editor;
51
51
  }
52
52
  get data() {
53
- return w(p({}, this.baseData), {
53
+ return w(d({}, this.baseData), {
54
54
  points: x(this.applyObjectMatrixWorld(this.prismMesh.bottomPositions, this.prismMesh)),
55
55
  heightPoint: x(this.applyObjectMatrixWorld(this.prismMesh.topPosition, this.prismMesh)),
56
56
  style: {
@@ -60,50 +60,51 @@ class $ extends C {
60
60
  }
61
61
  });
62
62
  }
63
- setData(i) {
63
+ setData(t) {
64
64
  this.prismMesh.setPoints({
65
- points: i.points ? this.applyObjectReversalMatrixWorld(i.points.map(H), this.prismMesh) : void 0,
66
- heightPoint: i.heightPoint ? this.applyObjectReversalMatrixWorld(H(i.heightPoint), this.prismMesh) : void 0
67
- }), this.prismMesh.setStyle(i.style), this._editor && this._editor.initialHelperMatrix();
65
+ points: t.points ? this.applyObjectReversalMatrixWorld(t.points.map(H), this.prismMesh) : void 0,
66
+ heightPoint: t.heightPoint ? this.applyObjectReversalMatrixWorld(H(t.heightPoint), this.prismMesh) : void 0
67
+ }), this.prismMesh.setStyle(t.style), this._editor && this._editor.initialHelperMatrix();
68
68
  }
69
69
  highlight() {
70
- var i;
71
- (i = this.prismMesh) == null || i.highlight();
70
+ var t;
71
+ (t = this.prismMesh) == null || t.highlight();
72
72
  }
73
73
  unhighlight() {
74
- var i;
75
- (i = this.prismMesh) == null || i.unhighlight();
74
+ var t;
75
+ (t = this.prismMesh) == null || t.unhighlight();
76
76
  }
77
- create(i) {
78
- return f(this, null, function* () {
79
- this.prismMesh = new v(i), this.add(this.prismMesh), yield k(this.prismMesh, this.pointSelector, i), this.config.defaultAction && this.editor.enable();
77
+ create(t) {
78
+ return M(this, null, function* () {
79
+ this.prismMesh = new v(t), this.add(this.prismMesh), yield k(this.prismMesh, this.pointSelector, t), this.config.defaultAction && this.editor.enable();
80
80
  });
81
81
  }
82
82
  }
83
- function k(s, t, i) {
84
- return f(this, null, function* () {
83
+ function k(s, i, t) {
84
+ return M(this, null, function* () {
85
85
  const o = s.parent, r = new V(s.style);
86
- o.add(r), yield T(r, t, i).finished, o.remove(r), s.setPoints({ points: r.points });
86
+ o.add(r), yield T(r, i, t).finished, o.remove(r), s.setPoints({ points: r.points });
87
87
  const n = new D();
88
88
  n.name = "LineHelper", o.add(n);
89
- const a = r.points.at(-1), h = N(r.points), e = a.clone().add(h.clone().multiplyScalar(100)), l = a.clone().sub(h.clone().multiplyScalar(100));
90
- return n.setPoints([e, l]), t.enable(), new Promise((O, W) => {
91
- const M = (m) => {
92
- y(), O();
93
- }, P = (m) => {
94
- if (!(m != null && m.raycaster))
89
+ const p = r.points.at(-1), h = N(r.points), e = p.clone().add(h.clone().multiplyScalar(100)), l = p.clone().sub(h.clone().multiplyScalar(100));
90
+ return n.setPoints([e, l]), i.enable(), new Promise((O, W) => {
91
+ const y = (a) => {
92
+ var m;
93
+ (m = t == null ? void 0 : t.onPointPlaced) == null || m.call(t, s.bottomPositions), b(), O();
94
+ }, f = (a) => {
95
+ if (!(a != null && a.raycaster))
95
96
  return;
96
- const b = B({
97
- raycaster: m.raycaster,
97
+ const m = B({
98
+ raycaster: a.raycaster,
98
99
  line: new R.Line3(e, l)
99
100
  });
100
- b && s.setPoints({ heightPoint: b });
101
- }, y = () => {
102
- t.off("select", M), t.off("intersectionUpdate", P), t.off("disable", g), o.remove(n), t.disable();
103
- }, g = () => {
104
- y(), o.remove(s), W(new Error("Cancelled"));
101
+ m && s.setPoints({ heightPoint: m });
102
+ }, b = () => {
103
+ i.off("select", y), i.off("intersectionUpdate", f), i.off("disable", u), o.remove(n), i.disable();
104
+ }, u = () => {
105
+ b(), o.remove(s), W(new Error("Cancelled"));
105
106
  };
106
- t.on("select", M), t.on("intersectionUpdate", P), t.on("disable", g);
107
+ i.on("select", y), i.on("intersectionUpdate", f), i.on("disable", u);
107
108
  });
108
109
  });
109
110
  }
@@ -9,6 +9,9 @@ export interface RectangleImportData extends BaseImportData, RectangleData {
9
9
  type: LiteralString<'Rectangle'>;
10
10
  style?: Partial<RectangleWithEdgeMeshStyle>;
11
11
  }
12
+ export type RectangleCreateConfig = Partial<RectangleWithEdgeMeshStyle & CreateLimitConfig & DrawMethodConfig> & {
13
+ onPointPlaced?: () => void;
14
+ };
12
15
  export declare class Rectangle extends BaseObject<RectangleImportData> {
13
16
  readonly type = "Rectangle";
14
17
  rectangleMesh: RectangleWithEdgeMesh;
@@ -29,17 +32,17 @@ export declare class Rectangle extends BaseObject<RectangleImportData> {
29
32
  setData(data: Partial<RectangleImportData>): void;
30
33
  highlight(): void;
31
34
  unhighlight(): void;
32
- create(config?: Partial<RectangleWithEdgeMeshStyle & CreateLimitConfig & DrawMethodConfig>): Promise<void>;
35
+ create(config?: RectangleCreateConfig): Promise<void>;
33
36
  }
34
37
  /**
35
38
  * @description 创建矩形
36
39
  */
37
- export declare function createRectangle(rectangleMesh: RectangleMesh, pointSelector: PointSelector, config?: Partial<CreateLimitConfig & DrawMethodConfig>): void | Promise<void>;
40
+ export declare function createRectangle(rectangleMesh: RectangleMesh, pointSelector: PointSelector, config?: RectangleCreateConfig): void | Promise<void>;
38
41
  /**
39
42
  * @description 对角线创建矩形(两步)
40
43
  */
41
- export declare function createRectangleByDiagonal(rectangleMesh: RectangleMesh, pointSelector: PointSelector, config?: Partial<CreateLimitConfig>): void | Promise<void>;
44
+ export declare function createRectangleByDiagonal(rectangleMesh: RectangleMesh, pointSelector: PointSelector, config?: RectangleCreateConfig): void | Promise<void>;
42
45
  /**
43
46
  * @description 正常创建矩形(三步)
44
47
  */
45
- export declare function createRectangleByVertex(rectangleMesh: RectangleMesh, pointSelector: PointSelector, config?: Partial<CreateLimitConfig>): void | Promise<void>;
48
+ export declare function createRectangleByVertex(rectangleMesh: RectangleMesh, pointSelector: PointSelector, config?: RectangleCreateConfig): void | Promise<void>;