@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.
- package/CHANGELOG.md +4 -0
- package/dist/PanoTagPlugin/typings/tag/TagConfig.d.ts +5 -0
- package/dist/PanoTagPlugin/typings/tag/TagData.d.ts +4 -0
- package/dist/Sculpt/utils/isIntersecting.d.ts +17 -0
- package/dist/index.cjs.js +83 -83
- package/dist/index.js +8685 -8564
- package/dist/index.umd.js +74 -74
- package/libs/CruisePlugin/Move.js +3 -2
- package/libs/CruisePlugin/Work.js +3 -2
- package/libs/CruisePlugin/index.js +7 -6
- package/libs/GuideLinePlugin/Controller.js +5 -4
- package/libs/GuideLinePlugin/GuideLineItem.js +3 -2
- package/libs/GuideLinePlugin/GuideLineModeItem.js +3 -2
- package/libs/GuideLinePlugin/index.js +7 -6
- package/libs/PanoTagPlugin/Components/Tag/MarketingTag.js +300 -243
- package/libs/PanoTagPlugin/controller/Tag/BoxTag.js +21 -20
- package/libs/PanoTagPlugin/controller/Tag/PlaneTag.js +3 -2
- package/libs/PanoTagPlugin/controller/Tag/PolygonTag.js +3 -2
- package/libs/PanoTagPlugin/controller/index.js +6 -5
- package/libs/PanoTagPlugin/index.js +12 -11
- package/libs/PanoTagPlugin/tag.config.js +2 -1
- package/libs/PanoTagPlugin/typings/tag/TagConfig.d.ts +5 -0
- package/libs/PanoTagPlugin/typings/tag/TagData.d.ts +4 -0
- package/libs/Sculpt/Objects/Polygon/index.js +100 -99
- package/libs/Sculpt/utils/isIntersecting.d.ts +17 -0
- package/libs/Sculpt/utils/isIntersecting.js +68 -0
- package/libs/base/BasePlugin.js +5 -5
- package/libs/index.js +159 -158
- package/libs/shared-utils/logger.js +1 -1
- package/package.json +1 -1
|
@@ -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,
|
|
5
|
-
for (var t in
|
|
6
|
-
E.call(
|
|
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(
|
|
9
|
-
B.call(
|
|
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,
|
|
13
|
-
var g = (a,
|
|
14
|
-
var e = (
|
|
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(
|
|
16
|
+
l(t.next(n));
|
|
17
17
|
} catch (h) {
|
|
18
18
|
o(h);
|
|
19
19
|
}
|
|
20
|
-
}, s = (
|
|
20
|
+
}, s = (n) => {
|
|
21
21
|
try {
|
|
22
|
-
l(t.throw(
|
|
22
|
+
l(t.throw(n));
|
|
23
23
|
} catch (h) {
|
|
24
24
|
o(h);
|
|
25
25
|
}
|
|
26
|
-
}, l = (
|
|
27
|
-
l((t = t.apply(a,
|
|
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,
|
|
265
|
-
return x(
|
|
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),
|
|
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(
|
|
404
|
+
const C = V.clone().multiply(c).applyMatrix4(n).add(s);
|
|
404
405
|
return x(C, m);
|
|
405
|
-
}), w = d.clone().multiply(c).applyMatrix4(
|
|
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
|
-
],
|
|
470
|
+
], n = new r.Vector3().addVectors(o, e).multiplyScalar(0.5), h = this.workUtil.transform;
|
|
470
471
|
l.forEach((m) => {
|
|
471
|
-
m.sub(
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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",
|
|
339
|
-
class
|
|
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
|
-
|
|
921
|
-
|
|
922
|
-
|
|
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
|
|
3
|
-
import { defaultGlobalConfig as
|
|
4
|
-
import { ContentType as
|
|
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
|
|
313
|
+
const Qi = (o, t) => new r(o, t);
|
|
313
314
|
export {
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
315
|
+
Yi as ContentType,
|
|
316
|
+
Zi as DimensionType,
|
|
317
|
+
Qi as PanoTagPlugin,
|
|
317
318
|
r as PanoTagPluginController,
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
319
|
+
_i as PointType,
|
|
320
|
+
Qi as default,
|
|
321
|
+
Wi as defaultGlobalConfig,
|
|
322
|
+
Ui as pluginFlag
|
|
322
323
|
};
|
|
@@ -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
|
*/
|
|
@@ -1,45 +1,46 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
1
|
+
var Pt = Object.defineProperty, yt = Object.defineProperties;
|
|
2
|
+
var mt = Object.getOwnPropertyDescriptors;
|
|
3
3
|
var it = Object.getOwnPropertySymbols;
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
for (var t in
|
|
7
|
-
|
|
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(
|
|
10
|
-
|
|
11
|
-
return
|
|
12
|
-
}, R = (
|
|
13
|
-
var C = (
|
|
14
|
-
var ot = (
|
|
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
|
-
|
|
19
|
+
n(u);
|
|
20
20
|
}
|
|
21
21
|
}, a = (c) => {
|
|
22
22
|
try {
|
|
23
23
|
w(t.throw(c));
|
|
24
24
|
} catch (u) {
|
|
25
|
-
|
|
25
|
+
n(u);
|
|
26
26
|
}
|
|
27
|
-
}, w = (c) => c.done ?
|
|
28
|
-
w((t = t.apply(
|
|
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
|
|
31
|
-
import * as
|
|
32
|
-
import { PolylineMesh as
|
|
33
|
-
import { AreaMesh as
|
|
34
|
-
import { PolygonEditor as
|
|
35
|
-
import { vector3ToArray as
|
|
36
|
-
import { withResolvers as
|
|
37
|
-
import { anyPositionToVector3 as
|
|
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
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
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
|
|
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
|
|
55
|
+
return this._editor || (this._editor = new Ct(this)), this._editor;
|
|
55
56
|
}
|
|
56
57
|
updateCreationPointMeshes() {
|
|
57
|
-
var
|
|
58
|
-
const t = (
|
|
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(
|
|
63
|
-
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(
|
|
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
|
|
84
|
-
return this.creatingObject ? (x = (
|
|
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,
|
|
88
|
-
return this.creatingObject ? (
|
|
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,
|
|
92
|
+
var t, r;
|
|
92
93
|
if (this.creatingObject)
|
|
93
|
-
return (
|
|
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
|
|
97
|
-
this.restoreSnapshot(
|
|
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,
|
|
103
|
+
var t, r;
|
|
103
104
|
if (this.creatingObject)
|
|
104
|
-
return (
|
|
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
|
|
108
|
-
this.restoreSnapshot(
|
|
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((
|
|
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((
|
|
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
|
|
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
|
|
136
|
-
this.areaMesh =
|
|
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(
|
|
141
|
-
var
|
|
142
|
-
const { promise:
|
|
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 = (
|
|
148
|
-
|
|
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
|
|
152
|
+
const P = new rt(s.style);
|
|
152
153
|
a == null || a.add(P);
|
|
153
|
-
const y = new
|
|
154
|
+
const y = new rt(R(_({}, s.style), { dashed: !0, lengthEnable: !1 }));
|
|
154
155
|
a == null || a.add(y);
|
|
155
|
-
let
|
|
156
|
-
const
|
|
157
|
-
|
|
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
|
-
|
|
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 =
|
|
169
|
-
|
|
170
|
-
var S,
|
|
171
|
-
const b = new Ht(R(
|
|
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 = (
|
|
177
|
-
}),
|
|
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
|
-
|
|
181
|
+
j.forEach((i) => {
|
|
181
182
|
var d;
|
|
182
183
|
return (d = i.parent) == null ? void 0 : d.remove(i);
|
|
183
|
-
}),
|
|
184
|
+
}), j = [], s.userData && (delete s.userData.creationPointMeshes, delete s.userData.syncCreationPointMeshes, delete s.userData.disposeCreationPointMeshes);
|
|
184
185
|
}
|
|
185
|
-
|
|
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,
|
|
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),
|
|
191
|
-
},
|
|
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
|
-
|
|
194
|
-
},
|
|
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),
|
|
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
|
-
|
|
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 && (
|
|
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([]),
|
|
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
|
|
218
|
-
c ? l = i.point.clone().setY(M) : l =
|
|
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,
|
|
224
|
-
const st =
|
|
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)) *
|
|
228
|
+
y: (1 - (st.y * 0.5 + 0.5)) * I
|
|
228
229
|
};
|
|
229
|
-
},
|
|
230
|
-
(
|
|
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),
|
|
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 ? (
|
|
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(
|
|
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
|
|
243
|
-
finished:
|
|
243
|
+
return e.on("select", F), e.on("intersectionUpdate", O), e.on("disable", N), {
|
|
244
|
+
finished: r,
|
|
244
245
|
canUndo: z,
|
|
245
|
-
canRedo:
|
|
246
|
-
undo:
|
|
247
|
-
redo:
|
|
246
|
+
canRedo: q,
|
|
247
|
+
undo: ht,
|
|
248
|
+
redo: dt
|
|
248
249
|
};
|
|
249
250
|
}
|
|
250
251
|
export {
|
|
251
|
-
|
|
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 {};
|