@realsee/dnalogel 3.79.3 → 3.80.1-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,30 +1,30 @@
1
1
  var P = Object.defineProperty;
2
2
  var b = Object.getOwnPropertySymbols;
3
3
  var E = Object.prototype.hasOwnProperty, B = Object.prototype.propertyIsEnumerable;
4
- var S = (a, n, t) => n in a ? P(a, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[n] = t, y = (a, n) => {
5
- for (var t in n || (n = {}))
6
- E.call(n, t) && S(a, t, n[t]);
4
+ var S = (a, p, t) => p in a ? P(a, p, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[p] = t, y = (a, p) => {
5
+ for (var t in p || (p = {}))
6
+ E.call(p, t) && S(a, t, p[t]);
7
7
  if (b)
8
- for (var t of b(n))
9
- B.call(n, t) && S(a, t, n[t]);
8
+ for (var t of b(p))
9
+ B.call(p, t) && S(a, t, p[t]);
10
10
  return a;
11
11
  };
12
- var f = (a, n, t) => (S(a, typeof n != "symbol" ? n + "" : n, t), t);
13
- var g = (a, n, t) => new Promise((i, o) => {
14
- var e = (p) => {
12
+ var f = (a, p, t) => (S(a, typeof p != "symbol" ? p + "" : p, t), t);
13
+ var g = (a, p, t) => new Promise((i, o) => {
14
+ var e = (n) => {
15
15
  try {
16
- l(t.next(p));
16
+ l(t.next(n));
17
17
  } catch (h) {
18
18
  o(h);
19
19
  }
20
- }, s = (p) => {
20
+ }, s = (n) => {
21
21
  try {
22
- l(t.throw(p));
22
+ l(t.throw(n));
23
23
  } catch (h) {
24
24
  o(h);
25
25
  }
26
- }, l = (p) => p.done ? i(p.value) : Promise.resolve(p.value).then(e, s);
27
- l((t = t.apply(a, n)).next());
26
+ }, l = (n) => n.done ? i(n.value) : Promise.resolve(n.value).then(e, s);
27
+ l((t = t.apply(a, p)).next());
28
28
  });
29
29
  import { BaseTag as z } from "./BaseTag.js";
30
30
  import * as r from "three";
@@ -187,6 +187,7 @@ import "../../../PanoMeasurePlugin/utils/isIntersecting.js";
187
187
  import "../../../Sculpt/utils/three/ColoredMesh.js";
188
188
  import "../../../shared-utils/three/geometryUtil.js";
189
189
  import "../../../Sculpt/Objects/Polygon/Editor.js";
190
+ import "../../../Sculpt/utils/isIntersecting.js";
190
191
  import "../../../Sculpt/Objects/Prism/index.js";
191
192
  import "../../../Sculpt/Meshes/Prism.js";
192
193
  import "../../../shared-utils/three/core/PrismGeometry.js";
@@ -261,8 +262,8 @@ class ne extends z {
261
262
  const t = this.position;
262
263
  if (!(t != null && t.start) || !(t != null && t.end))
263
264
  return [0, 0, 0];
264
- const i = t.end.map((h) => Number(h)), o = t.start.map((h) => Number(h)), e = i[0] / 2 + o[0] / 2, s = i[1] / 2 + o[1] / 2, l = i[2] / 2 + o[2] / 2, p = new r.Vector3(e, s, l);
265
- return x(p, this.workUtil.transform).toArray();
265
+ const i = t.end.map((h) => Number(h)), o = t.start.map((h) => Number(h)), e = i[0] / 2 + o[0] / 2, s = i[1] / 2 + o[1] / 2, l = i[2] / 2 + o[2] / 2, n = new r.Vector3(e, s, l);
266
+ return x(n, this.workUtil.transform).toArray();
266
267
  }
267
268
  /**
268
269
  * 获取盒子的8个角点坐标
@@ -394,15 +395,15 @@ class ne extends z {
394
395
  * 将 BoxPosition 转换为 Sculpt 需要的数据格式
395
396
  */
396
397
  boxPositionToSculptData(t) {
397
- const i = u(t.start), o = u(t.end), e = new r.Euler().fromArray(t.rotation), s = new r.Vector3((i.x + o.x) / 2, (i.y + o.y) / 2, (i.z + o.z) / 2), l = new r.Vector3(Math.abs(o.x - i.x) / 2, Math.abs(o.y - i.y) / 2, Math.abs(o.z - i.z) / 2), p = new r.Matrix4().makeRotationFromEuler(e), h = [
398
+ const i = u(t.start), o = u(t.end), e = new r.Euler().fromArray(t.rotation), s = new r.Vector3((i.x + o.x) / 2, (i.y + o.y) / 2, (i.z + o.z) / 2), l = new r.Vector3(Math.abs(o.x - i.x) / 2, Math.abs(o.y - i.y) / 2, Math.abs(o.z - i.z) / 2), n = new r.Matrix4().makeRotationFromEuler(e), h = [
398
399
  new r.Vector3(-0.5, -0.5, -0.5),
399
400
  new r.Vector3(0.5, -0.5, -0.5),
400
401
  new r.Vector3(0.5, -0.5, 0.5),
401
402
  new r.Vector3(-0.5, -0.5, 0.5)
402
403
  ], d = new r.Vector3(-0.5, 0.5, -0.5), c = l.clone().multiplyScalar(2), m = this.workUtil.transform, v = h.map((V) => {
403
- const C = V.clone().multiply(c).applyMatrix4(p).add(s);
404
+ const C = V.clone().multiply(c).applyMatrix4(n).add(s);
404
405
  return x(C, m);
405
- }), w = d.clone().multiply(c).applyMatrix4(p).add(s), k = x(w, m);
406
+ }), w = d.clone().multiply(c).applyMatrix4(n).add(s), k = x(w, m);
406
407
  return { bottomPoints: v, heightPoint: k };
407
408
  }
408
409
  /**
@@ -466,9 +467,9 @@ class ne extends z {
466
467
  new r.Vector3(e.x, o.y, e.z),
467
468
  new r.Vector3(o.x, e.y, e.z),
468
469
  new r.Vector3(e.x, e.y, e.z)
469
- ], p = new r.Vector3().addVectors(o, e).multiplyScalar(0.5), h = this.workUtil.transform;
470
+ ], n = new r.Vector3().addVectors(o, e).multiplyScalar(0.5), h = this.workUtil.transform;
470
471
  l.forEach((m) => {
471
- m.sub(p).applyEuler(s).add(p), m.copy(x(m, h));
472
+ m.sub(n).applyEuler(s).add(n), m.copy(x(m, h));
472
473
  });
473
474
  let d = l[0];
474
475
  l.forEach((m) => {
@@ -276,6 +276,7 @@ import "../../../PanoMeasurePlugin/utils/isIntersecting.js";
276
276
  import "../../../Sculpt/utils/three/ColoredMesh.js";
277
277
  import "../../../shared-utils/three/geometryUtil.js";
278
278
  import "../../../Sculpt/Objects/Polygon/Editor.js";
279
+ import "../../../Sculpt/utils/isIntersecting.js";
279
280
  import "../../../Sculpt/Objects/Prism/index.js";
280
281
  import "../../../Sculpt/Meshes/Prism.js";
281
282
  import "../../../shared-utils/three/core/PrismGeometry.js";
@@ -301,7 +302,7 @@ import "../../../Sculpt/Objects/Line/index.js";
301
302
  import "../../../Sculpt/Editors/RectangleMeshEditor.js";
302
303
  import "../../../Sculpt/utils/sortPositionsByCameraPosition.js";
303
304
  const Z = /* @__PURE__ */ new Map(), z = /* @__PURE__ */ new Map();
304
- class Yr extends N {
305
+ class tn extends N {
305
306
  constructor(t, e) {
306
307
  super(t, e);
307
308
  v(this, "_floorIndex");
@@ -557,5 +558,5 @@ class Yr extends N {
557
558
  }
558
559
  }
559
560
  export {
560
- Yr as PlaneTag
561
+ tn as PlaneTag
561
562
  };
@@ -210,7 +210,8 @@ import "../../../Sculpt/Meshes/Box.js";
210
210
  import "../../../shared-utils/forReverseEach.js";
211
211
  import "../../../Sculpt/Objects/Line/index.js";
212
212
  import "../../../Sculpt/Objects/Polygon/Editor.js";
213
- class Ii extends v {
213
+ import "../../../Sculpt/utils/isIntersecting.js";
214
+ class Ji extends v {
214
215
  constructor(t, o) {
215
216
  super(t, o);
216
217
  c(this, "tagStyle");
@@ -476,5 +477,5 @@ class Ii extends v {
476
477
  }
477
478
  }
478
479
  export {
479
- Ii as PolygonTag
480
+ Ji as PolygonTag
480
481
  };
@@ -291,6 +291,7 @@ import "../../PanoMeasurePlugin/utils/isIntersecting.js";
291
291
  import "../../Sculpt/utils/three/ColoredMesh.js";
292
292
  import "../../shared-utils/three/geometryUtil.js";
293
293
  import "../../Sculpt/Objects/Polygon/Editor.js";
294
+ import "../../Sculpt/utils/isIntersecting.js";
294
295
  import "../../Sculpt/Objects/Prism/index.js";
295
296
  import "../../Sculpt/Meshes/Prism.js";
296
297
  import "../../shared-utils/three/core/PrismGeometry.js";
@@ -335,8 +336,8 @@ import "../Components/Common/TagPopover/TagPopoverToolBar.js";
335
336
  import "../Components/Common/TagPopover/ArrowRightIcon.js";
336
337
  import "../Components/Common/TagPopover/ShareIcon.js";
337
338
  import "../utils/popoverContainer.js";
338
- const I = "Dnalogel-PanoTagPlugin", Vs = (l) => `${I}--${l}`;
339
- class zs extends $ {
339
+ const I = "Dnalogel-PanoTagPlugin", zs = (l) => `${I}--${l}`;
340
+ class $s extends $ {
340
341
  constructor(e, t) {
341
342
  super(e);
342
343
  /** state */
@@ -917,7 +918,7 @@ class zs extends $ {
917
918
  }
918
919
  }
919
920
  export {
920
- zs as PanoTagPluginController,
921
- zs as default,
922
- Vs as pluginFlag
921
+ $s as PanoTagPluginController,
922
+ $s as default,
923
+ zs as pluginFlag
923
924
  };
@@ -1,7 +1,7 @@
1
1
  import r from "./controller/index.js";
2
- import { pluginFlag as Si } from "./controller/index.js";
3
- import { defaultGlobalConfig as Vi } from "./typings/tag/TagConfig.js";
4
- import { ContentType as Xi, DimensionType as Yi, PointType as Zi } from "./Archive/deprecated.js";
2
+ import { pluginFlag as Ui } from "./controller/index.js";
3
+ import { defaultGlobalConfig as Wi } from "./typings/tag/TagConfig.js";
4
+ import { ContentType as Yi, DimensionType as Zi, PointType as _i } from "./Archive/deprecated.js";
5
5
  import "three";
6
6
  import "../vendor/object-assign-deep/objectAssignDeep.js";
7
7
  import "../shared-utils/positionToVector3.js";
@@ -260,6 +260,7 @@ import "../PanoMeasurePlugin/utils/isIntersecting.js";
260
260
  import "../Sculpt/utils/three/ColoredMesh.js";
261
261
  import "../shared-utils/three/geometryUtil.js";
262
262
  import "../Sculpt/Objects/Polygon/Editor.js";
263
+ import "../Sculpt/utils/isIntersecting.js";
263
264
  import "../Sculpt/Objects/Prism/index.js";
264
265
  import "../Sculpt/Meshes/Prism.js";
265
266
  import "../shared-utils/three/core/PrismGeometry.js";
@@ -309,14 +310,14 @@ import "./Components/Common/TagPopover/ArrowRightIcon.js";
309
310
  import "./Components/Common/TagPopover/ShareIcon.js";
310
311
  import "./utils/popoverContainer.js";
311
312
  import "../shared-utils/animationFrame/BetterTween.js";
312
- const Oi = (o, t) => new r(o, t);
313
+ const Qi = (o, t) => new r(o, t);
313
314
  export {
314
- Xi as ContentType,
315
- Yi as DimensionType,
316
- Oi as PanoTagPlugin,
315
+ Yi as ContentType,
316
+ Zi as DimensionType,
317
+ Qi as PanoTagPlugin,
317
318
  r as PanoTagPluginController,
318
- Zi as PointType,
319
- Oi as default,
320
- Vi as defaultGlobalConfig,
321
- Si as pluginFlag
319
+ _i as PointType,
320
+ Qi as default,
321
+ Wi as defaultGlobalConfig,
322
+ Ui as pluginFlag
322
323
  };
@@ -30,7 +30,8 @@ const e = {
30
30
  showMore: !0,
31
31
  showShare: !0
32
32
  },
33
- viewMoreText: "查看更多"
33
+ viewMoreText: "查看更多",
34
+ showMedia: !1
34
35
  },
35
36
  tagNormalLineConfig: {
36
37
  enabled: !0,
@@ -351,6 +351,11 @@ export interface TagConfig<C extends TagContentType = TagContentType> {
351
351
  * @default '查看更多'
352
352
  */
353
353
  viewMoreText?: string;
354
+ /**
355
+ * @description 营销标签展开卡片中是否展示媒体区域(需同时提供 data.mediaData,与 popoverConfig.enabled 无关)
356
+ * @default false
357
+ */
358
+ showMedia?: boolean;
354
359
  /**
355
360
  * @description 鼠标悬停前的拦截函数,返回 true 允许 hover,false 阻止 hover
356
361
  */
@@ -109,6 +109,10 @@ export interface ContentTypeMapInterface {
109
109
  /** 单位 */
110
110
  unit: string;
111
111
  };
112
+ /** 卡片内媒体(需 config.popoverConfig.showMedia 为 true 时展示) */
113
+ mediaData?: (MediaData & {
114
+ name?: string;
115
+ })[];
112
116
  };
113
117
  /** 营销贴片 */
114
118
  MediaPlane: {
@@ -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 {};