@realsee/dnalogel 3.72.5-alpha.2 → 3.72.5-alpha.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.
- package/CHANGELOG.md +4 -0
- package/dist/PanoTagPlugin/controller/Tag/PointTag.d.ts +1 -0
- package/dist/Sculpt/Objects/Polygon/index.d.ts +5 -0
- package/dist/index.cjs.js +31 -31
- package/dist/index.js +893 -882
- package/dist/index.umd.js +31 -31
- package/libs/PanoTagPlugin/controller/Tag/BaseTag.js +39 -39
- package/libs/PanoTagPlugin/controller/Tag/PointTag.d.ts +1 -0
- package/libs/PanoTagPlugin/controller/Tag/PointTag.js +83 -76
- package/libs/PanoTagPlugin/controller/index.js +1 -1
- package/libs/Sculpt/Objects/Polygon/index.d.ts +5 -0
- package/libs/Sculpt/Objects/Polygon/index.js +59 -55
- package/libs/base/BasePlugin.js +1 -1
- package/libs/shared-utils/logger.js +1 -1
- package/package.json +1 -1
|
@@ -66,9 +66,9 @@ import { getTagPosition as W, getTagCenterPosition as J } from "../../utils/tagP
|
|
|
66
66
|
import { checkRange as M } from "../../utils/checkRange.js";
|
|
67
67
|
import { isMediaPlaneTag as H, isMediaModelTag as D } from "../../utils/tag/tagCheck.js";
|
|
68
68
|
import { getUrlExt as q } from "../../../shared-utils/url/getUrl.js";
|
|
69
|
-
import { getFloorIndex as
|
|
69
|
+
import { getFloorIndex as de } from "../../../shared-utils/five/getFloorIndex.js";
|
|
70
70
|
import { safeObj as X } from "../../../shared-utils/safeObj.js";
|
|
71
|
-
import { Cache as
|
|
71
|
+
import { Cache as ce } from "../../utils/Cache.js";
|
|
72
72
|
import { _raycaster as j } from "../../../shared-utils/three/temp.js";
|
|
73
73
|
import { withResolvers as ue } from "../../../shared-utils/promise/withResolvers.js";
|
|
74
74
|
import "../../../shared-utils/typescript/entries.js";
|
|
@@ -179,14 +179,14 @@ class Wi {
|
|
|
179
179
|
}
|
|
180
180
|
return i;
|
|
181
181
|
});
|
|
182
|
-
var f, p, h,
|
|
182
|
+
var f, p, h, d, c, u, v, b;
|
|
183
183
|
this.plugin = i;
|
|
184
184
|
const t = te(e);
|
|
185
185
|
e.stickType = t;
|
|
186
186
|
const o = JSON.parse(JSON.stringify(e.data)), s = (f = e.initialConfig) != null ? f : e.config ? JSON.parse(JSON.stringify(e.config)) : {};
|
|
187
187
|
e.initialConfig = s;
|
|
188
188
|
const r = F(e, i.config), l = this.getConfig(e);
|
|
189
|
-
e.config = l, this.id = (p = e.id) != null ? p : fe(), this.enabled = (h = e.enabled) != null ? h : !0, this.contentType = e.contentType, this.hoverEnabled = (
|
|
189
|
+
e.config = l, this.id = (p = e.id) != null ? p : fe(), this.enabled = (h = e.enabled) != null ? h : !0, this.contentType = e.contentType, this.hoverEnabled = (c = (d = l.popoverConfig) == null ? void 0 : d.enabled) != null ? c : !0, this.data = (u = l.initialData) != null && u.important ? x(e.data, o, l.initialData) : x(e.data, l.initialData, o);
|
|
190
190
|
let n;
|
|
191
191
|
typeof l.unfoldedConfig == "object" ? l.unfoldedConfig.keep === "unfolded" ? n = !0 : l.unfoldedConfig.keep === "folded" ? n = !1 : n = !this.can("fold") : n = !this.can("fold"), this.state = y({
|
|
192
192
|
visible: void 0,
|
|
@@ -205,7 +205,7 @@ class Wi {
|
|
|
205
205
|
})(), this.matrix = e.matrix ? (() => {
|
|
206
206
|
const g = new P.Matrix4().fromArray(e.matrix);
|
|
207
207
|
return g.premultiply(i.workUtil.transform), g.elements;
|
|
208
|
-
})() : e.matrix, this.initialConfig = s, this.computedConfig = r, this.stickType = t, this.config = e.config, this.fiveState = e.fiveState, this.normal = e.normal, this.cache = new
|
|
208
|
+
})() : e.matrix, this.initialConfig = s, this.computedConfig = r, this.stickType = t, this.config = e.config, this.fiveState = e.fiveState, this.normal = e.normal, this.cache = new ce(), this.hooks = new ie(), Object.keys(e).forEach((g) => {
|
|
209
209
|
this[g] === void 0 && e[g] !== void 0 && (this[g] = e[g]);
|
|
210
210
|
});
|
|
211
211
|
}
|
|
@@ -280,36 +280,36 @@ class Wi {
|
|
|
280
280
|
*/
|
|
281
281
|
blink(i) {
|
|
282
282
|
return B(this, null, function* () {
|
|
283
|
-
var l, n, f, p, h,
|
|
283
|
+
var l, n, f, p, h, d;
|
|
284
284
|
yield this.ready(), this._currentBlinkInstance && !this._currentBlinkInstance.completed && ((n = (l = this._currentBlinkInstance).preComplete) == null || n.call(l), this._currentBlinkInstance = void 0);
|
|
285
285
|
const e = (f = this.enabled) != null ? f : !0, t = (p = this.state) == null ? void 0 : p.visible, o = e && t;
|
|
286
|
-
o === !1 && (this.state.visible = !0, this.enabled = !0, this.applyVisible(), this.plugin.render(), this.computeRenderType() !== "Mesh" ? yield new Promise((
|
|
286
|
+
o === !1 && (this.state.visible = !0, this.enabled = !0, this.applyVisible(), this.plugin.render(), this.computeRenderType() !== "Mesh" ? yield new Promise((c) => {
|
|
287
287
|
if (this.dom || this.contentDom) {
|
|
288
|
-
|
|
288
|
+
c();
|
|
289
289
|
return;
|
|
290
290
|
}
|
|
291
291
|
const u = setInterval(() => {
|
|
292
|
-
(this.dom || this.contentDom) && (
|
|
292
|
+
(this.dom || this.contentDom) && (c(), clearInterval(u));
|
|
293
293
|
}, 16.7);
|
|
294
|
-
}) : this.stickType === "Model" && !((h = this.model) != null && h.object) ? yield (
|
|
294
|
+
}) : this.stickType === "Model" && !((h = this.model) != null && h.object) ? yield (d = this.model) == null ? void 0 : d.promise : this.stickType === "Plane" && (yield new Promise((c) => {
|
|
295
295
|
if (this.mediaPlane) {
|
|
296
|
-
|
|
296
|
+
c();
|
|
297
297
|
return;
|
|
298
298
|
}
|
|
299
299
|
const u = setInterval(() => {
|
|
300
|
-
this.mediaPlane && (
|
|
300
|
+
this.mediaPlane && (c(), clearInterval(u));
|
|
301
301
|
}, 16.7);
|
|
302
302
|
})), this.dom && (this.dom.style.visibility = "hidden"), this.contentDom && (this.contentDom.style.visibility = "hidden"));
|
|
303
303
|
const s = (() => {
|
|
304
304
|
var v, b, g;
|
|
305
|
-
const
|
|
306
|
-
|
|
305
|
+
const c = [];
|
|
306
|
+
c.push(this.dom), c.push((b = (v = this.tag3DContentSvelte) == null ? void 0 : v.css3DInstance) == null ? void 0 : b.container), c.push((g = this.model) == null ? void 0 : g.object), c.push(this.mediaPlane);
|
|
307
307
|
const u = this.getAdditionalBlinkTargets();
|
|
308
308
|
if (u) {
|
|
309
309
|
const k = Array.isArray(u) ? u : [u];
|
|
310
|
-
|
|
310
|
+
c.push(...k);
|
|
311
311
|
}
|
|
312
|
-
return
|
|
312
|
+
return c.filter(Boolean);
|
|
313
313
|
})();
|
|
314
314
|
if (!s.length) {
|
|
315
315
|
console.warn("tagDom is empty");
|
|
@@ -326,8 +326,8 @@ class Wi {
|
|
|
326
326
|
}, i));
|
|
327
327
|
try {
|
|
328
328
|
yield this._currentBlinkInstance.finished;
|
|
329
|
-
} catch (
|
|
330
|
-
console.debug("Blink animation interrupted:",
|
|
329
|
+
} catch (c) {
|
|
330
|
+
console.debug("Blink animation interrupted:", c);
|
|
331
331
|
} finally {
|
|
332
332
|
this._currentBlinkInstance = void 0;
|
|
333
333
|
}
|
|
@@ -353,14 +353,14 @@ class Wi {
|
|
|
353
353
|
* @description 启用
|
|
354
354
|
*/
|
|
355
355
|
enable() {
|
|
356
|
-
this.enabled = !0, this.hooks.emit("enable"), this.applyVisible();
|
|
356
|
+
this.enabled = !0, this.hooks.emit("enable"), this.five.needsRender = !0, this.applyVisible();
|
|
357
357
|
}
|
|
358
358
|
/**
|
|
359
359
|
* @description 禁用
|
|
360
360
|
*/
|
|
361
361
|
disable() {
|
|
362
362
|
var i;
|
|
363
|
-
this.enabled = !1, this.hooks.emit("disable"), (i = this.rectanglePlane) == null || i.delete(), this.applyVisible();
|
|
363
|
+
this.enabled = !1, this.hooks.emit("disable"), (i = this.rectanglePlane) == null || i.delete(), this.five.needsRender = !0, this.applyVisible();
|
|
364
364
|
}
|
|
365
365
|
/**
|
|
366
366
|
* @deprecated use `setData` instead
|
|
@@ -495,7 +495,7 @@ class Wi {
|
|
|
495
495
|
computeVisible(i) {
|
|
496
496
|
const e = y(y({}, this.five.getCurrentState()), i), { panoIndex: t, mode: o } = e, s = [];
|
|
497
497
|
return (() => {
|
|
498
|
-
var f, h,
|
|
498
|
+
var f, h, d, c;
|
|
499
499
|
const n = (f = this.getConfig().visibleConfig) != null ? f : {};
|
|
500
500
|
if (typeof n == "function")
|
|
501
501
|
return {
|
|
@@ -527,7 +527,7 @@ class Wi {
|
|
|
527
527
|
return {
|
|
528
528
|
value: !1,
|
|
529
529
|
checkedList: s,
|
|
530
|
-
reason: `current panoIndex is not equal to tag.panoIndex. currentPanoIndex: ${t}, tag.panoIndex: ${(
|
|
530
|
+
reason: `current panoIndex is not equal to tag.panoIndex. currentPanoIndex: ${t}, tag.panoIndex: ${(d = this.fiveState) == null ? void 0 : d.panoIndex}`
|
|
531
531
|
};
|
|
532
532
|
}
|
|
533
533
|
if (n.visibleDistance !== void 0 && (s.push("visibleDistance"), n.visibleDistance !== "unLimited")) {
|
|
@@ -548,7 +548,7 @@ class Wi {
|
|
|
548
548
|
checkedList: s,
|
|
549
549
|
reason: `intersectRaycaster check failed: panoIndex is ${t}`
|
|
550
550
|
};
|
|
551
|
-
if (t === ((
|
|
551
|
+
if (t === ((c = this.fiveState) == null ? void 0 : c.panoIndex))
|
|
552
552
|
s.push("intersectCheckSkiped");
|
|
553
553
|
else {
|
|
554
554
|
const v = this.computeVisibleByIntersect(t);
|
|
@@ -607,16 +607,16 @@ class Wi {
|
|
|
607
607
|
return { value: !1, reason: { type: "startPosition is undefined", fivePanoIndex: t } };
|
|
608
608
|
const s = se(
|
|
609
609
|
(() => {
|
|
610
|
-
var
|
|
611
|
-
const
|
|
612
|
-
return
|
|
610
|
+
var c;
|
|
611
|
+
const d = (c = e.checkPoints) != null ? c : "center";
|
|
612
|
+
return d === "center" ? J(this) : d === "corner" ? W(this) : Array.isArray(d) ? d : [];
|
|
613
613
|
})()
|
|
614
614
|
);
|
|
615
615
|
let r = 0, l = 0;
|
|
616
|
-
for (const
|
|
617
|
-
const
|
|
616
|
+
for (const d of s) {
|
|
617
|
+
const c = new P.Vector3().subVectors(d, o).normalize();
|
|
618
618
|
let u;
|
|
619
|
-
j.set(o,
|
|
619
|
+
j.set(o, c);
|
|
620
620
|
const [v] = this.fiveUtil.model.intersectRaycaster(j);
|
|
621
621
|
u = v == null ? void 0 : v.distance;
|
|
622
622
|
const b = (() => {
|
|
@@ -627,7 +627,7 @@ class Wi {
|
|
|
627
627
|
return (L = K.model) == null ? void 0 : L.object;
|
|
628
628
|
}).filter(N), [G] = j.intersectObjects(Z, !0);
|
|
629
629
|
return G;
|
|
630
|
-
})(), g = o.distanceTo(
|
|
630
|
+
})(), g = o.distanceTo(d), k = (f = e.distanceAccuracy) != null ? f : 0.01;
|
|
631
631
|
u = Math.min(u != null ? u : 1 / 0, (p = b == null ? void 0 : b.distance) != null ? p : 1 / 0), u + k >= g ? r++ : l++;
|
|
632
632
|
const I = (h = e.needPassed) != null ? h : 1;
|
|
633
633
|
if (r >= I)
|
|
@@ -647,7 +647,7 @@ class Wi {
|
|
|
647
647
|
var o, s, r, l, n, f, p;
|
|
648
648
|
let i = 0;
|
|
649
649
|
const e = (o = this.fiveState) == null ? void 0 : o.panoIndex;
|
|
650
|
-
e !== void 0 ? i = (s = this.workUtil.getObserver(e)) == null ? void 0 : s.floorIndex : i =
|
|
650
|
+
e !== void 0 ? i = (s = this.workUtil.getObserver(e)) == null ? void 0 : s.floorIndex : i = de(
|
|
651
651
|
this.workUtil.work,
|
|
652
652
|
(p = (f = (l = (r = this.model) == null ? void 0 : r.object) == null ? void 0 : l.position) != null ? f : (n = this.mediaPlane) == null ? void 0 : n.position) != null ? p : J(this)
|
|
653
653
|
);
|
|
@@ -699,8 +699,8 @@ class Wi {
|
|
|
699
699
|
const f = this.computeTagProject();
|
|
700
700
|
if (!f)
|
|
701
701
|
return !1;
|
|
702
|
-
const { x: p, y: h, z:
|
|
703
|
-
return !(Math.abs(
|
|
702
|
+
const { x: p, y: h, z: d } = f;
|
|
703
|
+
return !(Math.abs(d) > 1 || Math.abs(p) > 1 || Math.abs(h) > 1);
|
|
704
704
|
}).map((n) => ({ tag: n, id: n.id, tagConfig: n.getConfig().unfoldedConfig })).filter(({ tagConfig: n }) => {
|
|
705
705
|
var f, p;
|
|
706
706
|
return !(typeof n == "function" || n.keep || n.autoUnfold === !1 || ((f = n.autoUnfold) == null ? void 0 : f.enable) === !1 || ((p = n.autoUnfold) == null ? void 0 : p.strategy) !== "MinimumDistance");
|
|
@@ -722,19 +722,19 @@ class Wi {
|
|
|
722
722
|
var v, b;
|
|
723
723
|
if (!h.currentVisible)
|
|
724
724
|
return !1;
|
|
725
|
-
const
|
|
726
|
-
if (h.manuallyOperated || typeof
|
|
725
|
+
const d = h.getConfig().unfoldedConfig;
|
|
726
|
+
if (h.manuallyOperated || typeof d != "object" || (d == null ? void 0 : d.autoUnfold) === !1 || ((v = d == null ? void 0 : d.autoUnfold) == null ? void 0 : v.strategy) !== "ScreenCenter" || d.keep || ((b = d.autoUnfold) == null ? void 0 : b.enable) === !1 || !r.containsPoint(new P.Vector3().fromArray(h.position)))
|
|
727
727
|
return !1;
|
|
728
|
-
const u =
|
|
728
|
+
const u = d.autoUnfold.distance;
|
|
729
729
|
if (u) {
|
|
730
730
|
const g = h.getDistance();
|
|
731
731
|
if (M(g, u) === !1)
|
|
732
732
|
return !1;
|
|
733
733
|
}
|
|
734
734
|
return !0;
|
|
735
|
-
}).sort((h,
|
|
736
|
-
const
|
|
737
|
-
return l.angleTo(
|
|
735
|
+
}).sort((h, d) => {
|
|
736
|
+
const c = new P.Vector3().fromArray(h.position), u = new P.Vector3().fromArray(d.position);
|
|
737
|
+
return l.angleTo(c.sub(this.five.camera.position)) - l.angleTo(u.sub(this.five.camera.position));
|
|
738
738
|
}).findIndex((h) => h.id === this.id);
|
|
739
739
|
if (f === -1 || f <= ((t = i.autoUnfold.maxNumber) != null ? t : 1) - 1 === !1)
|
|
740
740
|
return !1;
|
|
@@ -38,6 +38,7 @@ export declare class PointTag<C extends TagContentType = TagContentType> extends
|
|
|
38
38
|
setData(...data: Parameters<InstanceType<typeof BaseTag<C, '2DPoint' | '3DPoint'>>['setData']>): void;
|
|
39
39
|
updateUnfoldedByPanoIndex(): void;
|
|
40
40
|
computeNormal(): THREE.Vector3;
|
|
41
|
+
removeTagNormalLine(): void;
|
|
41
42
|
/**
|
|
42
43
|
* @description 获取额外的闪烁目标,包括法线(如果有)
|
|
43
44
|
*/
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { BaseTag as
|
|
1
|
+
var w = Object.defineProperty;
|
|
2
|
+
var E = (m, l, t) => l in m ? w(m, l, { enumerable: !0, configurable: !0, writable: !0, value: t }) : m[l] = t;
|
|
3
|
+
var c = (m, l, t) => (E(m, typeof l != "symbol" ? l + "" : l, t), t);
|
|
4
|
+
import { BaseTag as k } from "./BaseTag.js";
|
|
5
5
|
import * as n from "three";
|
|
6
|
-
import { Line as
|
|
7
|
-
import { anyPositionToVector3 as
|
|
8
|
-
import { transformPosition as
|
|
6
|
+
import { Line as I } from "@realsee/five/line";
|
|
7
|
+
import { anyPositionToVector3 as M } from "../../../shared-utils/positionToVector3.js";
|
|
8
|
+
import { transformPosition as R } from "../../../shared-utils/five/transformPosition.js";
|
|
9
9
|
import "../../../shared-utils/Subscribe.js";
|
|
10
10
|
import "../../utils/tag/calculateTagConfig.js";
|
|
11
11
|
import "../../../vendor/object-assign-deep/objectAssignDeep.js";
|
|
@@ -87,17 +87,17 @@ import "../../../shared-utils/five/getFloorIndex.js";
|
|
|
87
87
|
import "../../../shared-utils/safeObj.js";
|
|
88
88
|
import "../../utils/Cache.js";
|
|
89
89
|
import "../../../shared-utils/promise/withResolvers.js";
|
|
90
|
-
const
|
|
91
|
-
class
|
|
90
|
+
const g = new n.Vector2();
|
|
91
|
+
class gi extends k {
|
|
92
92
|
constructor(t, e) {
|
|
93
|
-
var i,
|
|
93
|
+
var o, i, r, s, h;
|
|
94
94
|
super(t, e);
|
|
95
|
-
|
|
96
|
-
|
|
95
|
+
c(this, "__Object__");
|
|
96
|
+
c(this, "requestIdleCallbackId");
|
|
97
97
|
// icon 与线条端点的固定像素间距
|
|
98
|
-
|
|
98
|
+
c(this, "iconPixelGap", 10);
|
|
99
99
|
// 优化:重用临时对象,避免频繁创建
|
|
100
|
-
|
|
100
|
+
c(this, "_temp", {
|
|
101
101
|
lineStart: new n.Vector3(),
|
|
102
102
|
// 线条起点(project后会变成NDC)
|
|
103
103
|
iconPos: new n.Vector3(),
|
|
@@ -113,30 +113,31 @@ class pi extends N {
|
|
|
113
113
|
raycaster: new n.Raycaster()
|
|
114
114
|
// 射线投射器
|
|
115
115
|
});
|
|
116
|
-
//
|
|
117
|
-
|
|
116
|
+
// 用于变化检测的缓存值
|
|
117
|
+
c(this, "_lastUpdateCache", {
|
|
118
118
|
position: [0, 0, 0],
|
|
119
119
|
screenLeft: 0,
|
|
120
120
|
screenTop: 0,
|
|
121
|
+
scale: 1,
|
|
121
122
|
visible: !1
|
|
122
123
|
});
|
|
123
|
-
if ((
|
|
124
|
-
const
|
|
125
|
-
this.iconPixelGap = e.style.point.width *
|
|
124
|
+
if ((i = (o = e.style) == null ? void 0 : o.point) != null && i.width) {
|
|
125
|
+
const p = (h = (s = (r = e.style) == null ? void 0 : r.point) == null ? void 0 : s.scale) != null ? h : 1;
|
|
126
|
+
this.iconPixelGap = e.style.point.width * p * 1.4 / 2 + 2;
|
|
126
127
|
}
|
|
127
|
-
this.initialTagLine();
|
|
128
|
+
e.contentType === "Audio" && (this.iconPixelGap = 34 / 2 + 2), this.initialTagLine();
|
|
128
129
|
}
|
|
129
130
|
initialTagLine() {
|
|
130
|
-
var
|
|
131
|
+
var i, r, s;
|
|
131
132
|
const t = this.config;
|
|
132
|
-
if (!((
|
|
133
|
+
if (!((i = t == null ? void 0 : t.tagNormalLineConfig) != null && i.enabled) || !this.normalLineLength)
|
|
133
134
|
return;
|
|
134
|
-
const e = this.five.renderer.getSize(
|
|
135
|
-
this.tagNormalLine = new
|
|
135
|
+
const e = this.five.renderer.getSize(g), o = this.five.renderer.getPixelRatio();
|
|
136
|
+
this.tagNormalLine = new I(new n.Vector3().fromArray(this.position), new n.Vector3().fromArray(this.originPosition)), this.tagNormalLine.points.visible = !1, this.tagNormalLine.setMaterial({
|
|
136
137
|
color: new n.Vector3(1, 1, 1),
|
|
137
|
-
linewidth: (
|
|
138
|
+
linewidth: (s = (r = t == null ? void 0 : t.tagNormalLineConfig) == null ? void 0 : r.lineWidth) != null ? s : 1.2,
|
|
138
139
|
dashed: !1
|
|
139
|
-
}), this.tagNormalLine.line.material.transparent = !0, this.tagNormalLine.line.material.depthWrite = !1, this.tagNormalLine.line.material.depthTest = !
|
|
140
|
+
}), this.tagNormalLine.line.material.transparent = !0, this.tagNormalLine.line.material.depthWrite = !1, this.tagNormalLine.line.material.depthTest = !0, this.tagNormalLine.line.material.dashed = !1, this.tagNormalLine.line.renderOrder = 2, this.tagNormalLine.setResolution(e.width * o, e.height * o), this.tagNormalLine.visible = !1, this.tagNormalLine.name = `tagNormalLine-${this.id}`, this.plugin.group.add(this.tagNormalLine);
|
|
140
141
|
}
|
|
141
142
|
/**
|
|
142
143
|
* @description 展开自己,收起其他标签
|
|
@@ -145,8 +146,8 @@ class pi extends N {
|
|
|
145
146
|
if (this.isPopoverConfigEnabled())
|
|
146
147
|
return;
|
|
147
148
|
const t = this.can("fold"), e = this.can("unfold");
|
|
148
|
-
t && e && (this.state.unfolded = !this.state.unfolded, this.manuallyOperated = !0, this.plugin.addRenderQueue({ type: "TagContainerSvelte", keys: ["tags"] }), this.state.unfolded && this.plugin.tags.forEach((
|
|
149
|
-
|
|
149
|
+
t && e && (this.state.unfolded = !this.state.unfolded, this.manuallyOperated = !0, this.plugin.addRenderQueue({ type: "TagContainerSvelte", keys: ["tags"] }), this.state.unfolded && this.plugin.tags.forEach((o) => {
|
|
150
|
+
o.id !== this.id && o.fold();
|
|
150
151
|
}));
|
|
151
152
|
}
|
|
152
153
|
onClick(t) {
|
|
@@ -172,95 +173,98 @@ class pi extends N {
|
|
|
172
173
|
setUnfold(t) {
|
|
173
174
|
if (this.isPopoverConfigEnabled())
|
|
174
175
|
return;
|
|
175
|
-
const e = this.can("fold"),
|
|
176
|
-
e &&
|
|
176
|
+
const e = this.can("fold"), o = this.can("unfold");
|
|
177
|
+
e && o && (this.state.unfolded = t, this.hooks.emit(t ? "unfolded" : "folded"), this.plugin.addRenderQueue({ type: "TagContainerSvelte", keys: ["tags"] }));
|
|
177
178
|
}
|
|
178
179
|
setPosition(t) {
|
|
179
180
|
this.originPosition = t, this.position = (() => {
|
|
180
181
|
const e = this.plugin.workUtil.transform;
|
|
181
|
-
let
|
|
182
|
+
let o = R(M(t), e).toArray();
|
|
182
183
|
if (this.normal && this.normalLineLength) {
|
|
183
|
-
const
|
|
184
|
-
|
|
184
|
+
const i = this.computeNormal();
|
|
185
|
+
o = new n.Vector3().fromArray(o).clone().add(i.clone().setLength(this.normalLineLength)).toArray();
|
|
185
186
|
}
|
|
186
|
-
return
|
|
187
|
+
return o;
|
|
187
188
|
})(), this.cache.clear(), this._lastUpdateCache.position = [0, 0, 0], this.updateVisible(), this.updateScreenPosition(), this.updateZIndex(), this.plugin.addRenderQueue({ type: "TagContainerSvelte", keys: ["tags"] });
|
|
188
189
|
}
|
|
189
190
|
/**
|
|
190
191
|
* 更新标签连线的位置,使其端点与icon保持固定像素距离
|
|
191
192
|
* 使用屏幕空间反投影方法,确保任意视角下都保持固定像素距离
|
|
192
193
|
*/
|
|
193
|
-
updateTagNormalLinePosition() {
|
|
194
|
-
var
|
|
194
|
+
updateTagNormalLinePosition(t) {
|
|
195
|
+
var v, b, L, x, C, N, S;
|
|
195
196
|
if (!this.screenPosition || !this.tagNormalLine)
|
|
196
197
|
return;
|
|
197
|
-
|
|
198
|
+
const { force: e = !1 } = t != null ? t : {};
|
|
199
|
+
if (!(e ? this.state.visible : this.currentVisible)) {
|
|
198
200
|
this.tagNormalLine.visible = !1;
|
|
199
201
|
return;
|
|
200
202
|
}
|
|
201
|
-
const
|
|
202
|
-
if (!(this.visible !==
|
|
203
|
-
const
|
|
204
|
-
if (!
|
|
203
|
+
const i = this._lastUpdateCache;
|
|
204
|
+
if (!(this.visible !== i.visible)) {
|
|
205
|
+
const u = Math.abs(this.position[0] - i.position[0]) > 1e-3 || Math.abs(this.position[1] - i.position[1]) > 1e-3 || Math.abs(this.position[2] - i.position[2]) > 1e-3, V = Math.abs(((v = this.screenPosition.leftPx) != null ? v : 0) - i.screenLeft) > 0.5 || Math.abs(((b = this.screenPosition.topPx) != null ? b : 0) - i.screenTop) > 0.5 || Math.abs(((L = this.screenPosition.scale) != null ? L : 1) - i.scale) > 2e-3;
|
|
206
|
+
if (!u && !V)
|
|
205
207
|
return;
|
|
206
208
|
}
|
|
207
|
-
|
|
208
|
-
const
|
|
209
|
+
i.position = new n.Vector3().fromArray(this.position).toArray(), i.screenLeft = (x = this.screenPosition.leftPx) != null ? x : 0, i.screenTop = (C = this.screenPosition.topPx) != null ? C : 0, i.scale = (N = this.screenPosition.scale) != null ? N : 1, i.visible = this.visible;
|
|
210
|
+
const s = this.five.renderer.getSize(g);
|
|
209
211
|
this._temp.lineStart.fromArray(this.originPosition), this._temp.iconPos.fromArray(this.position), this._temp.lineStart.project(this.five.camera), this._temp.iconPos.project(this.five.camera), this._temp.screenDirPixel.set(
|
|
210
|
-
(this._temp.iconPos.x - this._temp.lineStart.x) *
|
|
211
|
-
(this._temp.iconPos.y - this._temp.lineStart.y) *
|
|
212
|
+
(this._temp.iconPos.x - this._temp.lineStart.x) * s.x / 2,
|
|
213
|
+
(this._temp.iconPos.y - this._temp.lineStart.y) * s.y / 2
|
|
212
214
|
);
|
|
213
|
-
const
|
|
214
|
-
this._temp.screenDirPixel.normalize()
|
|
215
|
-
|
|
216
|
-
|
|
215
|
+
const h = this._temp.screenDirPixel.length();
|
|
216
|
+
this._temp.screenDirPixel.normalize();
|
|
217
|
+
const p = this.iconPixelGap * ((S = this.screenPosition.scale) != null ? S : 1);
|
|
218
|
+
this._temp.targetNDC.set(
|
|
219
|
+
(this._temp.iconPos.x * s.x / 2 - this._temp.screenDirPixel.x * p) / (s.x / 2),
|
|
220
|
+
(this._temp.iconPos.y * s.y / 2 - this._temp.screenDirPixel.y * p) / (s.y / 2)
|
|
217
221
|
), this._temp.raycaster.setFromCamera(this._temp.targetNDC, this.five.camera);
|
|
218
|
-
const
|
|
219
|
-
this._temp.lineStart.fromArray(this.originPosition), this._temp.iconPos.fromArray(this.position), this._temp.lineDir.copy(this._temp.iconPos).sub(this._temp.lineStart).normalize(), this._temp.lineEnd.copy(
|
|
220
|
-
const
|
|
221
|
-
let
|
|
222
|
-
Math.abs(
|
|
223
|
-
const
|
|
224
|
-
if (this._temp.lineStart.distanceTo(this._temp.lineEnd) >
|
|
225
|
-
const
|
|
226
|
-
this._temp.lineEnd.copy(this._temp.lineStart).lerp(this._temp.iconPos,
|
|
222
|
+
const a = this._temp.raycaster.ray;
|
|
223
|
+
this._temp.lineStart.fromArray(this.originPosition), this._temp.iconPos.fromArray(this.position), this._temp.lineDir.copy(this._temp.iconPos).sub(this._temp.lineStart).normalize(), this._temp.lineEnd.copy(a.origin).sub(this._temp.lineStart);
|
|
224
|
+
const d = a.direction.dot(a.direction), f = a.direction.dot(this._temp.lineDir), P = this._temp.lineDir.dot(this._temp.lineDir), T = a.direction.dot(this._temp.lineEnd), D = this._temp.lineDir.dot(this._temp.lineEnd), _ = d * P - f * f;
|
|
225
|
+
let y = 0;
|
|
226
|
+
Math.abs(_) > 1e-4 && (y = (f * D - P * T) / _), this._temp.lineEnd.copy(a.origin).add(a.direction.multiplyScalar(Math.max(0, y)));
|
|
227
|
+
const A = this._temp.lineStart.distanceTo(this._temp.iconPos);
|
|
228
|
+
if (this._temp.lineStart.distanceTo(this._temp.lineEnd) > A) {
|
|
229
|
+
const u = Math.max(0, 1 - p / h);
|
|
230
|
+
this._temp.lineEnd.copy(this._temp.lineStart).lerp(this._temp.iconPos, u);
|
|
227
231
|
}
|
|
228
|
-
this.tagNormalLine.setPoints(this._temp.lineStart, this._temp.lineEnd), this.tagNormalLine.visible = !0
|
|
232
|
+
this.tagNormalLine.setPoints(this._temp.lineStart, this._temp.lineEnd), this.tagNormalLine.visible = !0;
|
|
229
233
|
}
|
|
230
234
|
updateScreenPosition(t) {
|
|
231
|
-
var
|
|
235
|
+
var s;
|
|
232
236
|
if (this.stickType !== "2DPoint" && this.stickType !== "3DPoint")
|
|
233
237
|
return;
|
|
234
|
-
const { force: e = !1 } = t != null ? t : {},
|
|
238
|
+
const { force: e = !1 } = t != null ? t : {}, o = e ? this.state.visible : this.currentVisible, i = (s = this.__Object__) != null ? s : {
|
|
235
239
|
timeoutId: void 0,
|
|
236
240
|
inAnimation: !1
|
|
237
241
|
};
|
|
238
|
-
if (this.__Object__ =
|
|
242
|
+
if (this.__Object__ = i, !o && this.screenPosition ? (i.inAnimation = !0, i.timeoutId = setTimeout(() => {
|
|
239
243
|
requestAnimationFrame(() => {
|
|
240
|
-
this.currentVisible || (
|
|
244
|
+
this.currentVisible || (i.inAnimation = !1, this.screenPosition = null, this.plugin.addRenderQueue({ type: "TagContainerSvelte", keys: ["tags"] }));
|
|
241
245
|
});
|
|
242
|
-
}, 1e3)) :
|
|
246
|
+
}, 1e3)) : i.timeoutId && (clearTimeout(i.timeoutId), i.inAnimation = !1, i.timeoutId = void 0), !o && !i.inAnimation)
|
|
243
247
|
return;
|
|
244
|
-
const
|
|
245
|
-
if (
|
|
246
|
-
const
|
|
248
|
+
const r = this.computeTagProject();
|
|
249
|
+
if (r && this.five.renderer) {
|
|
250
|
+
const h = this.getDistance(void 0, 1), p = (() => {
|
|
247
251
|
if (!this.currentConfig.simulate3D)
|
|
248
252
|
return 1;
|
|
249
253
|
const d = 2 * Math.tan(0.5 * this.five.camera.fov / 180 * Math.PI);
|
|
250
|
-
return Math.max(Math.min(1 - d *
|
|
251
|
-
})(),
|
|
254
|
+
return Math.max(Math.min(1 - d * h / 40, 1), 0.7);
|
|
255
|
+
})(), a = this.five.renderer.getSize(g);
|
|
252
256
|
this.screenPosition = {
|
|
253
|
-
leftPx: (
|
|
254
|
-
topPx: (-
|
|
255
|
-
scale:
|
|
256
|
-
}, this.updateTagNormalLinePosition();
|
|
257
|
+
leftPx: (r.x + 1) / 2 * a.x,
|
|
258
|
+
topPx: (-r.y + 1) / 2 * a.y,
|
|
259
|
+
scale: p
|
|
260
|
+
}, this.updateTagNormalLinePosition({ force: t == null ? void 0 : t.force });
|
|
257
261
|
} else
|
|
258
262
|
this.screenPosition = null;
|
|
259
263
|
this.plugin.addRenderQueue({ type: "TagContainerSvelte", keys: ["tags"] });
|
|
260
264
|
}
|
|
261
265
|
set(t, e = !0) {
|
|
262
|
-
var
|
|
263
|
-
super.set(t, e), this.normalLineLength = (
|
|
266
|
+
var o, i, r;
|
|
267
|
+
super.set(t, e), this.normalLineLength = (r = (i = (o = t.style) == null ? void 0 : o.point) == null ? void 0 : i.normalLen) != null ? r : 0, this._lastUpdateCache.position = [0, 0, 0], this.plugin.addRenderQueue({ type: "TagContainerSvelte", keys: ["tags"] }), t.position && this.setPosition(this.position);
|
|
264
268
|
}
|
|
265
269
|
setData(...t) {
|
|
266
270
|
super.setData(...t), this.plugin.addRenderQueue({ type: "TagContainerSvelte", keys: ["tags"] });
|
|
@@ -277,6 +281,9 @@ class pi extends N {
|
|
|
277
281
|
computeNormal() {
|
|
278
282
|
return new n.Vector3().fromArray(this.normal);
|
|
279
283
|
}
|
|
284
|
+
removeTagNormalLine() {
|
|
285
|
+
this.tagNormalLine && (this.plugin.group.remove(this.tagNormalLine), this.tagNormalLine = null);
|
|
286
|
+
}
|
|
280
287
|
/**
|
|
281
288
|
* @description 获取额外的闪烁目标,包括法线(如果有)
|
|
282
289
|
*/
|
|
@@ -286,5 +293,5 @@ class pi extends N {
|
|
|
286
293
|
}
|
|
287
294
|
}
|
|
288
295
|
export {
|
|
289
|
-
|
|
296
|
+
gi as PointTag
|
|
290
297
|
};
|
|
@@ -678,7 +678,7 @@ class _s extends R {
|
|
|
678
678
|
var e;
|
|
679
679
|
this.tags.length && (this.tags.forEach((t) => {
|
|
680
680
|
var i, o, n, s, r, a;
|
|
681
|
-
(i = t.tag3DContentSvelte) == null || i.dispose(), (n = (o = t.mediaPlane) == null ? void 0 : o.parent) == null || n.remove(t.mediaPlane), (a = (r = (s = t.model) == null ? void 0 : s.object) == null ? void 0 : r.parent) == null || a.remove(t.model.object);
|
|
681
|
+
(i = t.tag3DContentSvelte) == null || i.dispose(), (n = (o = t.mediaPlane) == null ? void 0 : o.parent) == null || n.remove(t.mediaPlane), (a = (r = (s = t.model) == null ? void 0 : s.object) == null ? void 0 : r.parent) == null || a.remove(t.model.object), this.group.remove(t.tagNormalLine);
|
|
682
682
|
}), this.tags = [], this.tagsLengthWillUpdate = !0, this.hooks.emit("tagsLengthChange"), (e = this.TagContainerSvelte) == null || e.$destroy(), this.TagContainerSvelte = void 0, this.disposeAllCSS3DContainer()), this.enabledModelTagSet.clear(), this.cache.clear();
|
|
683
683
|
}
|
|
684
684
|
/**
|
|
@@ -14,6 +14,11 @@ export type PolygonCreateConfig = Partial<PolygonStyle & CreateLimitConfig & Pol
|
|
|
14
14
|
onPointPlaced?: (points: THREE.Vector3[]) => void;
|
|
15
15
|
onUndo?: () => void;
|
|
16
16
|
onRedo?: () => void;
|
|
17
|
+
/**
|
|
18
|
+
* @description 检测是否自相交,如果自交,禁止添加下一个点
|
|
19
|
+
* @default false
|
|
20
|
+
*/
|
|
21
|
+
experimental_self_intersect_check?: boolean;
|
|
17
22
|
};
|
|
18
23
|
export declare class Polygon extends BaseObject<PolygonImportData> {
|
|
19
24
|
readonly type = "Polygon";
|