@realsee/dnalogel 3.79.3 → 3.79.4

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,45 +1,46 @@
1
- var ct = Object.defineProperty, Pt = Object.defineProperties;
2
- var yt = Object.getOwnPropertyDescriptors;
1
+ var Pt = Object.defineProperty, yt = Object.defineProperties;
2
+ var mt = Object.getOwnPropertyDescriptors;
3
3
  var it = Object.getOwnPropertySymbols;
4
- var mt = Object.prototype.hasOwnProperty, xt = Object.prototype.propertyIsEnumerable;
5
- var _ = Math.pow, T = (e, s, t) => s in e ? ct(e, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[s] = t, H = (e, s) => {
6
- for (var t in s || (s = {}))
7
- mt.call(s, t) && T(e, t, s[t]);
4
+ var xt = Object.prototype.hasOwnProperty, ft = Object.prototype.propertyIsEnumerable;
5
+ var v = Math.pow, T = (s, e, t) => e in s ? Pt(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t, _ = (s, e) => {
6
+ for (var t in e || (e = {}))
7
+ xt.call(e, t) && T(s, t, e[t]);
8
8
  if (it)
9
- for (var t of it(s))
10
- xt.call(s, t) && T(e, t, s[t]);
11
- return e;
12
- }, R = (e, s) => Pt(e, yt(s));
13
- var C = (e, s, t) => (T(e, typeof s != "symbol" ? s + "" : s, t), t);
14
- var ot = (e, s, t) => new Promise((n, r) => {
9
+ for (var t of it(e))
10
+ ft.call(e, t) && T(s, t, e[t]);
11
+ return s;
12
+ }, R = (s, e) => yt(s, mt(e));
13
+ var C = (s, e, t) => (T(s, typeof e != "symbol" ? e + "" : e, t), t);
14
+ var ot = (s, e, t) => new Promise((r, n) => {
15
15
  var x = (c) => {
16
16
  try {
17
17
  w(t.next(c));
18
18
  } catch (u) {
19
- r(u);
19
+ n(u);
20
20
  }
21
21
  }, a = (c) => {
22
22
  try {
23
23
  w(t.throw(c));
24
24
  } catch (u) {
25
- r(u);
25
+ n(u);
26
26
  }
27
- }, w = (c) => c.done ? n(c.value) : Promise.resolve(c.value).then(x, a);
28
- w((t = t.apply(e, s)).next());
27
+ }, w = (c) => c.done ? r(c.value) : Promise.resolve(c.value).then(x, a);
28
+ w((t = t.apply(s, e)).next());
29
29
  });
30
- import { BaseObject as ft } from "../Base/index.js";
31
- import * as j from "three";
32
- import { PolylineMesh as nt } from "../../Meshes/Polyline.js";
33
- import { AreaMesh as rt } from "../../Meshes/Area.js";
34
- import { PolygonEditor as bt } from "./Editor.js";
35
- import { vector3ToArray as Ct } from "../../../shared-utils/three/vector3ToArray.js";
36
- import { withResolvers as wt } from "../../../shared-utils/promise/withResolvers.js";
37
- import { anyPositionToVector3 as Dt } from "../../../shared-utils/positionToVector3.js";
30
+ import { BaseObject as bt } from "../Base/index.js";
31
+ import * as H from "three";
32
+ import { PolylineMesh as rt } from "../../Meshes/Polyline.js";
33
+ import { AreaMesh as nt } from "../../Meshes/Area.js";
34
+ import { PolygonEditor as Ct } from "./Editor.js";
35
+ import { vector3ToArray as wt } from "../../../shared-utils/three/vector3ToArray.js";
36
+ import { withResolvers as Dt } from "../../../shared-utils/promise/withResolvers.js";
37
+ import { anyPositionToVector3 as _t } from "../../../shared-utils/positionToVector3.js";
38
38
  import { PointMesh as Ht } from "../../Meshes/Point.js";
39
- class Wt extends ft {
40
- constructor(t, n) {
41
- var r;
42
- super(t, n);
39
+ import { isPolygenIntersecting as lt } from "../../utils/isIntersecting.js";
40
+ class At extends bt {
41
+ constructor(t, r) {
42
+ var n;
43
+ super(t, r);
43
44
  C(this, "type", "Polygon");
44
45
  C(this, "areaMesh");
45
46
  // 新增:Polygon 专属的历史记录
@@ -48,19 +49,19 @@ class Wt extends ft {
48
49
  C(this, "maxHistorySize", 50);
49
50
  C(this, "_editor");
50
51
  C(this, "creatingObject");
51
- t && (this.areaMesh = new rt(H(H({}, t.style), t)), this.areaMesh.userData = (r = this.areaMesh.userData) != null ? r : {}, typeof this.areaMesh.userData.dragSelectPixelDistance != "number" && (this.areaMesh.userData.dragSelectPixelDistance = 10), this.add(this.areaMesh));
52
+ t && (this.areaMesh = new nt(_(_({}, t.style), t)), this.areaMesh.userData = (n = this.areaMesh.userData) != null ? n : {}, typeof this.areaMesh.userData.dragSelectPixelDistance != "number" && (this.areaMesh.userData.dragSelectPixelDistance = 10), this.add(this.areaMesh));
52
53
  }
53
54
  get editor() {
54
- return this._editor || (this._editor = new bt(this)), this._editor;
55
+ return this._editor || (this._editor = new Ct(this)), this._editor;
55
56
  }
56
57
  updateCreationPointMeshes() {
57
- var n, r;
58
- const t = (r = (n = this.areaMesh) == null ? void 0 : n.userData) == null ? void 0 : r.syncCreationPointMeshes;
58
+ var r, n;
59
+ const t = (n = (r = this.areaMesh) == null ? void 0 : r.userData) == null ? void 0 : n.syncCreationPointMeshes;
59
60
  typeof t == "function" && t(), this._editor && this._editor.updatePointMeshes();
60
61
  }
61
62
  get data() {
62
- return this.updateMatrixWorld(), R(H({}, this.baseData), {
63
- points: Ct(this.applyObjectMatrixWorld(this.areaMesh.points)),
63
+ return this.updateMatrixWorld(), R(_({}, this.baseData), {
64
+ points: wt(this.applyObjectMatrixWorld(this.areaMesh.points)),
64
65
  style: {
65
66
  color: this.areaMesh.color.getHex(),
66
67
  lineColor: this.areaMesh.lineColor.getHex(),
@@ -69,7 +70,7 @@ class Wt extends ft {
69
70
  });
70
71
  }
71
72
  setData(t) {
72
- t.points && this.areaMesh.setPoints(this.applyObjectReversalMatrixWorld(t.points.map(Dt))), this.areaMesh.setStyle(t.style), this.updateCreationPointMeshes();
73
+ t.points && this.areaMesh.setPoints(this.applyObjectReversalMatrixWorld(t.points.map(_t))), this.areaMesh.setStyle(t.style), this.updateCreationPointMeshes();
73
74
  }
74
75
  highlight() {
75
76
  var t;
@@ -80,32 +81,32 @@ class Wt extends ft {
80
81
  (t = this.areaMesh) == null || t.unhighlight();
81
82
  }
82
83
  canUndo() {
83
- var n, r, x;
84
- return this.creatingObject ? (x = (r = (n = this.creatingObject) == null ? void 0 : n.canUndo) == null ? void 0 : r.call(n)) != null ? x : !1 : this.currentHistoryIndex > 0;
84
+ var r, n, x;
85
+ return this.creatingObject ? (x = (n = (r = this.creatingObject) == null ? void 0 : r.canUndo) == null ? void 0 : n.call(r)) != null ? x : !1 : this.currentHistoryIndex > 0;
85
86
  }
86
87
  canRedo() {
87
- var t, n, r;
88
- return this.creatingObject ? (r = (n = (t = this.creatingObject) == null ? void 0 : t.canRedo) == null ? void 0 : n.call(t)) != null ? r : !1 : this.currentHistoryIndex < this.historyStack.length - 1;
88
+ var t, r, n;
89
+ return this.creatingObject ? (n = (r = (t = this.creatingObject) == null ? void 0 : t.canRedo) == null ? void 0 : r.call(t)) != null ? n : !1 : this.currentHistoryIndex < this.historyStack.length - 1;
89
90
  }
90
91
  undo() {
91
- var t, n;
92
+ var t, r;
92
93
  if (this.creatingObject)
93
- return (n = (t = this.creatingObject) == null ? void 0 : t.undo) == null ? void 0 : n.call(t);
94
+ return (r = (t = this.creatingObject) == null ? void 0 : t.undo) == null ? void 0 : r.call(t);
94
95
  if (this.canUndo()) {
95
96
  this.currentHistoryIndex--;
96
- const r = this.historyStack[this.currentHistoryIndex];
97
- this.restoreSnapshot(r);
97
+ const n = this.historyStack[this.currentHistoryIndex];
98
+ this.restoreSnapshot(n);
98
99
  } else
99
100
  console.log("[Polygon] undo: 无法撤销", { uuid: this.uuid });
100
101
  }
101
102
  redo() {
102
- var t, n;
103
+ var t, r;
103
104
  if (this.creatingObject)
104
- return (n = (t = this.creatingObject) == null ? void 0 : t.redo) == null ? void 0 : n.call(t);
105
+ return (r = (t = this.creatingObject) == null ? void 0 : t.redo) == null ? void 0 : r.call(t);
105
106
  if (this.canRedo()) {
106
107
  this.currentHistoryIndex++;
107
- const r = this.historyStack[this.currentHistoryIndex];
108
- this.restoreSnapshot(r);
108
+ const n = this.historyStack[this.currentHistoryIndex];
109
+ this.restoreSnapshot(n);
109
110
  }
110
111
  }
111
112
  /**
@@ -116,7 +117,7 @@ class Wt extends ft {
116
117
  return;
117
118
  this.historyStack = this.historyStack.slice(0, this.currentHistoryIndex + 1);
118
119
  const t = {
119
- points: this.areaMesh.points.map((n) => n.clone())
120
+ points: this.areaMesh.points.map((r) => r.clone())
120
121
  };
121
122
  this.historyStack.push(t), this.historyStack.length > this.maxHistorySize ? this.historyStack.shift() : this.currentHistoryIndex++;
122
123
  }
@@ -124,88 +125,88 @@ class Wt extends ft {
124
125
  * 恢复快照
125
126
  */
126
127
  restoreSnapshot(t) {
127
- this.areaMesh.setPoints(t.points.map((n) => n.clone())), this.updateCreationPointMeshes(), this._editor && this._editor.updatePointMeshes();
128
+ this.areaMesh.setPoints(t.points.map((r) => r.clone())), this.updateCreationPointMeshes(), this._editor && this._editor.updatePointMeshes();
128
129
  }
129
130
  create(t) {
130
131
  return ot(this, null, function* () {
131
- var r;
132
+ var n;
132
133
  this.children.forEach((x) => {
133
134
  x.parent === this && this.remove(x);
134
135
  }), this.children.length = 0;
135
- const n = new rt(t);
136
- this.areaMesh = n, this.add(this.areaMesh), this.creatingObject = jt(this.areaMesh, this.pointSelector, t), yield (r = this.creatingObject) == null ? void 0 : r.finished, this.creatingObject = null, this.recordHistory(), this.updateCreationPointMeshes(), this.config.defaultAction && this.editor.enable();
136
+ const r = new nt(t);
137
+ this.areaMesh = r, this.add(this.areaMesh), this.creatingObject = jt(this.areaMesh, this.pointSelector, t), yield (n = this.creatingObject) == null ? void 0 : n.finished, this.creatingObject = null, this.recordHistory(), this.updateCreationPointMeshes(), this.config.defaultAction && this.editor.enable();
137
138
  });
138
139
  }
139
140
  }
140
- function jt(e, s, t) {
141
- var N, $, G, J, K, Q, X, Z, g;
142
- const { promise: n, resolve: r, reject: x } = wt(), a = e.parent;
141
+ function jt(s, e, t) {
142
+ var $, B, G, J, K, Q, X, Z, g;
143
+ const { promise: r, resolve: n, reject: x } = Dt(), a = s.parent;
143
144
  if (!a) {
144
145
  x(new Error("No container"));
145
146
  return;
146
147
  }
147
- const w = (N = t == null ? void 0 : t.limit) != null ? N : "none", c = t == null ? void 0 : t.simpleMode, u = (Q = (K = (G = e.five) != null ? G : ($ = e.get) == null ? void 0 : $.call(e, "five")) != null ? K : (J = window.globalModules) == null ? void 0 : J.five) != null ? Q : window.$five, V = (X = t == null ? void 0 : t.autoClosePixelDistance) != null ? X : 10;
148
- e.userData = (Z = e.userData) != null ? Z : {}, e.userData.dragSelectPixelDistance = V;
148
+ const w = ($ = t == null ? void 0 : t.limit) != null ? $ : "none", c = t == null ? void 0 : t.simpleMode, u = (Q = (K = (G = s.five) != null ? G : (B = s.get) == null ? void 0 : B.call(s, "five")) != null ? K : (J = window.globalModules) == null ? void 0 : J.five) != null ? Q : window.$five, V = (X = t == null ? void 0 : t.autoClosePixelDistance) != null ? X : 10;
149
+ s.userData = (Z = s.userData) != null ? Z : {}, s.userData.dragSelectPixelDistance = V;
149
150
  let M = 0;
150
151
  c && u && u.model && u.model.bounding && typeof ((g = u.model.bounding.max) == null ? void 0 : g.y) == "number" && (M = u.model.bounding.max.y + 1);
151
- const P = new nt(e.style);
152
+ const P = new rt(s.style);
152
153
  a == null || a.add(P);
153
- const y = new nt(R(H({}, e.style), { dashed: !0, lengthEnable: !1 }));
154
+ const y = new rt(R(_({}, s.style), { dashed: !0, lengthEnable: !1 }));
154
155
  a == null || a.add(y);
155
- let v = [];
156
- const lt = (i = o) => {
157
- v.forEach((d, p) => {
156
+ let j = [];
157
+ const at = (i = o) => {
158
+ j.forEach((d, p) => {
158
159
  const h = i[p];
159
160
  h && d.position.copy(h);
160
161
  });
161
162
  };
162
163
  function D() {
163
164
  var d, p;
164
- v.forEach((h) => {
165
+ j.forEach((h) => {
165
166
  var f;
166
167
  return (f = h.parent) == null ? void 0 : f.remove(h);
167
168
  });
168
- const i = (p = (d = e.line) == null ? void 0 : d.style) != null ? p : e.style;
169
- v = o.map((h, f) => {
170
- var S, k;
171
- const b = new Ht(R(H({}, i), {
169
+ const i = (p = (d = s.line) == null ? void 0 : d.style) != null ? p : s.style;
170
+ j = o.map((h, f) => {
171
+ var S, I;
172
+ const b = new Ht(R(_({}, i), {
172
173
  color: (S = i.pointColor) != null ? S : i.lineColor,
173
174
  tip: void 0,
174
175
  point: h
175
176
  }));
176
- return b.name = `PolygonPointMesh_${f}`, b.userData = (k = b.userData) != null ? k : {}, b.userData.dragSelectPixelDistance = V, a == null || a.add(b), b;
177
- }), lt();
177
+ return b.name = `PolygonPointMesh_${f}`, b.userData = (I = b.userData) != null ? I : {}, b.userData.dragSelectPixelDistance = V, a == null || a.add(b), b;
178
+ }), at();
178
179
  }
179
180
  function Y() {
180
- v.forEach((i) => {
181
+ j.forEach((i) => {
181
182
  var d;
182
183
  return (d = i.parent) == null ? void 0 : d.remove(i);
183
- }), v = [], e.userData && (delete e.userData.creationPointMeshes, delete e.userData.syncCreationPointMeshes, delete e.userData.disposeCreationPointMeshes);
184
+ }), j = [], s.userData && (delete s.userData.creationPointMeshes, delete s.userData.syncCreationPointMeshes, delete s.userData.disposeCreationPointMeshes);
184
185
  }
185
- s.enable(), c && s.setAdherePoints([]);
186
+ e.enable(), c && e.setAdherePoints([]);
186
187
  const o = [];
187
188
  let l, m, W = !1, U;
188
- const E = [], z = () => o.length > 0, B = () => E.length > 0, at = () => {
189
+ const E = [], z = () => o.length > 0, q = () => E.length > 0, ht = () => {
189
190
  var i;
190
- z() && (E.push(o.pop()), O(U), D(), (i = t == null ? void 0 : t.onUndo) == null || i.call(t), s.pointSelectorHelper && s.pointSelectorHelper.magnifier && s.pointSelectorHelper.magnifier.render());
191
- }, ht = () => {
191
+ z() && (E.push(o.pop()), O(U), D(), (i = t == null ? void 0 : t.onUndo) == null || i.call(t), e.pointSelectorHelper && e.pointSelectorHelper.magnifier && e.pointSelectorHelper.magnifier.render());
192
+ }, dt = () => {
192
193
  var i;
193
- B() && (o.push(E.pop()), O(U), D(), (i = t == null ? void 0 : t.onRedo) == null || i.call(t), s.pointSelectorHelper && s.pointSelectorHelper.magnifier && s.pointSelectorHelper.magnifier.render());
194
- }, q = (i) => {
194
+ q() && (o.push(E.pop()), O(U), D(), (i = t == null ? void 0 : t.onRedo) == null || i.call(t), e.pointSelectorHelper && e.pointSelectorHelper.magnifier && e.pointSelectorHelper.magnifier.render());
195
+ }, F = (i) => {
195
196
  var p, h;
196
197
  E.length = 0;
197
198
  let d = o.length === 0 ? i.point : l.clone();
198
199
  if (c && (d = d.clone().setY(M)), t.__onWillAddPoint(d, o), !((t == null ? void 0 : t.experimental_max_point_count) != null && o.length === t.experimental_max_point_count)) {
199
- if (o.push(d), e.setPoints(o, { closed: !1 }), t != null && t.experimental_self_intersect_check && o.length > 2 && e.isBlank) {
200
+ if (o.push(d), s.setPoints(o, { closed: !1 }), t != null && t.experimental_self_intersect_check && lt(o)) {
200
201
  const f = o.pop();
201
- e.setPoints(o, { closed: !1 }), D(), console.warn("[Polygon] 检测到自相交,无法添加该点"), (p = t == null ? void 0 : t.__onSelfIntersect) == null || p.call(t, f);
202
+ s.setPoints(o, { closed: !1 }), D(), console.warn("[Polygon] 检测到自相交,无法添加该点"), (p = t == null ? void 0 : t.__onSelfIntersect) == null || p.call(t, f);
202
203
  return;
203
204
  }
204
- D(), (h = t == null ? void 0 : t.onPointPlaced) == null || h.call(t, o), W && (F(), r());
205
+ D(), (h = t == null ? void 0 : t.onPointPlaced) == null || h.call(t, o), W && (L(), n());
205
206
  }
206
207
  }, O = (i) => {
207
208
  const d = () => {
208
- P.setPoints([]), y.setPoints([]), e.setPoints(o), s.pointSelectorHelper && s.pointSelectorHelper.magnifier && s.pointSelectorHelper.magnifier.render();
209
+ P.setPoints([]), y.setPoints([]), s.setPoints(o), e.pointSelectorHelper && e.pointSelectorHelper.magnifier && e.pointSelectorHelper.magnifier.render();
209
210
  };
210
211
  if (!i) {
211
212
  d(), D();
@@ -214,40 +215,40 @@ function jt(e, s, t) {
214
215
  if (U = i, !(o != null && o.length))
215
216
  return d();
216
217
  const p = o.at(-1).clone();
217
- if (o.length < 3 && (c ? (l = i.point.clone().setY(M), P.setPoints([p, l]), y.setPoints([])) : w === "none" ? (l = i.point, P.setPoints([p, l]), y.setPoints([])) : w === "xoz" ? (m = m != null ? m : new j.Plane().setFromNormalAndCoplanarPoint(new j.Vector3(0, 1, 0), o[0]), s.plane = m, l = m.projectPoint(i.point, new j.Vector3()), P.setPoints([p, l]), y.setPoints([l, i.point])) : w === "y" && (o.length === 1 ? (l = i.point, P.setPoints([p, l]), y.setPoints([])) : (m = m != null ? m : new j.Plane().setFromCoplanarPoints(o[0], o[1], new j.Vector3(0, 1, 0).add(o[0])), s.plane = m, l = m.projectPoint(i.point, new j.Vector3()), P.setPoints([p, l]), y.setPoints([l, i.point])))), o.length >= 3) {
218
- c ? l = i.point.clone().setY(M) : l = e.projectPoint(i.point);
218
+ if (o.length < 3 && (c ? (l = i.point.clone().setY(M), P.setPoints([p, l]), y.setPoints([])) : w === "none" ? (l = i.point, P.setPoints([p, l]), y.setPoints([])) : w === "xoz" ? (m = m != null ? m : new H.Plane().setFromNormalAndCoplanarPoint(new H.Vector3(0, 1, 0), o[0]), e.plane = m, l = m.projectPoint(i.point, new H.Vector3()), P.setPoints([p, l]), y.setPoints([l, i.point])) : w === "y" && (o.length === 1 ? (l = i.point, P.setPoints([p, l]), y.setPoints([])) : (m = m != null ? m : new H.Plane().setFromCoplanarPoints(o[0], o[1], new H.Vector3(0, 1, 0).add(o[0])), e.plane = m, l = m.projectPoint(i.point, new H.Vector3()), P.setPoints([p, l]), y.setPoints([l, i.point])))), o.length >= 3) {
219
+ c ? l = i.point.clone().setY(M) : l = s.projectPoint(i.point);
219
220
  const h = o[0];
220
221
  let f = !1;
221
222
  if (typeof (t == null ? void 0 : t.autoClosePixelDistance) == "number") {
222
223
  if (u && u.camera && u.getElement) {
223
- const b = u.getElement(), S = b.clientWidth, k = b.clientHeight, A = (pt) => {
224
- const st = pt.clone().project(u.camera);
224
+ const b = u.getElement(), S = b.clientWidth, I = b.clientHeight, A = (ct) => {
225
+ const st = ct.clone().project(u.camera);
225
226
  return {
226
227
  x: (st.x * 0.5 + 0.5) * S,
227
- y: (1 - (st.y * 0.5 + 0.5)) * k
228
+ y: (1 - (st.y * 0.5 + 0.5)) * I
228
229
  };
229
- }, I = A(h), tt = A(l), et = A(i.point), dt = Math.sqrt(_(I.x - tt.x, 2) + _(I.y - tt.y, 2)), ut = Math.sqrt(_(I.x - et.x, 2) + _(I.y - et.y, 2));
230
- (dt < t.autoClosePixelDistance || ut < t.autoClosePixelDistance) && (f = !0);
230
+ }, k = A(h), tt = A(l), et = A(i.point), ut = Math.sqrt(v(k.x - tt.x, 2) + v(k.y - tt.y, 2)), pt = Math.sqrt(v(k.x - et.x, 2) + v(k.y - et.y, 2));
231
+ (ut < t.autoClosePixelDistance || pt < t.autoClosePixelDistance) && (f = !0);
231
232
  }
232
233
  } else
233
234
  (h.distanceTo(l) < 0.2 || h.distanceTo(i.point) < 0.2) && (f = !0);
234
- f ? (l = h, i.point.copy(h), s.pointSelectorHelper.updateWithIntersect(i, { emitEvent: !1 }), W = !0) : W = !1, P.setPoints([p, l]), y.setPoints([l, i.point]);
235
+ f ? (l = h, i.point.copy(h), e.pointSelectorHelper.updateWithIntersect(i, { emitEvent: !1 }), W = !0) : W = !1, P.setPoints([p, l]), y.setPoints([l, i.point]);
235
236
  }
236
- o.length >= 2 ? (e.setPoints([...o, l], { closed: !1 }), e.line.setPoints(e.points.slice(0, -1)), e.isBlank ? (s.cursorError = !0, P.setStyle({ lineColor: 16734553 }), y.setStyle({ lineColor: 16734553 })) : (s.cursorError = !1, P.setStyle({ lineColor: e.lineColor }), y.setStyle({ lineColor: e.lineColor }))) : e.setPoints([]), D();
237
- }, F = () => {
238
- s.off("select", q), s.off("intersectionUpdate", O), s.off("disable", L), s.plane = null, s.disable(), a == null || a.remove(P, y), Y();
237
+ o.length >= 2 ? (s.setPoints([...o, l], { closed: !1 }), s.line.setPoints(s.points.slice(0, -1)), t != null && t.experimental_self_intersect_check && lt([...o, l]) ? (e.cursorError = !0, P.setStyle({ lineColor: 16734553 }), y.setStyle({ lineColor: 16734553 })) : (e.cursorError = !1, P.setStyle({ lineColor: s.lineColor }), y.setStyle({ lineColor: s.lineColor }))) : s.setPoints([]), D();
239
238
  }, L = () => {
240
- F(), a == null || a.remove(e, y, P), Y(), x(new Error("Cancelled"));
239
+ e.off("select", F), e.off("intersectionUpdate", O), e.off("disable", N), e.plane = null, e.disable(), a == null || a.remove(P, y), Y();
240
+ }, N = () => {
241
+ L(), a == null || a.remove(s, y, P), Y(), x(new Error("Cancelled"));
241
242
  };
242
- return s.on("select", q), s.on("intersectionUpdate", O), s.on("disable", L), {
243
- finished: n,
243
+ return e.on("select", F), e.on("intersectionUpdate", O), e.on("disable", N), {
244
+ finished: r,
244
245
  canUndo: z,
245
- canRedo: B,
246
- undo: at,
247
- redo: ht
246
+ canRedo: q,
247
+ undo: ht,
248
+ redo: dt
248
249
  };
249
250
  }
250
251
  export {
251
- Wt as Polygon,
252
+ At as Polygon,
252
253
  jt as createPolygon
253
254
  };
@@ -0,0 +1,17 @@
1
+ interface Point3D {
2
+ x: number;
3
+ y: number;
4
+ z: number;
5
+ }
6
+ interface Line3D {
7
+ start: Point3D;
8
+ end: Point3D;
9
+ }
10
+ /**
11
+ * @description 判断线段是否相交
12
+ * @todo ai写的一些变量名起的比较怪,懒得改了
13
+ */
14
+ export declare function isIntersecting(line1: Line3D, line2: Line3D | Line3D[]): boolean;
15
+ export declare function isLinesIntersecting(lines: Line3D[]): boolean;
16
+ export declare function isPolygenIntersecting(points: Point3D[]): boolean;
17
+ export {};
@@ -0,0 +1,68 @@
1
+ function q(n, t) {
2
+ const s = Array.isArray(t) ? t : [t];
3
+ for (let r = 0; r < s.length; r++) {
4
+ const e = n.start, c = n.end, o = s[r].start, u = s[r].end;
5
+ if (!(f(e, o) || f(e, u) || f(c, o) || f(c, u) || f(e, c)) && V([e.x, e.y, e.z], [c.x, c.y, c.z], [o.x, o.y, o.z], [u.x, u.y, u.z]))
6
+ return !0;
7
+ }
8
+ return !1;
9
+ }
10
+ function M(n) {
11
+ if (n.length < 2)
12
+ return !1;
13
+ for (let t = 0; t < n.length; t++)
14
+ if (q(n[t], n.slice(t + 1)))
15
+ return !0;
16
+ return !1;
17
+ }
18
+ function w(n) {
19
+ const t = [];
20
+ for (let s = 1; s < n.length; s++) {
21
+ const r = { start: n[s - 1], end: n[s] };
22
+ t.push(r);
23
+ }
24
+ return M(t);
25
+ }
26
+ function V(n, t, s, r) {
27
+ const e = [t[0] - n[0], t[1] - n[1], t[2] - n[2]], c = [r[0] - s[0], r[1] - s[1], r[2] - s[2]], o = [
28
+ { a: [e[0], -c[0]], b: s[0] - n[0] },
29
+ { a: [e[1], -c[1]], b: s[1] - n[1] },
30
+ { a: [e[2], -c[2]], b: s[2] - n[2] }
31
+ ], u = [
32
+ [0, 1],
33
+ // X 和 Y
34
+ [0, 2],
35
+ // X 和 Z
36
+ [1, 2]
37
+ // Y 和 Z
38
+ ];
39
+ for (const [i, a] of u) {
40
+ const g = [o[i].a, o[a].a], h = [o[i].b, o[a].b], y = L(g);
41
+ if (Math.abs(y) < 1e-10)
42
+ continue;
43
+ const I = j(g, y), [x, z] = m(I, h);
44
+ return !!(b(x) && b(z));
45
+ }
46
+ return !1;
47
+ }
48
+ function L(n) {
49
+ return n[0][0] * n[1][1] - n[0][1] * n[1][0];
50
+ }
51
+ function j(n, t) {
52
+ return [
53
+ [n[1][1] / t, -n[0][1] / t],
54
+ [-n[1][0] / t, n[0][0] / t]
55
+ ];
56
+ }
57
+ function m(n, t) {
58
+ return [n[0][0] * t[0] + n[0][1] * t[1], n[1][0] * t[0] + n[1][1] * t[1]];
59
+ }
60
+ function b(n) {
61
+ return n >= 0 && n <= 1;
62
+ }
63
+ function f(n, t) {
64
+ return n.x === t.x && n.y === t.y && n.z === t.z;
65
+ }
66
+ export {
67
+ w as isPolygenIntersecting
68
+ };
@@ -23,7 +23,7 @@ let I = class {
23
23
  /**
24
24
  * @realsee/dnalogel 版本号
25
25
  */
26
- r(this, "VERSION", "3.79.3");
26
+ r(this, "VERSION", "3.79.4");
27
27
  r(this, "NAME");
28
28
  r(this, "five");
29
29
  r(this, "workUtil");