@realsee/dnalogel 3.72.5-alpha.1 → 3.72.5-alpha.3
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/dist/PanoTagPlugin/controller/Tag/PointTag.d.ts +1 -0
- package/dist/index.cjs.js +31 -31
- package/dist/index.js +879 -873
- 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 +64 -58
- 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
|
|
5
|
-
import * as
|
|
6
|
-
import { Line as
|
|
7
|
-
import { anyPositionToVector3 as
|
|
8
|
-
import { transformPosition as
|
|
1
|
+
var D = Object.defineProperty;
|
|
2
|
+
var A = (m, a, t) => a in m ? D(m, a, { enumerable: !0, configurable: !0, writable: !0, value: t }) : m[a] = t;
|
|
3
|
+
var p = (m, a, t) => (A(m, typeof a != "symbol" ? a + "" : a, t), t);
|
|
4
|
+
import { BaseTag as w } from "./BaseTag.js";
|
|
5
|
+
import * as r from "three";
|
|
6
|
+
import { Line as V } from "@realsee/five/line";
|
|
7
|
+
import { anyPositionToVector3 as E } from "../../../shared-utils/positionToVector3.js";
|
|
8
|
+
import { transformPosition as k } 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,54 +87,55 @@ 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 u = new
|
|
91
|
-
class
|
|
90
|
+
const u = new r.Vector2();
|
|
91
|
+
class di extends w {
|
|
92
92
|
constructor(t, e) {
|
|
93
|
-
var i, o,
|
|
93
|
+
var i, o, s, n, l;
|
|
94
94
|
super(t, e);
|
|
95
|
-
|
|
96
|
-
|
|
95
|
+
p(this, "__Object__");
|
|
96
|
+
p(this, "requestIdleCallbackId");
|
|
97
97
|
// icon 与线条端点的固定像素间距
|
|
98
|
-
|
|
98
|
+
p(this, "iconPixelGap", 10);
|
|
99
99
|
// 优化:重用临时对象,避免频繁创建
|
|
100
|
-
|
|
101
|
-
lineStart: new
|
|
100
|
+
p(this, "_temp", {
|
|
101
|
+
lineStart: new r.Vector3(),
|
|
102
102
|
// 线条起点(project后会变成NDC)
|
|
103
|
-
iconPos: new
|
|
103
|
+
iconPos: new r.Vector3(),
|
|
104
104
|
// icon位置(project后会变成NDC)
|
|
105
|
-
screenDirPixel: new
|
|
105
|
+
screenDirPixel: new r.Vector2(),
|
|
106
106
|
// 屏幕方向(normalize后会变成单位向量)
|
|
107
|
-
targetNDC: new
|
|
107
|
+
targetNDC: new r.Vector2(),
|
|
108
108
|
// 目标NDC坐标
|
|
109
|
-
lineDir: new
|
|
109
|
+
lineDir: new r.Vector3(),
|
|
110
110
|
// 线条方向(计算w0时重用)
|
|
111
|
-
lineEnd: new
|
|
111
|
+
lineEnd: new r.Vector3(),
|
|
112
112
|
// 线条终点
|
|
113
|
-
raycaster: new
|
|
113
|
+
raycaster: new r.Raycaster()
|
|
114
114
|
// 射线投射器
|
|
115
115
|
});
|
|
116
|
-
//
|
|
117
|
-
|
|
116
|
+
// 用于变化检测的缓存值
|
|
117
|
+
p(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
124
|
if ((o = (i = e.style) == null ? void 0 : i.point) != null && o.width) {
|
|
124
|
-
const
|
|
125
|
-
this.iconPixelGap = e.style.point.width *
|
|
125
|
+
const h = (l = (n = (s = e.style) == null ? void 0 : s.point) == null ? void 0 : n.scale) != null ? l : 1;
|
|
126
|
+
this.iconPixelGap = e.style.point.width * h * 1.4 / 2 + 2;
|
|
126
127
|
}
|
|
127
128
|
this.initialTagLine();
|
|
128
129
|
}
|
|
129
130
|
initialTagLine() {
|
|
130
|
-
var o,
|
|
131
|
+
var o, s, n;
|
|
131
132
|
const t = this.config;
|
|
132
133
|
if (!((o = t == null ? void 0 : t.tagNormalLineConfig) != null && o.enabled) || !this.normalLineLength)
|
|
133
134
|
return;
|
|
134
135
|
const e = this.five.renderer.getSize(u), i = this.five.renderer.getPixelRatio();
|
|
135
|
-
this.tagNormalLine = new
|
|
136
|
-
color: new
|
|
137
|
-
linewidth: (
|
|
136
|
+
this.tagNormalLine = new V(new r.Vector3().fromArray(this.position), new r.Vector3().fromArray(this.originPosition)), this.tagNormalLine.points.visible = !1, this.tagNormalLine.setMaterial({
|
|
137
|
+
color: new r.Vector3(1, 1, 1),
|
|
138
|
+
linewidth: (n = (s = t == null ? void 0 : t.tagNormalLineConfig) == null ? void 0 : s.lineWidth) != null ? n : 1.2,
|
|
138
139
|
dashed: !1
|
|
139
140
|
}), this.tagNormalLine.line.material.transparent = !0, this.tagNormalLine.line.material.depthWrite = !1, this.tagNormalLine.line.material.depthTest = !1, this.tagNormalLine.line.material.dashed = !1, this.tagNormalLine.line.renderOrder = 2, this.tagNormalLine.setResolution(e.width * i, e.height * i), this.tagNormalLine.visible = !1, this.tagNormalLine.name = `tagNormalLine-${this.id}`, this.plugin.group.add(this.tagNormalLine);
|
|
140
141
|
}
|
|
@@ -178,10 +179,10 @@ class hi extends N {
|
|
|
178
179
|
setPosition(t) {
|
|
179
180
|
this.originPosition = t, this.position = (() => {
|
|
180
181
|
const e = this.plugin.workUtil.transform;
|
|
181
|
-
let i =
|
|
182
|
+
let i = k(E(t), e).toArray();
|
|
182
183
|
if (this.normal && this.normalLineLength) {
|
|
183
184
|
const o = this.computeNormal();
|
|
184
|
-
i = new
|
|
185
|
+
i = new r.Vector3().fromArray(i).clone().add(o.clone().setLength(this.normalLineLength)).toArray();
|
|
185
186
|
}
|
|
186
187
|
return i;
|
|
187
188
|
})(), this.cache.clear(), this._lastUpdateCache.position = [0, 0, 0], this.updateVisible(), this.updateScreenPosition(), this.updateZIndex(), this.plugin.addRenderQueue({ type: "TagContainerSvelte", keys: ["tags"] });
|
|
@@ -191,7 +192,7 @@ class hi extends N {
|
|
|
191
192
|
* 使用屏幕空间反投影方法,确保任意视角下都保持固定像素距离
|
|
192
193
|
*/
|
|
193
194
|
updateTagNormalLinePosition() {
|
|
194
|
-
var _, y, v, L;
|
|
195
|
+
var _, y, v, L, b, x, C;
|
|
195
196
|
if (!this.screenPosition || !this.tagNormalLine)
|
|
196
197
|
return;
|
|
197
198
|
if (!this.visible) {
|
|
@@ -200,38 +201,40 @@ class hi extends N {
|
|
|
200
201
|
}
|
|
201
202
|
const t = this._lastUpdateCache;
|
|
202
203
|
if (!(this.visible !== t.visible)) {
|
|
203
|
-
const f = Math.abs(this.position[0] - t.position[0]) > 1e-3 || Math.abs(this.position[1] - t.position[1]) > 1e-3 || Math.abs(this.position[2] - t.position[2]) > 1e-3,
|
|
204
|
-
if (!f && !
|
|
204
|
+
const f = Math.abs(this.position[0] - t.position[0]) > 1e-3 || Math.abs(this.position[1] - t.position[1]) > 1e-3 || Math.abs(this.position[2] - t.position[2]) > 1e-3, T = Math.abs(((_ = this.screenPosition.leftPx) != null ? _ : 0) - t.screenLeft) > 0.5 || Math.abs(((y = this.screenPosition.topPx) != null ? y : 0) - t.screenTop) > 0.5 || Math.abs(((v = this.screenPosition.scale) != null ? v : 1) - t.scale) > 2e-3;
|
|
205
|
+
if (!f && !T)
|
|
205
206
|
return;
|
|
206
207
|
}
|
|
207
|
-
t.position = new
|
|
208
|
+
t.position = new r.Vector3().fromArray(this.position).toArray(), t.screenLeft = (L = this.screenPosition.leftPx) != null ? L : 0, t.screenTop = (b = this.screenPosition.topPx) != null ? b : 0, t.scale = (x = this.screenPosition.scale) != null ? x : 1, t.visible = this.visible;
|
|
208
209
|
const i = this.five.renderer.getSize(u);
|
|
209
210
|
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
211
|
(this._temp.iconPos.x - this._temp.lineStart.x) * i.x / 2,
|
|
211
212
|
(this._temp.iconPos.y - this._temp.lineStart.y) * i.y / 2
|
|
212
213
|
);
|
|
213
214
|
const o = this._temp.screenDirPixel.length();
|
|
214
|
-
this._temp.screenDirPixel.normalize()
|
|
215
|
-
|
|
216
|
-
|
|
215
|
+
this._temp.screenDirPixel.normalize();
|
|
216
|
+
const s = this.iconPixelGap * ((C = this.screenPosition.scale) != null ? C : 1);
|
|
217
|
+
this._temp.targetNDC.set(
|
|
218
|
+
(this._temp.iconPos.x * i.x / 2 - this._temp.screenDirPixel.x * s) / (i.x / 2),
|
|
219
|
+
(this._temp.iconPos.y * i.y / 2 - this._temp.screenDirPixel.y * s) / (i.y / 2)
|
|
217
220
|
), this._temp.raycaster.setFromCamera(this._temp.targetNDC, this.five.camera);
|
|
218
221
|
const n = this._temp.raycaster.ray;
|
|
219
222
|
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(n.origin).sub(this._temp.lineStart);
|
|
220
|
-
const
|
|
223
|
+
const l = n.direction.dot(n.direction), h = n.direction.dot(this._temp.lineDir), c = this._temp.lineDir.dot(this._temp.lineDir), d = n.direction.dot(this._temp.lineEnd), N = this._temp.lineDir.dot(this._temp.lineEnd), g = l * c - h * h;
|
|
221
224
|
let P = 0;
|
|
222
|
-
Math.abs(g) > 1e-4 && (P = (
|
|
223
|
-
const
|
|
224
|
-
if (this._temp.lineStart.distanceTo(this._temp.lineEnd) >
|
|
225
|
-
const f = Math.max(0, 1 -
|
|
225
|
+
Math.abs(g) > 1e-4 && (P = (h * N - c * d) / g), this._temp.lineEnd.copy(n.origin).add(n.direction.multiplyScalar(Math.max(0, P)));
|
|
226
|
+
const S = this._temp.lineStart.distanceTo(this._temp.iconPos);
|
|
227
|
+
if (this._temp.lineStart.distanceTo(this._temp.lineEnd) > S) {
|
|
228
|
+
const f = Math.max(0, 1 - s / o);
|
|
226
229
|
this._temp.lineEnd.copy(this._temp.lineStart).lerp(this._temp.iconPos, f);
|
|
227
230
|
}
|
|
228
|
-
this.tagNormalLine.setPoints(this._temp.lineStart, this._temp.lineEnd), this.tagNormalLine.visible = !0
|
|
231
|
+
this.tagNormalLine.setPoints(this._temp.lineStart, this._temp.lineEnd), this.tagNormalLine.visible = !0;
|
|
229
232
|
}
|
|
230
233
|
updateScreenPosition(t) {
|
|
231
|
-
var
|
|
234
|
+
var n;
|
|
232
235
|
if (this.stickType !== "2DPoint" && this.stickType !== "3DPoint")
|
|
233
236
|
return;
|
|
234
|
-
const { force: e = !1 } = t != null ? t : {}, i = e ? this.state.visible : this.currentVisible, o = (
|
|
237
|
+
const { force: e = !1 } = t != null ? t : {}, i = e ? this.state.visible : this.currentVisible, o = (n = this.__Object__) != null ? n : {
|
|
235
238
|
timeoutId: void 0,
|
|
236
239
|
inAnimation: !1
|
|
237
240
|
};
|
|
@@ -241,26 +244,26 @@ class hi extends N {
|
|
|
241
244
|
});
|
|
242
245
|
}, 1e3)) : o.timeoutId && (clearTimeout(o.timeoutId), o.inAnimation = !1, o.timeoutId = void 0), !i && !o.inAnimation)
|
|
243
246
|
return;
|
|
244
|
-
const
|
|
245
|
-
if (
|
|
246
|
-
const
|
|
247
|
+
const s = this.computeTagProject();
|
|
248
|
+
if (s && this.five.renderer) {
|
|
249
|
+
const l = this.getDistance(void 0, 1), h = (() => {
|
|
247
250
|
if (!this.currentConfig.simulate3D)
|
|
248
251
|
return 1;
|
|
249
252
|
const d = 2 * Math.tan(0.5 * this.five.camera.fov / 180 * Math.PI);
|
|
250
|
-
return Math.max(Math.min(1 - d *
|
|
253
|
+
return Math.max(Math.min(1 - d * l / 40, 1), 0.7);
|
|
251
254
|
})(), c = this.five.renderer.getSize(u);
|
|
252
255
|
this.screenPosition = {
|
|
253
|
-
leftPx: (
|
|
254
|
-
topPx: (-
|
|
255
|
-
scale:
|
|
256
|
+
leftPx: (s.x + 1) / 2 * c.x,
|
|
257
|
+
topPx: (-s.y + 1) / 2 * c.y,
|
|
258
|
+
scale: h
|
|
256
259
|
}, this.updateTagNormalLinePosition();
|
|
257
260
|
} else
|
|
258
261
|
this.screenPosition = null;
|
|
259
262
|
this.plugin.addRenderQueue({ type: "TagContainerSvelte", keys: ["tags"] });
|
|
260
263
|
}
|
|
261
264
|
set(t, e = !0) {
|
|
262
|
-
var o,
|
|
263
|
-
super.set(t, e), (
|
|
265
|
+
var i, o, s;
|
|
266
|
+
super.set(t, e), this.normalLineLength = (s = (o = (i = t.style) == null ? void 0 : i.point) == null ? void 0 : o.normalLen) != null ? s : 0, this._lastUpdateCache.position = [0, 0, 0], this.plugin.addRenderQueue({ type: "TagContainerSvelte", keys: ["tags"] }), t.position && this.setPosition(this.position);
|
|
264
267
|
}
|
|
265
268
|
setData(...t) {
|
|
266
269
|
super.setData(...t), this.plugin.addRenderQueue({ type: "TagContainerSvelte", keys: ["tags"] });
|
|
@@ -275,7 +278,10 @@ class hi extends N {
|
|
|
275
278
|
}
|
|
276
279
|
}
|
|
277
280
|
computeNormal() {
|
|
278
|
-
return new
|
|
281
|
+
return new r.Vector3().fromArray(this.normal);
|
|
282
|
+
}
|
|
283
|
+
removeTagNormalLine() {
|
|
284
|
+
this.tagNormalLine && (this.plugin.group.remove(this.tagNormalLine), this.tagNormalLine = null);
|
|
279
285
|
}
|
|
280
286
|
/**
|
|
281
287
|
* @description 获取额外的闪烁目标,包括法线(如果有)
|
|
@@ -286,5 +292,5 @@ class hi extends N {
|
|
|
286
292
|
}
|
|
287
293
|
}
|
|
288
294
|
export {
|
|
289
|
-
|
|
295
|
+
di as PointTag
|
|
290
296
|
};
|
package/libs/base/BasePlugin.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
function A() {
|
|
2
2
|
console.debug(
|
|
3
|
-
"%c %c@realsee/dnalogel %cv3.72.5-alpha.
|
|
3
|
+
"%c %c@realsee/dnalogel %cv3.72.5-alpha.3",
|
|
4
4
|
[
|
|
5
5
|
"background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAkAAAAMCAMAAACHgmeRAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAABLFBMVEUAAAAapPoap/oaqvkbrfkbr/gZnfwZoPsaqfnD4v/E4/8Ylv0clPm93/+/4P/B4f8Yj/683/8Wif+33P8Uhv+x2f8ShP+s1v8Pgf+n0/8Nf/+h0f8Lff8Lff8Nf/9dl/+czv8KfP8KfP+Lxf+Uyv+Xy/+Hwv+Jw/+Mxf+Oxv+RyP8aovsapfoap/oZmfwZm/wZnvsYnPsYkf4YlP0NePsDYfgYcfi43f+63v8Xiv8Xjf4EWfwCV/sWZ/qz2v+02/8Vh/8WiP8EUf8CTf4WXv2u1/+v2P8Thf8Thv8ETf8CR/8VV/+o1f+q1f8Qgv8Rg/8DSv8BRf8UVP+j0v+k0v8OgP8Pgf8DR/8DQv9Nhf+dzv+fz/+Kv/+Vyv+Xy/+azf+Oxv+Qx/+SyP////8MUhLdAAAAK3RSTlMACEWQ2bd98uQECPXxqO7c+Pb49vj2+Pb49vj23Oul8fMHA+TwerXXjEIG2P+bHgAAAAFiS0dEY1y+LaoAAAB+SURBVAjXY2BgZGJmYWVgYGBgY9fW0eVg4ORi4NbTNzDk4eXjZxAwMjYxNTO3EGQQsrSytrG1sxdmEHFwdHJ2cXUTZRBz9/D08vbxFWeQ8PMPCAwKDpFkkAoNC4+IjIqWZpCRlZOPiY2LV2BQVGJQTkhMUlEFWaOmrqGpxQAAyg0S9Dq+VPYAAAAASUVORK5CYII=')",
|
|
6
6
|
"background-repeat: no-repeat",
|