@realsee/dnalogel 3.73.3 → 3.73.5
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 +12 -3
- package/dist/PanoTagPlugin/controller/Tag/PlaneTag.d.ts +14 -1
- package/dist/PanoTagPlugin/utils/model/mediaPlane.d.ts +7 -0
- package/dist/index.cjs.js +51 -51
- package/dist/index.js +3684 -3569
- package/dist/index.umd.js +73 -73
- package/dist/shared-utils/five/getFloorMesh.d.ts +3 -0
- package/libs/CruisePlugin/Move.js +3 -2
- package/libs/CruisePlugin/Work.js +3 -2
- package/libs/CruisePlugin/index.js +7 -6
- package/libs/GuideLinePlugin/Controller.js +5 -4
- package/libs/GuideLinePlugin/GuideLineItem.js +3 -2
- package/libs/GuideLinePlugin/GuideLineModeItem.js +3 -2
- package/libs/GuideLinePlugin/index.js +7 -6
- package/libs/PanoTagPlugin/Components/Tag/MarketingTag.js +232 -232
- package/libs/PanoTagPlugin/controller/Tag/PlaneTag.d.ts +14 -1
- package/libs/PanoTagPlugin/controller/Tag/PlaneTag.js +181 -121
- package/libs/PanoTagPlugin/controller/index.js +6 -5
- package/libs/PanoTagPlugin/index.js +12 -11
- package/libs/PanoTagPlugin/utils/model/mediaPlane.d.ts +7 -0
- package/libs/PanoTagPlugin/utils/model/mediaPlane.js +167 -136
- package/libs/base/BasePlugin.js +1 -1
- package/libs/index.js +151 -150
- package/libs/shared-utils/Object3DHelper/Controller/ScaleController.js +41 -33
- package/libs/shared-utils/five/getFloorMesh.d.ts +3 -0
- package/libs/shared-utils/five/getFloorMesh.js +11 -0
- package/libs/shared-utils/logger.js +1 -1
- package/libs/vendor/hotkeys-js/dist/hotkeys.esm.js +151 -139
- package/package.json +2 -2
|
@@ -1,41 +1,55 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
1
|
+
var G = Object.defineProperty;
|
|
2
|
+
var O = (M, l, e) => l in M ? G(M, l, { enumerable: !0, configurable: !0, writable: !0, value: e }) : M[l] = e;
|
|
3
|
+
var a = (M, l, e) => (O(M, typeof l != "symbol" ? l + "" : l, e), e);
|
|
4
|
+
var m = (M, l, e) => new Promise((t, i) => {
|
|
5
|
+
var s = (o) => {
|
|
6
6
|
try {
|
|
7
7
|
n(e.next(o));
|
|
8
|
-
} catch (
|
|
9
|
-
|
|
8
|
+
} catch (d) {
|
|
9
|
+
i(d);
|
|
10
10
|
}
|
|
11
|
-
},
|
|
11
|
+
}, r = (o) => {
|
|
12
12
|
try {
|
|
13
13
|
n(e.throw(o));
|
|
14
|
-
} catch (
|
|
15
|
-
|
|
14
|
+
} catch (d) {
|
|
15
|
+
i(d);
|
|
16
16
|
}
|
|
17
|
-
}, n = (o) => o.done ? t(o.value) : Promise.resolve(o.value).then(
|
|
18
|
-
n((e = e.apply(
|
|
17
|
+
}, n = (o) => o.done ? t(o.value) : Promise.resolve(o.value).then(s, r);
|
|
18
|
+
n((e = e.apply(M, l)).next());
|
|
19
19
|
});
|
|
20
20
|
import * as y from "three";
|
|
21
|
-
import { Vector3 as
|
|
21
|
+
import { Vector3 as b } from "three";
|
|
22
22
|
import { centerPoint as I } from "../../../shared-utils/three/centerPoint.js";
|
|
23
|
-
import { loadPicture as
|
|
24
|
-
import { QuadrangleGeometry as F, QuadrangleMesh as
|
|
25
|
-
import { getVideoTexture as
|
|
26
|
-
import { Image_Play_Icon_With_Text as
|
|
27
|
-
import { getPositionsByObjectFit as
|
|
28
|
-
import { FragmentTransparencyMaterial as
|
|
23
|
+
import { loadPicture as H } from "../../../shared-utils/three/loadTexture.js";
|
|
24
|
+
import { QuadrangleGeometry as F, QuadrangleMesh as S } from "../../../shared-utils/three/Quadrangle.js";
|
|
25
|
+
import { getVideoTexture as V } from "../../../shared-utils/three/loadVideoTexture.js";
|
|
26
|
+
import { Image_Play_Icon_With_Text as B, Image_Play_Icon as E } from "../../Assets/Icon.js";
|
|
27
|
+
import { getPositionsByObjectFit as g } from "../../../shared-utils/three/getPositionsByObjectFit.js";
|
|
28
|
+
import { FragmentTransparencyMaterial as j } from "../../../shared-utils/three/FragmentTransparencyMaterial.js";
|
|
29
29
|
import { getNormal as P } from "../../../shared-utils/three/getNormal.js";
|
|
30
|
-
import { CONST as
|
|
30
|
+
import { CONST as T } from "../../../shared-utils/constants.js";
|
|
31
31
|
import "../../../shared-utils/math/pointsIsRectangle.js";
|
|
32
32
|
import "../../../shared-utils/device.js";
|
|
33
|
-
class
|
|
33
|
+
class C extends y.Mesh {
|
|
34
34
|
constructor() {
|
|
35
35
|
super(...arguments);
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
a(this, "name", "MediaPlane");
|
|
37
|
+
a(this, "src");
|
|
38
|
+
a(this, "objectFit");
|
|
39
|
+
}
|
|
40
|
+
/** 获取透明度 */
|
|
41
|
+
get opacity() {
|
|
42
|
+
var e, t;
|
|
43
|
+
return (t = (e = this.material) == null ? void 0 : e.opacity) != null ? t : 1;
|
|
44
|
+
}
|
|
45
|
+
/** 设置透明度 (0-1) */
|
|
46
|
+
set opacity(e) {
|
|
47
|
+
this.material && (this.material.opacity = e, this.material.transparent = e < 1, this.material.needsUpdate = !0), this.traverse((t) => {
|
|
48
|
+
if (t.isMesh && t !== this) {
|
|
49
|
+
const i = t;
|
|
50
|
+
i.material && (i.material.opacity = e, i.material.transparent = e < 1, i.material.needsUpdate = !0);
|
|
51
|
+
}
|
|
52
|
+
});
|
|
39
53
|
}
|
|
40
54
|
removeFromParent() {
|
|
41
55
|
const e = this.parent;
|
|
@@ -45,86 +59,93 @@ class H extends y.Mesh {
|
|
|
45
59
|
this.traverse((e) => {
|
|
46
60
|
if (e.isMesh) {
|
|
47
61
|
const t = e;
|
|
48
|
-
t.geometry.dispose(), (t.material instanceof Array ? t.material : [t.material]).forEach((
|
|
49
|
-
|
|
62
|
+
t.geometry.dispose(), (t.material instanceof Array ? t.material : [t.material]).forEach((s) => {
|
|
63
|
+
s.dispose();
|
|
50
64
|
});
|
|
51
65
|
}
|
|
52
66
|
});
|
|
53
67
|
}
|
|
54
68
|
}
|
|
55
|
-
class
|
|
56
|
-
constructor(e, t,
|
|
57
|
-
var
|
|
69
|
+
class J extends C {
|
|
70
|
+
constructor(e, t, i) {
|
|
71
|
+
var o, d;
|
|
58
72
|
super();
|
|
59
|
-
|
|
60
|
-
|
|
73
|
+
a(this, "name", "PanoTagPluginImagePlane");
|
|
74
|
+
a(this, "originRatio");
|
|
61
75
|
this.src = e;
|
|
62
|
-
const
|
|
63
|
-
let
|
|
64
|
-
if (
|
|
65
|
-
const
|
|
66
|
-
|
|
76
|
+
const s = (o = i == null ? void 0 : i.resolveZFighting) != null ? o : !0, r = (d = i == null ? void 0 : i.opacity) != null ? d : 1;
|
|
77
|
+
let n = t;
|
|
78
|
+
if (s) {
|
|
79
|
+
const h = P(t).multiplyScalar(T.Z_FIGHTING_OFFSET);
|
|
80
|
+
n = t.map((c) => c.clone().add(h));
|
|
67
81
|
}
|
|
68
|
-
|
|
69
|
-
var
|
|
70
|
-
const v = new y.MeshBasicMaterial({
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
82
|
+
H(e).then(({ texture: h, transparent: c }) => {
|
|
83
|
+
var x;
|
|
84
|
+
const v = new y.MeshBasicMaterial({
|
|
85
|
+
map: h,
|
|
86
|
+
transparent: c || r < 1,
|
|
87
|
+
opacity: r,
|
|
88
|
+
side: y.DoubleSide
|
|
89
|
+
});
|
|
90
|
+
this.originRatio = h.image.width / h.image.height, this.objectFit = (x = i == null ? void 0 : i.objectFit) != null ? x : "contain";
|
|
91
|
+
const u = g(this.objectFit, n, h.image.width / h.image.height), p = I(...u), f = u.map((_) => _.clone().sub(p)), w = new F(f);
|
|
92
|
+
this.position.copy(p), this.geometry = w, this.material = v;
|
|
93
|
+
}).catch((h) => {
|
|
94
|
+
console.error(`Imageplane error: ${h == null ? void 0 : h.message}`);
|
|
76
95
|
});
|
|
77
96
|
}
|
|
78
97
|
changePointsOrParams(e) {
|
|
79
|
-
const { cornerPoints: t, params:
|
|
80
|
-
let
|
|
81
|
-
const { resolveZFighting: n } =
|
|
98
|
+
const { cornerPoints: t, params: i = {} } = e, { objectFit: s = this.objectFit } = i;
|
|
99
|
+
let r = t;
|
|
100
|
+
const { resolveZFighting: n } = i != null ? i : {};
|
|
82
101
|
if (n) {
|
|
83
|
-
const
|
|
84
|
-
|
|
102
|
+
const v = P(t).multiplyScalar(T.Z_FIGHTING_OFFSET);
|
|
103
|
+
r = t.map((u) => u.clone().add(v));
|
|
85
104
|
}
|
|
86
|
-
const o =
|
|
87
|
-
this.objectFit =
|
|
105
|
+
const o = g(s != null ? s : "contain", r, this.originRatio), d = I(...o), h = o.map((v) => v.clone().sub(d)), c = new F(h);
|
|
106
|
+
this.objectFit = s != null ? s : "contain", this.position.copy(d), this.geometry = c;
|
|
88
107
|
}
|
|
89
108
|
}
|
|
90
|
-
class
|
|
109
|
+
class K extends C {
|
|
91
110
|
// eslint-disable-next-line max-params
|
|
92
|
-
constructor(e, t,
|
|
111
|
+
constructor(e, t, i) {
|
|
93
112
|
const {
|
|
94
|
-
videoCoverSrc:
|
|
95
|
-
objectFit:
|
|
113
|
+
videoCoverSrc: s,
|
|
114
|
+
objectFit: r = "contain",
|
|
96
115
|
playButton: n = "withText",
|
|
97
116
|
paused: o = !0,
|
|
98
|
-
videoTextureMap:
|
|
99
|
-
ImageTextureMap:
|
|
100
|
-
domEvents: c
|
|
101
|
-
|
|
117
|
+
videoTextureMap: d,
|
|
118
|
+
ImageTextureMap: h,
|
|
119
|
+
domEvents: c,
|
|
120
|
+
opacity: v = 1
|
|
121
|
+
} = i != null ? i : {};
|
|
102
122
|
super();
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
this
|
|
123
|
+
a(this, "isVideoPlane", !0);
|
|
124
|
+
a(this, "name", "PanoTagPluginImagePlane");
|
|
125
|
+
a(this, "videoInstance");
|
|
126
|
+
a(this, "onVideoReady");
|
|
127
|
+
a(this, "buttonSrc");
|
|
128
|
+
a(this, "videoCoverSrc");
|
|
129
|
+
a(this, "domEvents");
|
|
130
|
+
a(this, "disposers", []);
|
|
131
|
+
a(this, "cornerPoints");
|
|
132
|
+
a(this, "videoMesh");
|
|
133
|
+
a(this, "coverMesh");
|
|
134
|
+
a(this, "buttonMesh");
|
|
135
|
+
a(this, "videoTextureMap");
|
|
136
|
+
a(this, "ImageTextureMap");
|
|
137
|
+
a(this, "initialOpacity");
|
|
138
|
+
this.cornerPoints = t, this.src = e, this.initialOpacity = v, this.buttonSrc = (() => n === "withText" ? B : n === "withoutText" ? E : typeof n == "string" ? n : E)(), this.videoCoverSrc = s, this.objectFit = r, this.videoTextureMap = d, this.ImageTextureMap = h, this.domEvents = c, this.position.copy(I(...t)), this.videoCoverSrc && o ? this.addCoverMesh().then(() => this.addButtonMesh()) : this.addVideoMesh().then(() => {
|
|
118
139
|
o ? this.addButtonMesh() : this.play(!0);
|
|
119
140
|
}), this.addEventListener("removed", () => {
|
|
120
141
|
this.remove(...this.children);
|
|
121
142
|
}), this.addEventListener("dispose", () => {
|
|
122
143
|
var u;
|
|
123
|
-
(u = this.disposers) == null || u.forEach((
|
|
144
|
+
(u = this.disposers) == null || u.forEach((p) => p == null ? void 0 : p());
|
|
124
145
|
});
|
|
125
146
|
}
|
|
126
147
|
play(e = !1) {
|
|
127
|
-
return
|
|
148
|
+
return m(this, null, function* () {
|
|
128
149
|
this.videoMesh || (yield this.addVideoMesh()), this.showPlayUI(), this.videoInstance.paused && this.videoInstance.play().then(() => this.showPlayUI()).catch((t) => {
|
|
129
150
|
this.pause(), console.error("play error", t);
|
|
130
151
|
}), this.videoInstance.muted = e, this.render();
|
|
@@ -134,17 +155,17 @@ class J extends H {
|
|
|
134
155
|
this.videoInstance && (this.videoInstance.pause(), this.showPauseUI().then(() => this.render()));
|
|
135
156
|
}
|
|
136
157
|
initialRenderHooks(e) {
|
|
137
|
-
const
|
|
138
|
-
var
|
|
139
|
-
this.videoMesh && ((
|
|
158
|
+
const i = e(() => {
|
|
159
|
+
var s;
|
|
160
|
+
this.videoMesh && ((s = this.videoInstance) == null ? void 0 : s.paused) === !1 && (this.videoMesh.needsRender = !0);
|
|
140
161
|
});
|
|
141
|
-
this.disposers.push(() =>
|
|
162
|
+
this.disposers.push(() => i);
|
|
142
163
|
}
|
|
143
164
|
showPlayUI() {
|
|
144
165
|
this.coverMesh && (this.coverMesh.visible = !1), this.remove(this.buttonMesh), this.videoMesh.visible = !0;
|
|
145
166
|
}
|
|
146
167
|
showPauseUI() {
|
|
147
|
-
return
|
|
168
|
+
return m(this, null, function* () {
|
|
148
169
|
this.coverMesh ? (this.coverMesh.visible = !0, this.videoMesh && (this.videoMesh.visible = !1)) : (yield this.addCoverMesh(), this.coverMesh && (this.videoMesh.visible = !1)), this.addButtonMesh().then(() => this.render());
|
|
149
170
|
});
|
|
150
171
|
}
|
|
@@ -153,41 +174,51 @@ class J extends H {
|
|
|
153
174
|
this.videoMesh && (this.videoMesh.needsRender = !0), this.coverMesh && (this.coverMesh.needsRender = !0), this.buttonMesh && (this.buttonMesh.needsRender = !0), this.videoMesh && ((e = this.videoInstance) == null ? void 0 : e.paused) === !1 && (this.videoMesh.needsRender = !0);
|
|
154
175
|
}
|
|
155
176
|
addCoverMesh() {
|
|
156
|
-
return
|
|
177
|
+
return m(this, null, function* () {
|
|
157
178
|
if (this.children.includes(this.coverMesh))
|
|
158
179
|
return;
|
|
159
|
-
const e = yield (() =>
|
|
180
|
+
const e = yield (() => m(this, null, function* () {
|
|
160
181
|
if (this.coverMesh)
|
|
161
182
|
return this.coverMesh;
|
|
162
183
|
if (!this.videoCoverSrc)
|
|
163
184
|
return;
|
|
164
|
-
const { texture: t, transparent:
|
|
165
|
-
|
|
166
|
-
|
|
185
|
+
const { texture: t, transparent: i } = yield this.getImageTexture(this.videoCoverSrc), s = new y.MeshBasicMaterial({
|
|
186
|
+
transparent: i || this.initialOpacity < 1,
|
|
187
|
+
opacity: this.initialOpacity,
|
|
188
|
+
map: t,
|
|
189
|
+
side: y.DoubleSide
|
|
190
|
+
}), r = g(this.objectFit, this.cornerPoints, t.image.width / t.image.height), n = new S(r, s);
|
|
191
|
+
n.position.copy(new b(0, 0, 0)), n.name = "videoCoverMesh";
|
|
192
|
+
const o = P(r).multiplyScalar(T.Z_FIGHTING_OFFSET);
|
|
167
193
|
return n.position.add(o), n;
|
|
168
194
|
}))();
|
|
169
195
|
return e && (this.children.includes(this.coverMesh) || (this.add(e), this.coverMesh = e)), e;
|
|
170
196
|
});
|
|
171
197
|
}
|
|
172
198
|
addVideoMesh() {
|
|
173
|
-
return
|
|
174
|
-
var
|
|
199
|
+
return m(this, null, function* () {
|
|
200
|
+
var i;
|
|
175
201
|
if (this.children.includes(this.videoMesh))
|
|
176
202
|
return;
|
|
177
|
-
const e = yield (() =>
|
|
203
|
+
const e = yield (() => m(this, null, function* () {
|
|
178
204
|
if (this.videoMesh)
|
|
179
205
|
return this.videoMesh;
|
|
180
206
|
if (!this.src)
|
|
181
207
|
return;
|
|
182
|
-
const
|
|
183
|
-
|
|
208
|
+
const s = this.getVideoTexture(this.src), r = new y.MeshBasicMaterial({
|
|
209
|
+
transparent: this.initialOpacity < 1,
|
|
210
|
+
opacity: this.initialOpacity,
|
|
211
|
+
map: s,
|
|
212
|
+
side: y.DoubleSide
|
|
213
|
+
}), n = yield new Promise((h) => {
|
|
214
|
+
s.metadataLoaded ? h(g(this.objectFit, this.cornerPoints, s.image.videoWidth / s.image.videoHeight)) : s.addEventListener(
|
|
184
215
|
"videoLoaded",
|
|
185
|
-
() =>
|
|
216
|
+
() => h(g(this.objectFit, this.cornerPoints, s.image.videoWidth / s.image.videoHeight))
|
|
186
217
|
);
|
|
187
|
-
}), o = new
|
|
188
|
-
o.name = "videoMesh", o.position.copy(new
|
|
189
|
-
const
|
|
190
|
-
return o.position.add(
|
|
218
|
+
}), o = new S(n, r);
|
|
219
|
+
o.name = "videoMesh", o.position.copy(new b(0, 0, 0));
|
|
220
|
+
const d = P(n).multiplyScalar(T.Z_FIGHTING_OFFSET);
|
|
221
|
+
return o.position.add(d), o;
|
|
191
222
|
}))();
|
|
192
223
|
if (!e)
|
|
193
224
|
return;
|
|
@@ -195,13 +226,13 @@ class J extends H {
|
|
|
195
226
|
e,
|
|
196
227
|
"click",
|
|
197
228
|
() => {
|
|
198
|
-
var
|
|
199
|
-
!this.videoInstance.paused && ((
|
|
229
|
+
var s;
|
|
230
|
+
!this.videoInstance.paused && ((s = this.videoInstance) != null && s.muted) ? this.videoInstance.muted = !1 : this.pause();
|
|
200
231
|
},
|
|
201
232
|
{ noEmitWhenHide: !0 }
|
|
202
233
|
);
|
|
203
234
|
const t = e.material.map.image;
|
|
204
|
-
return (
|
|
235
|
+
return (i = this.onVideoReady) == null || i.call(this, t), t.addEventListener("playing", () => {
|
|
205
236
|
this.coverMesh || this.remove(this.buttonMesh), this.render();
|
|
206
237
|
}), t.addEventListener("pause", () => {
|
|
207
238
|
this.videoInstance.paused && (this.showPauseUI(), this.render());
|
|
@@ -209,15 +240,15 @@ class J extends H {
|
|
|
209
240
|
});
|
|
210
241
|
}
|
|
211
242
|
addButtonMesh() {
|
|
212
|
-
return
|
|
243
|
+
return m(this, null, function* () {
|
|
213
244
|
if (this.children.includes(this.buttonMesh))
|
|
214
245
|
return;
|
|
215
|
-
const e = yield (() =>
|
|
216
|
-
var
|
|
246
|
+
const e = yield (() => m(this, null, function* () {
|
|
247
|
+
var u, p, f, w;
|
|
217
248
|
if (this.buttonMesh)
|
|
218
249
|
return this.buttonMesh;
|
|
219
|
-
const t = (
|
|
220
|
-
c.position.copy(new
|
|
250
|
+
const t = (p = (u = this.videoMesh) == null ? void 0 : u.geometry.points[0].distanceTo(this.videoMesh.geometry.points[3])) != null ? p : 1 / 0, i = (w = (f = this.coverMesh) == null ? void 0 : f.geometry.points[0].distanceTo(this.coverMesh.geometry.points[3])) != null ? w : 1 / 0, s = this.cornerPoints[0].distanceTo(this.cornerPoints[3]), n = Math.min(t, i, s) / s * 0.3, { texture: o, transparent: d } = yield this.getImageTexture(this.buttonSrc), h = g("contain", this.cornerPoints, o.image.width / o.image.height), c = new S(h, new j(o));
|
|
251
|
+
c.position.copy(new b(0, 0, 0)), c.name = "buttonMesh", c.scale.set(n, n, n), c.material.side = y.DoubleSide, this.domEvents.addAutoBindEventListener(
|
|
221
252
|
c,
|
|
222
253
|
"click",
|
|
223
254
|
() => {
|
|
@@ -225,75 +256,75 @@ class J extends H {
|
|
|
225
256
|
},
|
|
226
257
|
{ noEmitWhenHide: !0 }
|
|
227
258
|
);
|
|
228
|
-
const
|
|
229
|
-
return c.position.add(
|
|
259
|
+
const v = P(h).multiplyScalar(T.Z_FIGHTING_OFFSET * 2);
|
|
260
|
+
return c.position.add(v), c;
|
|
230
261
|
}))();
|
|
231
262
|
return this.children.includes(this.buttonMesh) || (this.add(e), this.buttonMesh = e), e;
|
|
232
263
|
});
|
|
233
264
|
}
|
|
234
265
|
getImageTexture(e) {
|
|
235
|
-
return
|
|
236
|
-
var
|
|
237
|
-
if ((
|
|
266
|
+
return m(this, null, function* () {
|
|
267
|
+
var i, s;
|
|
268
|
+
if ((i = this.ImageTextureMap) != null && i.has(e))
|
|
238
269
|
return this.ImageTextureMap.get(e);
|
|
239
|
-
const t = yield
|
|
240
|
-
return (
|
|
270
|
+
const t = yield H(e);
|
|
271
|
+
return (s = this.ImageTextureMap) == null || s.set(e, t), t;
|
|
241
272
|
});
|
|
242
273
|
}
|
|
243
274
|
getVideoTexture(e) {
|
|
244
|
-
var
|
|
245
|
-
if ((
|
|
275
|
+
var i, s;
|
|
276
|
+
if ((i = this.videoTextureMap) != null && i.has(e))
|
|
246
277
|
return this.videoTextureMap.get(e);
|
|
247
|
-
const t =
|
|
248
|
-
return (
|
|
278
|
+
const t = V(e);
|
|
279
|
+
return (s = this.videoTextureMap) == null || s.set(e, t), t;
|
|
249
280
|
}
|
|
250
281
|
changePointsOrParams(e) {
|
|
251
|
-
return
|
|
252
|
-
const { cornerPoints: t, params:
|
|
253
|
-
t && (this.cornerPoints = t, this.position.copy(I(...t))),
|
|
282
|
+
return m(this, null, function* () {
|
|
283
|
+
const { cornerPoints: t, params: i } = e;
|
|
284
|
+
t && (this.cornerPoints = t, this.position.copy(I(...t))), i != null && i.objectFit && (this.objectFit = i.objectFit), yield this.updateAllMeshes();
|
|
254
285
|
});
|
|
255
286
|
}
|
|
256
287
|
updateAllMeshes() {
|
|
257
|
-
return
|
|
288
|
+
return m(this, null, function* () {
|
|
258
289
|
this.videoMesh && (yield this.updateVideoMesh()), this.coverMesh && (yield this.updateCoverMesh()), this.buttonMesh && (yield this.updateButtonMesh()), this.render();
|
|
259
290
|
});
|
|
260
291
|
}
|
|
261
292
|
updateVideoMesh() {
|
|
262
|
-
return
|
|
293
|
+
return m(this, null, function* () {
|
|
263
294
|
if (!this.videoMesh || !this.src)
|
|
264
295
|
return;
|
|
265
296
|
const e = this.getVideoTexture(this.src), t = yield new Promise((o) => {
|
|
266
|
-
e.metadataLoaded ? o(
|
|
297
|
+
e.metadataLoaded ? o(g(this.objectFit, this.cornerPoints, e.image.videoWidth / e.image.videoHeight)) : e.addEventListener(
|
|
267
298
|
"videoLoaded",
|
|
268
|
-
() => o(
|
|
299
|
+
() => o(g(this.objectFit, this.cornerPoints, e.image.videoWidth / e.image.videoHeight))
|
|
269
300
|
);
|
|
270
|
-
}),
|
|
271
|
-
this.videoMesh.geometry.dispose(), this.videoMesh.geometry =
|
|
272
|
-
const n = P(t).multiplyScalar(
|
|
301
|
+
}), i = I(...t), s = t.map((o) => o.clone().sub(i)), r = new F(s);
|
|
302
|
+
this.videoMesh.geometry.dispose(), this.videoMesh.geometry = r, this.videoMesh.position.copy(new b(0, 0, 0));
|
|
303
|
+
const n = P(t).multiplyScalar(T.Z_FIGHTING_OFFSET);
|
|
273
304
|
this.videoMesh.position.add(n);
|
|
274
305
|
});
|
|
275
306
|
}
|
|
276
307
|
updateCoverMesh() {
|
|
277
|
-
return
|
|
308
|
+
return m(this, null, function* () {
|
|
278
309
|
if (!this.coverMesh || !this.videoCoverSrc)
|
|
279
310
|
return;
|
|
280
|
-
const { texture: e } = yield this.getImageTexture(this.videoCoverSrc), t =
|
|
281
|
-
this.coverMesh.geometry.dispose(), this.coverMesh.geometry =
|
|
311
|
+
const { texture: e } = yield this.getImageTexture(this.videoCoverSrc), t = g(this.objectFit, this.cornerPoints, e.image.width / e.image.height), i = I(...t), s = t.map((n) => n.clone().sub(i)), r = new F(s);
|
|
312
|
+
this.coverMesh.geometry.dispose(), this.coverMesh.geometry = r, this.coverMesh.position.copy(new b(0, 0, 0));
|
|
282
313
|
});
|
|
283
314
|
}
|
|
284
315
|
updateButtonMesh() {
|
|
285
|
-
return
|
|
286
|
-
var
|
|
316
|
+
return m(this, null, function* () {
|
|
317
|
+
var u, p, f, w;
|
|
287
318
|
if (!this.buttonMesh)
|
|
288
319
|
return;
|
|
289
|
-
const { texture: e } = yield this.getImageTexture(this.buttonSrc), t =
|
|
290
|
-
this.buttonMesh.geometry.dispose(), this.buttonMesh.geometry =
|
|
291
|
-
const
|
|
292
|
-
this.buttonMesh.position.add(
|
|
320
|
+
const { texture: e } = yield this.getImageTexture(this.buttonSrc), t = g("contain", this.cornerPoints, e.image.width / e.image.height), i = I(...t), s = t.map((x) => x.clone().sub(i)), r = new F(s), n = (p = (u = this.videoMesh) == null ? void 0 : u.geometry.points[0].distanceTo(this.videoMesh.geometry.points[3])) != null ? p : 1 / 0, o = (w = (f = this.coverMesh) == null ? void 0 : f.geometry.points[0].distanceTo(this.coverMesh.geometry.points[3])) != null ? w : 1 / 0, d = this.cornerPoints[0].distanceTo(this.cornerPoints[3]), c = Math.min(n, o, d) / d * 0.3;
|
|
321
|
+
this.buttonMesh.geometry.dispose(), this.buttonMesh.geometry = r, this.buttonMesh.position.copy(new b(0, 0, 0)), this.buttonMesh.scale.set(c, c, c);
|
|
322
|
+
const v = P(t).multiplyScalar(T.Z_FIGHTING_OFFSET * 2);
|
|
323
|
+
this.buttonMesh.position.add(v);
|
|
293
324
|
});
|
|
294
325
|
}
|
|
295
326
|
}
|
|
296
327
|
export {
|
|
297
|
-
|
|
298
|
-
|
|
328
|
+
J as ImagePlane,
|
|
329
|
+
K as VideoPlane
|
|
299
330
|
};
|