@realsee/dnalogel 3.49.8 → 3.49.9-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/README.md +116 -0
- package/dist/index.cjs.js +190 -190
- package/dist/index.js +3059 -3058
- package/dist/index.umd.js +182 -182
- package/dist/shared-utils/tag.d.ts +3 -2
- package/libs/ModelMakerPlugin/Controller.js +6 -6
- package/libs/base/BasePlugin.js +1 -1
- package/libs/shared-utils/logger.js +1 -1
- package/libs/shared-utils/tag.d.ts +3 -2
- package/libs/shared-utils/tag.js +36 -35
- package/package.json +1 -1
|
@@ -3,9 +3,9 @@ import { type AnyPosition } from './positionToVector3';
|
|
|
3
3
|
import * as THREE from 'three';
|
|
4
4
|
export declare class LightTag {
|
|
5
5
|
container: HTMLDivElement;
|
|
6
|
+
wrapper: HTMLElement;
|
|
6
7
|
visible: boolean;
|
|
7
8
|
enabled: boolean;
|
|
8
|
-
wrapper: HTMLElement;
|
|
9
9
|
positionsForRotate?: THREE.Vector3[];
|
|
10
10
|
/**
|
|
11
11
|
* @description 碰撞检测
|
|
@@ -17,7 +17,7 @@ export declare class LightTag {
|
|
|
17
17
|
* @default true
|
|
18
18
|
*/
|
|
19
19
|
simulate3D: boolean;
|
|
20
|
-
|
|
20
|
+
tagWrapper: HTMLElement;
|
|
21
21
|
private five;
|
|
22
22
|
private originPosition?;
|
|
23
23
|
private transformedPosition?;
|
|
@@ -26,6 +26,7 @@ export declare class LightTag {
|
|
|
26
26
|
private fiveUtil;
|
|
27
27
|
constructor(five: Five, position?: AnyPosition, config?: {
|
|
28
28
|
wrapper?: HTMLElement;
|
|
29
|
+
tagWrapper?: HTMLElement;
|
|
29
30
|
positionsForRotate?: AnyPosition[];
|
|
30
31
|
});
|
|
31
32
|
show(): void;
|
|
@@ -29,7 +29,7 @@ var F = (h, o, e) => new Promise((t, r) => {
|
|
|
29
29
|
import { Controller as z } from "../base/BasePluginWithData.js";
|
|
30
30
|
import * as c from "three";
|
|
31
31
|
import { ModelMakerBoxItem as B } from "./item/boxItem.js";
|
|
32
|
-
import { PrismMesh as
|
|
32
|
+
import { PrismMesh as T } from "../Sculpt/Meshes/Prism.js";
|
|
33
33
|
import { anyPositionToVector3 as O } from "../shared-utils/positionToVector3.js";
|
|
34
34
|
import { PolygonWithEdgeMesh as Q } from "../Sculpt/Meshes/PolygonWithEdge.js";
|
|
35
35
|
import "hammerjs";
|
|
@@ -39,7 +39,7 @@ import "../vendor/three/examples/jsm/lines/LineGeometry.js";
|
|
|
39
39
|
import "../shared-utils/tag.js";
|
|
40
40
|
import { boxVertex as g } from "../shared-utils/three/boundingBox.js";
|
|
41
41
|
import "animejs";
|
|
42
|
-
import { notNil as
|
|
42
|
+
import { notNil as A } from "../shared-utils/isNil.js";
|
|
43
43
|
import "../vendor/@tweenjs/tween/dist/tween.esm.js.js";
|
|
44
44
|
import { tagRendererMap as q } from "./utils/tagRenderer.js";
|
|
45
45
|
import { ModelMakerPrismItem as G } from "./item/prismItem.js";
|
|
@@ -128,7 +128,7 @@ class nt extends z {
|
|
|
128
128
|
this.group.name = "ModelMakerPluginGroup", this.state = { enabled: !0, visible: !0 }, this.occlusionVisibility = (r = t == null ? void 0 : t.occlusionVisibility) != null ? r : !1, this.occlusionMode = (p = t == null ? void 0 : t.occlusionMode) != null ? p : "translucence", this.fiveDomEvents = Y(e), this.tagWrapper = (() => {
|
|
129
129
|
var i;
|
|
130
130
|
const a = document.createElement("div");
|
|
131
|
-
return a.style.position = "absolute", a.style.top = "0", a.style.left = "0", a.style.width = "100%", a.style.height = "100%", a.style.pointerEvents = "none", a.style.zIndex = `${(i = t == null ? void 0 : t.tagContainerZIndex) != null ? i : ""}`, a;
|
|
131
|
+
return a.style.position = "absolute", a.classList.add("ModelMakerPluginTagWrapper"), a.style.top = "0", a.style.left = "0", a.style.width = "100%", a.style.height = "100%", a.style.pointerEvents = "none", a.style.zIndex = `${(i = t == null ? void 0 : t.tagContainerZIndex) != null ? i : ""}`, a;
|
|
132
132
|
})(), e.scene.add(this.group), this.handleEnable(), window.__MODELMAKER_DEBUG__ = this;
|
|
133
133
|
}
|
|
134
134
|
load(e) {
|
|
@@ -160,7 +160,7 @@ class nt extends z {
|
|
|
160
160
|
});
|
|
161
161
|
this.items.push(d);
|
|
162
162
|
} else if (i.type === "prism") {
|
|
163
|
-
const s = new
|
|
163
|
+
const s = new T();
|
|
164
164
|
this.zFightingOffset += 1e-4;
|
|
165
165
|
const d = i.object_data.points.map((u) => {
|
|
166
166
|
var y;
|
|
@@ -186,7 +186,7 @@ class nt extends z {
|
|
|
186
186
|
});
|
|
187
187
|
this.items.push(f);
|
|
188
188
|
} else if (i.type === "box") {
|
|
189
|
-
const s = new
|
|
189
|
+
const s = new T(), { start: d, end: v, rotation: M = [0, 0, 0, 0], opacity: f, color: u } = i.object_data, y = new c.Vector3().fromArray(d), R = new c.Vector3().fromArray(v), I = new c.Euler().fromArray(M), x = new c.Quaternion().setFromEuler(I), C = x.clone().inverse(), V = new c.Vector3().lerpVectors(y, R, 0.5), W = V.clone().negate(), k = y.clone().add(W).applyQuaternion(C), j = R.clone().add(W).applyQuaternion(C), b = new c.Box3(k.clone().max(j), k.clone().min(j));
|
|
190
190
|
s.setPoints({
|
|
191
191
|
points: [g(b, 2), g(b, 3), g(b, 7), g(b, 6), g(b, 2)],
|
|
192
192
|
heightPoint: g(b, 0)
|
|
@@ -212,7 +212,7 @@ class nt extends z {
|
|
|
212
212
|
});
|
|
213
213
|
}
|
|
214
214
|
setState(e) {
|
|
215
|
-
|
|
215
|
+
A(e.enabled) && this.state.enabled !== e.enabled && (this.state.enabled = e.enabled, e.enabled ? this.handleEnable() : this.handleDisable(), this.hooks.emit(e.enabled ? "enable" : "disable", { userAction: "我不知道捏" }), this.hooks.emit("stateChange", { state: this.state, userAction: "我不知道捏" })), A(e.visible) && this.state.visible !== e.visible && (this.state.visible = e.visible, e.visible ? this.handleShow() : this.handleHide(), this.hooks.emit(e.visible ? "show" : "hide", { userAction: "我不知道捏" }), this.hooks.emit("stateChange", { state: this.state, userAction: "我不知道捏" }));
|
|
216
216
|
}
|
|
217
217
|
getItemById(e) {
|
|
218
218
|
return this.items.find((t) => t.rawData.id === e);
|
package/libs/base/BasePlugin.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
function A() {
|
|
2
2
|
console.debug(
|
|
3
|
-
"%c %c@realsee/dnalogel %cv3.49.
|
|
3
|
+
"%c %c@realsee/dnalogel %cv3.49.9-alpha.0",
|
|
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",
|
|
@@ -3,9 +3,9 @@ import { type AnyPosition } from './positionToVector3';
|
|
|
3
3
|
import * as THREE from 'three';
|
|
4
4
|
export declare class LightTag {
|
|
5
5
|
container: HTMLDivElement;
|
|
6
|
+
wrapper: HTMLElement;
|
|
6
7
|
visible: boolean;
|
|
7
8
|
enabled: boolean;
|
|
8
|
-
wrapper: HTMLElement;
|
|
9
9
|
positionsForRotate?: THREE.Vector3[];
|
|
10
10
|
/**
|
|
11
11
|
* @description 碰撞检测
|
|
@@ -17,7 +17,7 @@ export declare class LightTag {
|
|
|
17
17
|
* @default true
|
|
18
18
|
*/
|
|
19
19
|
simulate3D: boolean;
|
|
20
|
-
|
|
20
|
+
tagWrapper: HTMLElement;
|
|
21
21
|
private five;
|
|
22
22
|
private originPosition?;
|
|
23
23
|
private transformedPosition?;
|
|
@@ -26,6 +26,7 @@ export declare class LightTag {
|
|
|
26
26
|
private fiveUtil;
|
|
27
27
|
constructor(five: Five, position?: AnyPosition, config?: {
|
|
28
28
|
wrapper?: HTMLElement;
|
|
29
|
+
tagWrapper?: HTMLElement;
|
|
29
30
|
positionsForRotate?: AnyPosition[];
|
|
30
31
|
});
|
|
31
32
|
show(): void;
|
package/libs/shared-utils/tag.js
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var s = (h, t, e) => (
|
|
1
|
+
var u = Object.defineProperty;
|
|
2
|
+
var P = (h, t, e) => t in h ? u(h, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : h[t] = e;
|
|
3
|
+
var s = (h, t, e) => (P(h, typeof t != "symbol" ? t + "" : t, e), e);
|
|
4
4
|
import { anyPositionToVector3 as d } from "./positionToVector3.js";
|
|
5
|
-
import * as
|
|
6
|
-
import { vector3ToScreen as
|
|
7
|
-
import { getFiveModel as
|
|
8
|
-
import { FiveUtil as
|
|
5
|
+
import * as g from "three";
|
|
6
|
+
import { vector3ToScreen as p } from "./five/vector3ToScreen.js";
|
|
7
|
+
import { getFiveModel as b } from "./five/getFiveModel.js";
|
|
8
|
+
import { FiveUtil as x } from "./Utils/FiveUtil.js";
|
|
9
9
|
import { _raycaster as m } from "./three/temp.js";
|
|
10
|
-
const
|
|
11
|
-
class
|
|
12
|
-
constructor(t, e,
|
|
10
|
+
const U = new g.Vector2();
|
|
11
|
+
class w {
|
|
12
|
+
constructor(t, e, i) {
|
|
13
|
+
// 单个标签容器
|
|
13
14
|
s(this, "container");
|
|
15
|
+
s(this, "wrapper");
|
|
14
16
|
s(this, "visible", !1);
|
|
15
17
|
s(this, "enabled", !1);
|
|
16
|
-
s(this, "wrapper");
|
|
17
18
|
s(this, "positionsForRotate");
|
|
18
19
|
/**
|
|
19
20
|
* @description 碰撞检测
|
|
@@ -40,15 +41,15 @@ class E {
|
|
|
40
41
|
if (this.intersectCheck && this.visible && this.five.state.mode !== "Panorama") {
|
|
41
42
|
let e = 0.01;
|
|
42
43
|
this.fiveUtil.workUtil.fromType === "poincare" && (e = 0.05), m.set(this.five.camera.position, this.transformedPosition.clone().sub(this.five.camera.position));
|
|
43
|
-
const
|
|
44
|
-
(
|
|
44
|
+
const i = (t = b(this.five).intersectRaycaster(m)) == null ? void 0 : t[0];
|
|
45
|
+
(i == null ? void 0 : i.distance) + e > 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");
|
|
45
46
|
}
|
|
46
47
|
});
|
|
47
|
-
var n,
|
|
48
|
-
this.five = t, this.fiveUtil = (n = t.__fiveUtil__) != null ? n : t.__fiveUtil__ = new
|
|
49
|
-
const
|
|
50
|
-
return
|
|
51
|
-
})(), this.config =
|
|
48
|
+
var n, a, o;
|
|
49
|
+
this.five = t, this.tagWrapper = i == null ? void 0 : i.tagWrapper, this.fiveUtil = (n = t.__fiveUtil__) != null ? n : t.__fiveUtil__ = new x(t), this.originPosition = e ? d(e).clone() : void 0, this.transformedPosition = (a = this.originPosition) == null ? void 0 : a.clone(), this.positionsForRotate = (o = i == null ? void 0 : i.positionsForRotate) == null ? void 0 : o.map((r) => d(r).clone()), this.container = (() => {
|
|
50
|
+
const r = document.createElement("div");
|
|
51
|
+
return r.style.width = "0", r.style.height = "0", r.style.position = "absolute", r.style.transition = "opacity 0.2s linear", r;
|
|
52
|
+
})(), this.config = i != null ? i : {}, this.enable(), this.show();
|
|
52
53
|
}
|
|
53
54
|
show() {
|
|
54
55
|
this.visible = !0, this.container.style.opacity = "1", this.container.style.pointerEvents = "auto", this.onCameraUpdate();
|
|
@@ -57,12 +58,12 @@ class E {
|
|
|
57
58
|
this.visible = !1, this.container.style.opacity = "0", this.container.style.pointerEvents = "none";
|
|
58
59
|
}
|
|
59
60
|
enable() {
|
|
60
|
-
var
|
|
61
|
+
var i, n, a;
|
|
61
62
|
if (this.enabled)
|
|
62
63
|
return;
|
|
63
|
-
this.enabled = !0, this.wrapper = (
|
|
64
|
-
const
|
|
65
|
-
return
|
|
64
|
+
this.enabled = !0, this.wrapper = (a = (n = this.config.wrapper) != null ? n : (i = this.five.getElement()) == null ? void 0 : i.parentElement) != null ? a : document.body, this.tagWrapper || (this.tagWrapper = (() => {
|
|
65
|
+
const o = document.createElement("div");
|
|
66
|
+
return o.style.position = "absolute", o.classList.add("LightTagWrapper"), o.style.top = "0", o.style.left = "0", o.style.width = "100%", o.style.height = "100%", o.style.pointerEvents = "none", o.style.zIndex = "1", o;
|
|
66
67
|
})(), this.wrapper.contains(this.tagWrapper) || this.wrapper.appendChild(this.tagWrapper)), this.tagWrapper.appendChild(this.container);
|
|
67
68
|
let t = !1;
|
|
68
69
|
const e = () => {
|
|
@@ -93,32 +94,32 @@ class E {
|
|
|
93
94
|
this.container.style.left = "-100%", this.container.style.top = "-100%";
|
|
94
95
|
return;
|
|
95
96
|
}
|
|
96
|
-
const t = this.five.renderer.getSize(
|
|
97
|
+
const t = this.five.renderer.getSize(U), e = p(this.five.camera, this.transformedPosition, t);
|
|
97
98
|
if (!e) {
|
|
98
99
|
this.container.style.left = "-100%", this.container.style.top = "-100%";
|
|
99
100
|
return;
|
|
100
101
|
}
|
|
101
|
-
const
|
|
102
|
+
const i = (() => {
|
|
102
103
|
if (!this.simulate3D)
|
|
103
104
|
return 1;
|
|
104
|
-
const
|
|
105
|
-
return Math.max(Math.min(1 -
|
|
105
|
+
const a = 2 * Math.tan(0.5 * this.five.camera.fov / 180 * Math.PI), o = this.transformedPosition.distanceTo(this.five.camera.position);
|
|
106
|
+
return Math.max(Math.min(1 - a * o / 40, 1), 0.5);
|
|
106
107
|
})(), n = (() => {
|
|
107
108
|
if (this.positionsForRotate === void 0 || this.positionsForRotate.length !== 2)
|
|
108
109
|
return 0;
|
|
109
|
-
const [
|
|
110
|
-
if (!
|
|
110
|
+
const [a, o] = this.positionsForRotate, r = p(this.five.camera, a, t), l = p(this.five.camera, o, t);
|
|
111
|
+
if (!r || !l)
|
|
111
112
|
return 0;
|
|
112
|
-
const
|
|
113
|
-
return Math.atan2(
|
|
113
|
+
const c = r.leftPx > l.leftPx ? l : r, f = r.leftPx > l.leftPx ? r : l, v = f.leftPx - c.leftPx, y = f.topPx - c.topPx;
|
|
114
|
+
return Math.atan2(y, v) * (180 / Math.PI);
|
|
114
115
|
})();
|
|
115
|
-
this.container.style.left = e.leftPx + "px", this.container.style.top = e.topPx + "px", this.container.style.transformOrigin = "center", this.container.style.transform = `scale(${
|
|
116
|
+
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})`, n && (this.container.style.transform += ` rotate(${n}deg)`);
|
|
116
117
|
}
|
|
117
118
|
}
|
|
118
|
-
function
|
|
119
|
-
return new
|
|
119
|
+
function _(h, t, e) {
|
|
120
|
+
return new w(h, t, e);
|
|
120
121
|
}
|
|
121
122
|
export {
|
|
122
|
-
|
|
123
|
-
|
|
123
|
+
w as LightTag,
|
|
124
|
+
_ as tag
|
|
124
125
|
};
|