@realsee/dnalogel 3.72.5-alpha.1 → 3.72.5-alpha.2
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,8 +1,8 @@
|
|
|
1
1
|
var C = Object.defineProperty;
|
|
2
|
-
var S = (
|
|
3
|
-
var m = (
|
|
2
|
+
var S = (p, l, t) => l in p ? C(p, l, { enumerable: !0, configurable: !0, writable: !0, value: t }) : p[l] = t;
|
|
3
|
+
var m = (p, l, t) => (S(p, typeof l != "symbol" ? l + "" : l, t), t);
|
|
4
4
|
import { BaseTag as N } from "./BaseTag.js";
|
|
5
|
-
import * as
|
|
5
|
+
import * as n from "three";
|
|
6
6
|
import { Line as T } from "@realsee/five/line";
|
|
7
7
|
import { anyPositionToVector3 as D } from "../../../shared-utils/positionToVector3.js";
|
|
8
8
|
import { transformPosition as A } from "../../../shared-utils/five/transformPosition.js";
|
|
@@ -87,10 +87,10 @@ 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 n.Vector2();
|
|
91
|
+
class pi extends N {
|
|
92
92
|
constructor(t, e) {
|
|
93
|
-
var i, o,
|
|
93
|
+
var i, o, s, r, a;
|
|
94
94
|
super(t, e);
|
|
95
95
|
m(this, "__Object__");
|
|
96
96
|
m(this, "requestIdleCallbackId");
|
|
@@ -98,19 +98,19 @@ class hi extends N {
|
|
|
98
98
|
m(this, "iconPixelGap", 10);
|
|
99
99
|
// 优化:重用临时对象,避免频繁创建
|
|
100
100
|
m(this, "_temp", {
|
|
101
|
-
lineStart: new
|
|
101
|
+
lineStart: new n.Vector3(),
|
|
102
102
|
// 线条起点(project后会变成NDC)
|
|
103
|
-
iconPos: new
|
|
103
|
+
iconPos: new n.Vector3(),
|
|
104
104
|
// icon位置(project后会变成NDC)
|
|
105
|
-
screenDirPixel: new
|
|
105
|
+
screenDirPixel: new n.Vector2(),
|
|
106
106
|
// 屏幕方向(normalize后会变成单位向量)
|
|
107
|
-
targetNDC: new
|
|
107
|
+
targetNDC: new n.Vector2(),
|
|
108
108
|
// 目标NDC坐标
|
|
109
|
-
lineDir: new
|
|
109
|
+
lineDir: new n.Vector3(),
|
|
110
110
|
// 线条方向(计算w0时重用)
|
|
111
|
-
lineEnd: new
|
|
111
|
+
lineEnd: new n.Vector3(),
|
|
112
112
|
// 线条终点
|
|
113
|
-
raycaster: new
|
|
113
|
+
raycaster: new n.Raycaster()
|
|
114
114
|
// 射线投射器
|
|
115
115
|
});
|
|
116
116
|
// 用于变化检测的缓存值(position不需要缓存,因为它基于originPosition计算)
|
|
@@ -121,20 +121,20 @@ class hi extends N {
|
|
|
121
121
|
visible: !1
|
|
122
122
|
});
|
|
123
123
|
if ((o = (i = e.style) == null ? void 0 : i.point) != null && o.width) {
|
|
124
|
-
const
|
|
125
|
-
this.iconPixelGap = e.style.point.width *
|
|
124
|
+
const h = (a = (r = (s = e.style) == null ? void 0 : s.point) == null ? void 0 : r.scale) != null ? a : 1;
|
|
125
|
+
this.iconPixelGap = e.style.point.width * h * 1.4 / 2 + 2;
|
|
126
126
|
}
|
|
127
127
|
this.initialTagLine();
|
|
128
128
|
}
|
|
129
129
|
initialTagLine() {
|
|
130
|
-
var o,
|
|
130
|
+
var o, s, r;
|
|
131
131
|
const t = this.config;
|
|
132
132
|
if (!((o = t == null ? void 0 : t.tagNormalLineConfig) != null && o.enabled) || !this.normalLineLength)
|
|
133
133
|
return;
|
|
134
134
|
const e = this.five.renderer.getSize(u), i = this.five.renderer.getPixelRatio();
|
|
135
|
-
this.tagNormalLine = new T(new
|
|
136
|
-
color: new
|
|
137
|
-
linewidth: (r = (
|
|
135
|
+
this.tagNormalLine = new T(new n.Vector3().fromArray(this.position), new n.Vector3().fromArray(this.originPosition)), this.tagNormalLine.points.visible = !1, this.tagNormalLine.setMaterial({
|
|
136
|
+
color: new n.Vector3(1, 1, 1),
|
|
137
|
+
linewidth: (r = (s = t == null ? void 0 : t.tagNormalLineConfig) == null ? void 0 : s.lineWidth) != null ? r : 1.2,
|
|
138
138
|
dashed: !1
|
|
139
139
|
}), 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
140
|
}
|
|
@@ -181,7 +181,7 @@ class hi extends N {
|
|
|
181
181
|
let i = A(D(t), e).toArray();
|
|
182
182
|
if (this.normal && this.normalLineLength) {
|
|
183
183
|
const o = this.computeNormal();
|
|
184
|
-
i = new
|
|
184
|
+
i = new n.Vector3().fromArray(i).clone().add(o.clone().setLength(this.normalLineLength)).toArray();
|
|
185
185
|
}
|
|
186
186
|
return i;
|
|
187
187
|
})(), this.cache.clear(), this._lastUpdateCache.position = [0, 0, 0], this.updateVisible(), this.updateScreenPosition(), this.updateZIndex(), this.plugin.addRenderQueue({ type: "TagContainerSvelte", keys: ["tags"] });
|
|
@@ -191,7 +191,7 @@ class hi extends N {
|
|
|
191
191
|
* 使用屏幕空间反投影方法,确保任意视角下都保持固定像素距离
|
|
192
192
|
*/
|
|
193
193
|
updateTagNormalLinePosition() {
|
|
194
|
-
var _, y, v,
|
|
194
|
+
var _, y, v, b;
|
|
195
195
|
if (!this.screenPosition || !this.tagNormalLine)
|
|
196
196
|
return;
|
|
197
197
|
if (!this.visible) {
|
|
@@ -204,7 +204,7 @@ class hi extends N {
|
|
|
204
204
|
if (!f && !x)
|
|
205
205
|
return;
|
|
206
206
|
}
|
|
207
|
-
t.position = new
|
|
207
|
+
t.position = new n.Vector3().fromArray(this.position).toArray(), t.screenLeft = (v = this.screenPosition.leftPx) != null ? v : 0, t.screenTop = (b = this.screenPosition.topPx) != null ? b : 0, t.visible = this.visible;
|
|
208
208
|
const i = this.five.renderer.getSize(u);
|
|
209
209
|
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
210
|
(this._temp.iconPos.x - this._temp.lineStart.x) * i.x / 2,
|
|
@@ -215,13 +215,13 @@ class hi extends N {
|
|
|
215
215
|
(this._temp.iconPos.x * i.x / 2 - this._temp.screenDirPixel.x * this.iconPixelGap) / (i.x / 2),
|
|
216
216
|
(this._temp.iconPos.y * i.y / 2 - this._temp.screenDirPixel.y * this.iconPixelGap) / (i.y / 2)
|
|
217
217
|
), 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 r =
|
|
218
|
+
const s = this._temp.raycaster.ray;
|
|
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(s.origin).sub(this._temp.lineStart);
|
|
220
|
+
const r = s.direction.dot(s.direction), a = s.direction.dot(this._temp.lineDir), h = this._temp.lineDir.dot(this._temp.lineDir), c = s.direction.dot(this._temp.lineEnd), d = this._temp.lineDir.dot(this._temp.lineEnd), g = r * h - a * a;
|
|
221
221
|
let P = 0;
|
|
222
|
-
Math.abs(g) > 1e-4 && (P = (a * d -
|
|
223
|
-
const
|
|
224
|
-
if (this._temp.lineStart.distanceTo(this._temp.lineEnd) >
|
|
222
|
+
Math.abs(g) > 1e-4 && (P = (a * d - h * c) / g), this._temp.lineEnd.copy(s.origin).add(s.direction.multiplyScalar(Math.max(0, P)));
|
|
223
|
+
const L = this._temp.lineStart.distanceTo(this._temp.iconPos);
|
|
224
|
+
if (this._temp.lineStart.distanceTo(this._temp.lineEnd) > L) {
|
|
225
225
|
const f = Math.max(0, 1 - this.iconPixelGap / o);
|
|
226
226
|
this._temp.lineEnd.copy(this._temp.lineStart).lerp(this._temp.iconPos, f);
|
|
227
227
|
}
|
|
@@ -241,26 +241,26 @@ class hi extends N {
|
|
|
241
241
|
});
|
|
242
242
|
}, 1e3)) : o.timeoutId && (clearTimeout(o.timeoutId), o.inAnimation = !1, o.timeoutId = void 0), !i && !o.inAnimation)
|
|
243
243
|
return;
|
|
244
|
-
const
|
|
245
|
-
if (
|
|
246
|
-
const a = this.getDistance(void 0, 1),
|
|
244
|
+
const s = this.computeTagProject();
|
|
245
|
+
if (s && this.five.renderer) {
|
|
246
|
+
const a = this.getDistance(void 0, 1), h = (() => {
|
|
247
247
|
if (!this.currentConfig.simulate3D)
|
|
248
248
|
return 1;
|
|
249
249
|
const d = 2 * Math.tan(0.5 * this.five.camera.fov / 180 * Math.PI);
|
|
250
250
|
return Math.max(Math.min(1 - d * a / 40, 1), 0.7);
|
|
251
251
|
})(), c = this.five.renderer.getSize(u);
|
|
252
252
|
this.screenPosition = {
|
|
253
|
-
leftPx: (
|
|
254
|
-
topPx: (-
|
|
255
|
-
scale:
|
|
253
|
+
leftPx: (s.x + 1) / 2 * c.x,
|
|
254
|
+
topPx: (-s.y + 1) / 2 * c.y,
|
|
255
|
+
scale: h
|
|
256
256
|
}, this.updateTagNormalLinePosition();
|
|
257
257
|
} else
|
|
258
258
|
this.screenPosition = null;
|
|
259
259
|
this.plugin.addRenderQueue({ type: "TagContainerSvelte", keys: ["tags"] });
|
|
260
260
|
}
|
|
261
261
|
set(t, e = !0) {
|
|
262
|
-
var o,
|
|
263
|
-
super.set(t, e), (
|
|
262
|
+
var i, o, s;
|
|
263
|
+
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
264
|
}
|
|
265
265
|
setData(...t) {
|
|
266
266
|
super.setData(...t), this.plugin.addRenderQueue({ type: "TagContainerSvelte", keys: ["tags"] });
|
|
@@ -275,7 +275,7 @@ class hi extends N {
|
|
|
275
275
|
}
|
|
276
276
|
}
|
|
277
277
|
computeNormal() {
|
|
278
|
-
return new
|
|
278
|
+
return new n.Vector3().fromArray(this.normal);
|
|
279
279
|
}
|
|
280
280
|
/**
|
|
281
281
|
* @description 获取额外的闪烁目标,包括法线(如果有)
|
|
@@ -286,5 +286,5 @@ class hi extends N {
|
|
|
286
286
|
}
|
|
287
287
|
}
|
|
288
288
|
export {
|
|
289
|
-
|
|
289
|
+
pi as PointTag
|
|
290
290
|
};
|
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.2",
|
|
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",
|