@realsee/dnalogel 3.47.5 → 3.47.6
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 +3 -0
- package/dist/index.cjs.js +46 -46
- package/dist/index.js +3775 -3772
- package/dist/index.umd.js +41 -41
- package/dist/shared-utils/tag.d.ts +3 -1
- package/libs/Sculpt/Meshes/Line.js +53 -57
- package/libs/base/BasePlugin.js +1 -1
- package/libs/shared-utils/logger.js +1 -1
- package/libs/shared-utils/tag.d.ts +3 -1
- package/libs/shared-utils/tag.js +52 -46
- package/package.json +1 -1
|
@@ -6,6 +6,7 @@ export declare class LightTag {
|
|
|
6
6
|
visible: boolean;
|
|
7
7
|
enabled: boolean;
|
|
8
8
|
wrapper: HTMLElement;
|
|
9
|
+
positionsForRotate?: THREE.Vector3[];
|
|
9
10
|
private tagWrapper;
|
|
10
11
|
private five;
|
|
11
12
|
private originPosition?;
|
|
@@ -14,6 +15,7 @@ export declare class LightTag {
|
|
|
14
15
|
private config;
|
|
15
16
|
constructor(five: Five, position?: AnyPosition, config?: {
|
|
16
17
|
wrapper?: HTMLElement;
|
|
18
|
+
positionsForRotate?: AnyPosition[];
|
|
17
19
|
});
|
|
18
20
|
show(): void;
|
|
19
21
|
hide(): void;
|
|
@@ -21,7 +23,7 @@ export declare class LightTag {
|
|
|
21
23
|
disable(): void;
|
|
22
24
|
destroy(): void;
|
|
23
25
|
setTransformMatrix(matrix: THREE.Matrix4): void;
|
|
24
|
-
setPosition(position: THREE.Vector3): void;
|
|
26
|
+
setPosition(position: THREE.Vector3, positionsForRotate?: THREE.Vector3[]): void;
|
|
25
27
|
updateScreenPosition(): void;
|
|
26
28
|
private onCameraUpdate;
|
|
27
29
|
private onFiveEveryReady;
|
|
@@ -1,38 +1,37 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
1
|
+
var _ = Object.defineProperty;
|
|
2
|
+
var b = Object.getOwnPropertySymbols;
|
|
3
|
+
var S = Object.prototype.hasOwnProperty, k = Object.prototype.propertyIsEnumerable;
|
|
4
|
+
var u = (s, o, e) => o in s ? _(s, o, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[o] = e, f = (s, o) => {
|
|
5
5
|
for (var e in o || (o = {}))
|
|
6
|
-
|
|
7
|
-
if (
|
|
8
|
-
for (var e of
|
|
9
|
-
|
|
6
|
+
S.call(o, e) && u(s, e, o[e]);
|
|
7
|
+
if (b)
|
|
8
|
+
for (var e of b(o))
|
|
9
|
+
k.call(o, e) && u(s, e, o[e]);
|
|
10
10
|
return s;
|
|
11
11
|
};
|
|
12
|
-
var
|
|
12
|
+
var h = (s, o, e) => (u(s, typeof o != "symbol" ? o + "" : o, e), e);
|
|
13
13
|
import * as d from "three";
|
|
14
|
-
import { DEFAULT_LINE_COLOR as
|
|
15
|
-
import { LineGeometry as
|
|
16
|
-
import { anyPositionToVector3 as
|
|
17
|
-
import { IObject3D as
|
|
14
|
+
import { DEFAULT_LINE_COLOR as m, DEFAULT_LINE_WIDTH as M, DEFAULT_HIGHLIGHT_OPACITY as D } from "../typings/style.js";
|
|
15
|
+
import { LineGeometry as y, LineMaterial as w, THREE_Line2 as H } from "../../shared-utils/five/FiveLine.js";
|
|
16
|
+
import { anyPositionToVector3 as C } from "../../shared-utils/positionToVector3.js";
|
|
17
|
+
import { IObject3D as I } from "../../shared-utils/three/IObject3D.js";
|
|
18
18
|
import "hammerjs";
|
|
19
19
|
import "three/examples/jsm/renderers/CSS3DRenderer";
|
|
20
|
-
import { centerPoint as
|
|
20
|
+
import { centerPoint as R } from "../../shared-utils/three/centerPoint.js";
|
|
21
21
|
import "../../shared-utils/three/THREESphere.js";
|
|
22
22
|
import "animejs";
|
|
23
23
|
import { notNil as c } from "../../shared-utils/isNil.js";
|
|
24
24
|
import "../../vendor/@tweenjs/tween/dist/tween.esm.js.js";
|
|
25
|
-
import { LightTag as
|
|
26
|
-
import { globalModules as
|
|
27
|
-
import { removeAllTag as
|
|
28
|
-
import { getLengthHTML as
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
class x extends V {
|
|
25
|
+
import { LightTag as p } from "../../shared-utils/tag.js";
|
|
26
|
+
import { globalModules as x } from "../utils/Modules/Global.js";
|
|
27
|
+
import { removeAllTag as P } from "../utils/removeAllTag.js";
|
|
28
|
+
import { getLengthHTML as V } from "../utils/Meshes/getLengthHTML.js";
|
|
29
|
+
new d.Vector2();
|
|
30
|
+
class E extends w {
|
|
32
31
|
constructor(e) {
|
|
33
32
|
var n, t;
|
|
34
33
|
super(e);
|
|
35
|
-
|
|
34
|
+
h(this, "_three_color");
|
|
36
35
|
c(e == null ? void 0 : e.color) && (this.three_color = (n = e == null ? void 0 : e.color) != null ? n : 16777215), Object.keys(e).forEach((i) => {
|
|
37
36
|
["color", "dashed", "dashScale", "dashSize", "gapSize", "resolution"].includes(i) || i in this && (this[i] = e[i]);
|
|
38
37
|
}), this.setDashed((t = e == null ? void 0 : e.dashed) != null ? t : !1);
|
|
@@ -47,34 +46,34 @@ class x extends V {
|
|
|
47
46
|
this.dashed = e, e ? this.defines.USE_DASH = "" : delete this.defines.USE_DASH, this.needsUpdate = !0;
|
|
48
47
|
}
|
|
49
48
|
}
|
|
50
|
-
class
|
|
49
|
+
class T extends H {
|
|
51
50
|
constructor(e, n) {
|
|
52
51
|
super(e, n);
|
|
53
|
-
|
|
52
|
+
h(this, "name", "Line3");
|
|
54
53
|
}
|
|
55
54
|
}
|
|
56
|
-
class
|
|
55
|
+
class X extends I {
|
|
57
56
|
constructor(e) {
|
|
58
|
-
var l,
|
|
57
|
+
var l, r, g, a, L;
|
|
59
58
|
super();
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
59
|
+
h(this, "name", "LineMesh");
|
|
60
|
+
h(this, "points");
|
|
61
|
+
h(this, "lengthDoms", []);
|
|
62
|
+
h(this, "highlighted", !1);
|
|
63
|
+
h(this, "line");
|
|
64
|
+
h(this, "backLine");
|
|
65
|
+
h(this, "opacityBeforeHighlight");
|
|
66
|
+
h(this, "paramsStyle", {});
|
|
68
67
|
this.paramsStyle = e != null ? e : {};
|
|
69
|
-
const n = new
|
|
70
|
-
color: new d.Color((l = e == null ? void 0 : e.lineColor) != null ? l :
|
|
71
|
-
linewidth: (
|
|
68
|
+
const n = new y(), t = new E({
|
|
69
|
+
color: new d.Color((l = e == null ? void 0 : e.lineColor) != null ? l : m),
|
|
70
|
+
linewidth: (r = e == null ? void 0 : e.lineWidth) != null ? r : M,
|
|
72
71
|
dashScale: 40,
|
|
73
|
-
opacity: (
|
|
72
|
+
opacity: (g = e == null ? void 0 : e.opacity) != null ? g : 1,
|
|
74
73
|
transparent: !0,
|
|
75
|
-
dashed: (
|
|
76
|
-
}), i = new
|
|
77
|
-
color: new d.Color((
|
|
74
|
+
dashed: (a = e == null ? void 0 : e.dashed) != null ? a : !1
|
|
75
|
+
}), i = new E({
|
|
76
|
+
color: new d.Color((L = e == null ? void 0 : e.lineColor) != null ? L : m),
|
|
78
77
|
linewidth: t.linewidth * 0.9,
|
|
79
78
|
dashScale: t.dashScale,
|
|
80
79
|
opacity: t.opacity * 0.8,
|
|
@@ -83,8 +82,8 @@ class he extends O {
|
|
|
83
82
|
transparent: !0,
|
|
84
83
|
resolution: t.resolution
|
|
85
84
|
});
|
|
86
|
-
this.line = new
|
|
87
|
-
|
|
85
|
+
this.line = new T(n, t), this.backLine = new T(n, i), this.line.renderOrder = 1, this.backLine.renderOrder = 0, this.line.name = "lineFrontMaterial", this.backLine.name = "lineBackMaterial", e && this.setStyle(e), e != null && e.points && this.setPoints(e.points), this.addEventListener("removed", () => {
|
|
86
|
+
P(this);
|
|
88
87
|
});
|
|
89
88
|
}
|
|
90
89
|
get style() {
|
|
@@ -113,14 +112,14 @@ class he extends O {
|
|
|
113
112
|
return this.line.material.depthTest === !1 ? "depthTest" : "translucence";
|
|
114
113
|
}
|
|
115
114
|
setPoints(e) {
|
|
116
|
-
const n = e.map(
|
|
115
|
+
const n = e.map(C).filter(c);
|
|
117
116
|
if (this.points = n, n.length < 2) {
|
|
118
|
-
this.line.geometry = new
|
|
117
|
+
this.line.geometry = new y(), this.backLine.geometry = this.line.geometry, this.updateLengthItems();
|
|
119
118
|
return;
|
|
120
119
|
}
|
|
121
120
|
this.addIfNotExists(this.line, this.backLine);
|
|
122
121
|
const t = n.flatMap((i) => [i.x, i.y, i.z]);
|
|
123
|
-
t.length > 2 && (this.line.geometry.dispose(), this.line.geometry = new
|
|
122
|
+
t.length > 2 && (this.line.geometry.dispose(), this.line.geometry = new y(), this.backLine.geometry = this.line.geometry), this.line.geometry.setPositions(t), this.line.computeLineDistances(), this.updateLengthItems(), this.needsRender = !0;
|
|
124
123
|
}
|
|
125
124
|
setResolution(e, n) {
|
|
126
125
|
const t = this.line.material.resolution;
|
|
@@ -129,13 +128,13 @@ class he extends O {
|
|
|
129
128
|
(i.x !== e || i.y !== n) && (i.set(e, n), this.needsRender = !0);
|
|
130
129
|
}
|
|
131
130
|
setStyle(e) {
|
|
132
|
-
var i, l,
|
|
133
|
-
this.paramsStyle =
|
|
134
|
-
const n = (i = e.occlusionVisibility) != null ? i : this.paramsStyle.occlusionVisibility, t = (
|
|
131
|
+
var i, l, r;
|
|
132
|
+
this.paramsStyle = f(f({}, this.paramsStyle), e), c(e.lineColor) && (this.line.material.three_color = new d.Color(e.lineColor), this.backLine.material.three_color = new d.Color(e.lineColor)), c(e.lineWidth) && (this.line.material.linewidth = e.lineWidth), c(e.dashed) && this.line.material.setDashed(e.dashed), c(e.opacity) && (this.line.material.opacity = e.opacity, this.backLine.material.opacity = this.line.material.opacity * 0.2), this.updateLengthItems();
|
|
133
|
+
const n = (i = e.occlusionVisibility) != null ? i : this.paramsStyle.occlusionVisibility, t = (r = (l = e.occlusionMode) != null ? l : this.paramsStyle.occlusionMode) != null ? r : "translucence";
|
|
135
134
|
n ? t === "depthTest" ? (this.line.material.depthTest = !1, this.backLine.visible = !1) : t === "translucence" && (this.line.material.depthTest = !0, this.backLine.visible = !0, this.line.material.opacity === 1 ? this.backLine.material.setDashed(!0) : this.backLine.material.setDashed(this.line.material.dashed)) : (this.line.material.depthTest = !0, this.backLine.visible = !1), this.needsRender = !0;
|
|
136
135
|
}
|
|
137
136
|
highlight() {
|
|
138
|
-
this.highlighted || (this.highlighted = !0, this.opacityBeforeHighlight = this.line.material.opacity, this.line.material.opacity = this.opacityBeforeHighlight *
|
|
137
|
+
this.highlighted || (this.highlighted = !0, this.opacityBeforeHighlight = this.line.material.opacity, this.line.material.opacity = this.opacityBeforeHighlight * D, this.backLine.material.opacity = this.backLine.material.opacity * D, this.needsRender = !0);
|
|
139
138
|
}
|
|
140
139
|
unhighlight() {
|
|
141
140
|
this.highlighted && (this.highlighted = !1, this.line.material.opacity = this.opacityBeforeHighlight, this.backLine.material.opacity = 0.2, this.needsRender = !0);
|
|
@@ -147,18 +146,15 @@ class he extends O {
|
|
|
147
146
|
if (l !== 0)
|
|
148
147
|
return [this.points[l - 1], i];
|
|
149
148
|
}).filter(c)) != null ? n : [];
|
|
150
|
-
t.forEach(([i, l],
|
|
149
|
+
t.forEach(([i, l], r) => {
|
|
151
150
|
var a;
|
|
152
|
-
const
|
|
153
|
-
|
|
154
|
-
return Math.atan2(p, H) * (180 / Math.PI);
|
|
155
|
-
})();
|
|
156
|
-
this.lengthDoms[h] = (a = this.lengthDoms[h]) != null ? a : new F(L.five), this.lengthDoms[h].setPosition(f), this.lengthDoms[h].container.style.rotate = g + "deg", this.lengthDoms[h].container.innerHTML = z(i.distanceTo(l).toFixed(2) + "m");
|
|
151
|
+
const g = R(i, l);
|
|
152
|
+
this.lengthDoms[r] = (a = this.lengthDoms[r]) != null ? a : new p(x.five), this.lengthDoms[r].setPosition(g, [i, l]), this.lengthDoms[r].container.innerHTML = V(i.distanceTo(l).toFixed(2) + "m");
|
|
157
153
|
}), this.lengthDoms.length > t.length && (this.lengthDoms.slice(t.length).forEach((i) => i.destroy()), this.lengthDoms.length = t.length);
|
|
158
154
|
} else
|
|
159
155
|
this.lengthDoms.forEach((t) => t.destroy()), this.lengthDoms = [];
|
|
160
156
|
}
|
|
161
157
|
}
|
|
162
158
|
export {
|
|
163
|
-
|
|
159
|
+
X as LineMesh
|
|
164
160
|
};
|
package/libs/base/BasePlugin.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
function A() {
|
|
2
2
|
console.debug(
|
|
3
|
-
"%c %c@realsee/dnalogel %cv3.47.
|
|
3
|
+
"%c %c@realsee/dnalogel %cv3.47.6",
|
|
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",
|
|
@@ -6,6 +6,7 @@ export declare class LightTag {
|
|
|
6
6
|
visible: boolean;
|
|
7
7
|
enabled: boolean;
|
|
8
8
|
wrapper: HTMLElement;
|
|
9
|
+
positionsForRotate?: THREE.Vector3[];
|
|
9
10
|
private tagWrapper;
|
|
10
11
|
private five;
|
|
11
12
|
private originPosition?;
|
|
@@ -14,6 +15,7 @@ export declare class LightTag {
|
|
|
14
15
|
private config;
|
|
15
16
|
constructor(five: Five, position?: AnyPosition, config?: {
|
|
16
17
|
wrapper?: HTMLElement;
|
|
18
|
+
positionsForRotate?: AnyPosition[];
|
|
17
19
|
});
|
|
18
20
|
show(): void;
|
|
19
21
|
hide(): void;
|
|
@@ -21,7 +23,7 @@ export declare class LightTag {
|
|
|
21
23
|
disable(): void;
|
|
22
24
|
destroy(): void;
|
|
23
25
|
setTransformMatrix(matrix: THREE.Matrix4): void;
|
|
24
|
-
setPosition(position: THREE.Vector3): void;
|
|
26
|
+
setPosition(position: THREE.Vector3, positionsForRotate?: THREE.Vector3[]): void;
|
|
25
27
|
updateScreenPosition(): void;
|
|
26
28
|
private onCameraUpdate;
|
|
27
29
|
private onFiveEveryReady;
|
package/libs/shared-utils/tag.js
CHANGED
|
@@ -1,40 +1,41 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
1
|
+
var u = Object.defineProperty;
|
|
2
|
+
var g = (h, t, e) => t in h ? u(h, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : h[t] = e;
|
|
3
|
+
var o = (h, t, e) => (g(h, typeof t != "symbol" ? t + "" : t, e), e);
|
|
4
4
|
import { anyPositionToVector3 as f } from "./positionToVector3.js";
|
|
5
|
-
import * as
|
|
6
|
-
import { vector3ToScreen as
|
|
7
|
-
import { getFiveModel as
|
|
8
|
-
import { _raycaster as
|
|
9
|
-
const
|
|
10
|
-
class
|
|
11
|
-
constructor(t, e,
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
5
|
+
import * as b from "three";
|
|
6
|
+
import { vector3ToScreen as p } from "./five/vector3ToScreen.js";
|
|
7
|
+
import { getFiveModel as x } from "./five/getFiveModel.js";
|
|
8
|
+
import { _raycaster as m } from "./three/raycaster.js";
|
|
9
|
+
const v = "LightTagContainer_shgjakdhwakjdhsja", E = new b.Vector2();
|
|
10
|
+
class w {
|
|
11
|
+
constructor(t, e, i) {
|
|
12
|
+
o(this, "container");
|
|
13
|
+
o(this, "visible", !1);
|
|
14
|
+
o(this, "enabled", !1);
|
|
15
|
+
o(this, "wrapper");
|
|
16
|
+
o(this, "positionsForRotate");
|
|
17
|
+
o(this, "tagWrapper");
|
|
18
|
+
o(this, "five");
|
|
19
|
+
o(this, "originPosition");
|
|
20
|
+
o(this, "transformedPosition");
|
|
21
|
+
o(this, "disposer");
|
|
22
|
+
o(this, "config");
|
|
23
|
+
o(this, "onCameraUpdate", () => {
|
|
23
24
|
this.visible !== !1 && this.updateScreenPosition();
|
|
24
25
|
});
|
|
25
|
-
|
|
26
|
+
o(this, "onFiveEveryReady", () => {
|
|
26
27
|
var t;
|
|
27
28
|
if (this.visible && this.five.state.mode !== "Panorama") {
|
|
28
|
-
|
|
29
|
-
const
|
|
30
|
-
(
|
|
29
|
+
m.set(this.five.camera.position, this.transformedPosition.clone().sub(this.five.camera.position));
|
|
30
|
+
const i = (t = x(this.five).intersectRaycaster(m)) == null ? void 0 : t[0];
|
|
31
|
+
(i == null ? void 0 : i.distance) + 0.01 > this.transformedPosition.distanceTo(this.five.camera.position) ? (this.container.style.opacity = "1", this.container.style.pointerEvents = "auto") : (this.container.style.opacity = "0", this.container.style.pointerEvents = "none");
|
|
31
32
|
}
|
|
32
33
|
});
|
|
33
|
-
var
|
|
34
|
-
this.five = t, this.originPosition = e ? f(e).clone() : void 0, this.transformedPosition = (
|
|
35
|
-
const
|
|
36
|
-
return
|
|
37
|
-
})(), this.config =
|
|
34
|
+
var r, a;
|
|
35
|
+
this.five = t, this.originPosition = e ? f(e).clone() : void 0, this.transformedPosition = (r = this.originPosition) == null ? void 0 : r.clone(), this.positionsForRotate = (a = i == null ? void 0 : i.positionsForRotate) == null ? void 0 : a.map((s) => f(s).clone()), this.container = (() => {
|
|
36
|
+
const s = document.createElement("div");
|
|
37
|
+
return s.style.width = "0", s.style.height = "0", s.style.position = "absolute", s.style.transition = "opacity 0.2s linear", s;
|
|
38
|
+
})(), this.config = i != null ? i : {}, this.enable(), this.show();
|
|
38
39
|
}
|
|
39
40
|
show() {
|
|
40
41
|
this.visible = !0, this.container.style.opacity = "1", this.container.style.pointerEvents = "auto", this.onCameraUpdate();
|
|
@@ -43,12 +44,12 @@ class g {
|
|
|
43
44
|
this.visible = !1, this.container.style.opacity = "0", this.container.style.pointerEvents = "none";
|
|
44
45
|
}
|
|
45
46
|
enable() {
|
|
46
|
-
var
|
|
47
|
+
var i, r, a, s;
|
|
47
48
|
if (this.enabled)
|
|
48
49
|
return;
|
|
49
|
-
this.enabled = !0, this.wrapper = (
|
|
50
|
-
const
|
|
51
|
-
return
|
|
50
|
+
this.enabled = !0, this.wrapper = (a = (r = this.config.wrapper) != null ? r : (i = this.five.getElement()) == null ? void 0 : i.parentElement) != null ? a : document.body, this.tagWrapper || (this.tagWrapper = (s = document.getElementById(v)) != null ? s : (() => {
|
|
51
|
+
const n = document.createElement("div");
|
|
52
|
+
return n.id = v, n.style.position = "absolute", n.style.top = "0", n.style.left = "0", n.style.width = "100%", n.style.height = "100%", n.style.pointerEvents = "none", n;
|
|
52
53
|
})(), this.wrapper.contains(this.tagWrapper) || this.wrapper.appendChild(this.tagWrapper)), this.tagWrapper.appendChild(this.container);
|
|
53
54
|
let t = !1;
|
|
54
55
|
const e = () => {
|
|
@@ -71,30 +72,35 @@ class g {
|
|
|
71
72
|
var e;
|
|
72
73
|
this.transformedPosition = (e = this.originPosition) == null ? void 0 : e.clone().applyMatrix4(t), this.onCameraUpdate();
|
|
73
74
|
}
|
|
74
|
-
setPosition(t) {
|
|
75
|
-
this.transformedPosition = t, this.onCameraUpdate();
|
|
75
|
+
setPosition(t, e) {
|
|
76
|
+
this.transformedPosition = t, this.positionsForRotate = e, this.onCameraUpdate();
|
|
76
77
|
}
|
|
77
78
|
updateScreenPosition() {
|
|
78
79
|
if (!this.transformedPosition) {
|
|
79
80
|
this.container.style.left = "-100%", this.container.style.top = "-100%";
|
|
80
81
|
return;
|
|
81
82
|
}
|
|
82
|
-
const t =
|
|
83
|
-
if (!
|
|
83
|
+
const t = this.five.renderer.getSize(E), e = p(this.five.camera, this.transformedPosition, t);
|
|
84
|
+
if (!e) {
|
|
84
85
|
this.container.style.left = "-100%", this.container.style.top = "-100%";
|
|
85
86
|
return;
|
|
86
87
|
}
|
|
87
|
-
const
|
|
88
|
-
const
|
|
89
|
-
return Math.max(Math.min(1 -
|
|
88
|
+
const i = (() => {
|
|
89
|
+
const a = 2 * Math.tan(0.5 * this.five.camera.fov / 180 * Math.PI), s = this.transformedPosition.distanceTo(this.five.camera.position);
|
|
90
|
+
return Math.max(Math.min(1 - a * s / 40, 1), 0.5);
|
|
91
|
+
})(), r = (() => {
|
|
92
|
+
if (this.positionsForRotate === void 0 || this.positionsForRotate.length !== 2)
|
|
93
|
+
return 0;
|
|
94
|
+
const [a, s] = this.positionsForRotate, n = p(this.five.camera, a, t), c = p(this.five.camera, s, t), l = n.leftPx > c.leftPx ? c : n, d = n.leftPx > c.leftPx ? n : c, y = d.leftPx - l.leftPx, P = d.topPx - l.topPx;
|
|
95
|
+
return Math.atan2(P, y) * (180 / Math.PI);
|
|
90
96
|
})();
|
|
91
|
-
this.container.style.left =
|
|
97
|
+
this.container.style.left = e.leftPx + "px", this.container.style.top = e.topPx + "px", this.container.style.transformOrigin = "center", this.container.style.transform = `scale(${i})`, r && (this.container.style.transform += ` rotate(${r}deg)`);
|
|
92
98
|
}
|
|
93
99
|
}
|
|
94
|
-
function
|
|
95
|
-
return new
|
|
100
|
+
function M(h, t, e) {
|
|
101
|
+
return new w(h, t, e);
|
|
96
102
|
}
|
|
97
103
|
export {
|
|
98
|
-
|
|
99
|
-
|
|
104
|
+
w as LightTag,
|
|
105
|
+
M as tag
|
|
100
106
|
};
|