@realsee/dnalogel 3.73.1-alpha.1 → 3.73.1-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/PlaneTag.d.ts +5 -0
- package/dist/PanoTagPlugin/utils/model/mediaPlane.d.ts +3 -0
- package/dist/index.cjs.js +36 -36
- package/dist/index.js +1661 -1620
- package/dist/index.umd.js +32 -32
- package/libs/PanoTagPlugin/Components/TagItem.js +231 -219
- package/libs/PanoTagPlugin/controller/Tag/PlaneTag.d.ts +5 -0
- package/libs/PanoTagPlugin/controller/Tag/PlaneTag.js +143 -131
- package/libs/PanoTagPlugin/utils/model/mediaPlane.d.ts +3 -0
- package/libs/PanoTagPlugin/utils/model/mediaPlane.js +119 -102
- package/libs/base/BasePlugin.js +1 -1
- package/libs/shared-utils/five/getFloorMesh.js +8 -8
- package/libs/shared-utils/logger.js +1 -1
- package/package.json +1 -1
|
@@ -9,7 +9,12 @@ export declare class PlaneTag<C extends TagContentType = TagContentType> extends
|
|
|
9
9
|
rectanglePlane?: Rectangle;
|
|
10
10
|
private _floorIndex?;
|
|
11
11
|
private _floorIndexDirty;
|
|
12
|
+
private _opacity?;
|
|
12
13
|
constructor(plugin: PanoTagPluginController, tagData: TagData);
|
|
14
|
+
/** 获取透明度 */
|
|
15
|
+
get opacity(): number;
|
|
16
|
+
/** 设置透明度 (0-1) */
|
|
17
|
+
set opacity(value: number);
|
|
13
18
|
/** 获取楼层索引(惰性计算 + 缓存) */
|
|
14
19
|
get floorIndex(): number | undefined;
|
|
15
20
|
/** 标记 floorIndex 需要重新计算(在位置等相关数据变化时调用) */
|
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
1
|
+
var k = Object.defineProperty, j = Object.defineProperties;
|
|
2
|
+
var R = Object.getOwnPropertyDescriptors;
|
|
3
3
|
var F = Object.getOwnPropertySymbols;
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
for (var t in
|
|
7
|
-
|
|
4
|
+
var V = Object.prototype.hasOwnProperty, w = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var I = (c, d, t) => d in c ? k(c, d, { enumerable: !0, configurable: !0, writable: !0, value: t }) : c[d] = t, b = (c, d) => {
|
|
6
|
+
for (var t in d || (d = {}))
|
|
7
|
+
V.call(d, t) && I(c, t, d[t]);
|
|
8
8
|
if (F)
|
|
9
|
-
for (var t of F(
|
|
10
|
-
|
|
11
|
-
return
|
|
12
|
-
}, S = (
|
|
13
|
-
var
|
|
14
|
-
var C = (
|
|
15
|
-
var
|
|
9
|
+
for (var t of F(d))
|
|
10
|
+
w.call(d, t) && I(c, t, d[t]);
|
|
11
|
+
return c;
|
|
12
|
+
}, S = (c, d) => j(c, R(d));
|
|
13
|
+
var y = (c, d, t) => (I(c, typeof d != "symbol" ? d + "" : d, t), t);
|
|
14
|
+
var C = (c, d, t) => new Promise((e, i) => {
|
|
15
|
+
var o = (r) => {
|
|
16
16
|
try {
|
|
17
|
-
|
|
18
|
-
} catch (
|
|
19
|
-
i(
|
|
17
|
+
m(t.next(r));
|
|
18
|
+
} catch (n) {
|
|
19
|
+
i(n);
|
|
20
20
|
}
|
|
21
|
-
},
|
|
21
|
+
}, l = (r) => {
|
|
22
22
|
try {
|
|
23
|
-
|
|
24
|
-
} catch (
|
|
25
|
-
i(
|
|
23
|
+
m(t.throw(r));
|
|
24
|
+
} catch (n) {
|
|
25
|
+
i(n);
|
|
26
26
|
}
|
|
27
|
-
},
|
|
28
|
-
|
|
27
|
+
}, m = (r) => r.done ? e(r.value) : Promise.resolve(r.value).then(o, l);
|
|
28
|
+
m((t = t.apply(c, d)).next());
|
|
29
29
|
});
|
|
30
|
-
import { CONST as
|
|
31
|
-
import { CSS3DObjectPlus as
|
|
32
|
-
import { anyPositionToVector3 as T, arrayPositionToVector3 as
|
|
30
|
+
import { CONST as M } from "../../../shared-utils/constants.js";
|
|
31
|
+
import { CSS3DObjectPlus as _ } from "../../../shared-utils/CSS3DRender/CSS3DObject.js";
|
|
32
|
+
import { anyPositionToVector3 as T, arrayPositionToVector3 as P } from "../../../shared-utils/positionToVector3.js";
|
|
33
33
|
import * as E from "three";
|
|
34
|
-
import { planeNormal as
|
|
34
|
+
import { planeNormal as O } from "../../utils/planeNormal.js";
|
|
35
35
|
import { centerPoint as G } from "../../../shared-utils/three/centerPoint.js";
|
|
36
36
|
import { VideoPlane as L, ImagePlane as A } from "../../utils/model/mediaPlane.js";
|
|
37
37
|
import N from "../../Components/Tag/index.js";
|
|
@@ -52,8 +52,8 @@ import { waitFiveModelLoaded as x } from "../../../shared-utils/five/fiveModelLo
|
|
|
52
52
|
import { uuid as $ } from "../../../shared-utils/uuid.js";
|
|
53
53
|
import "../../../shared-utils/five/FivePuppet.js";
|
|
54
54
|
import { Sculpt as U } from "../../../Sculpt/index.js";
|
|
55
|
-
import { Rectangle as
|
|
56
|
-
import { getFloorMesh as
|
|
55
|
+
import { Rectangle as W } from "../../../Sculpt/Objects/Rectangle/index.js";
|
|
56
|
+
import { getFloorMesh as q } from "../../../shared-utils/five/getFloorMesh.js";
|
|
57
57
|
import "../../../shared-utils/even.js";
|
|
58
58
|
import "../../../shared-utils/CSS3DRender/OpacityMesh.js";
|
|
59
59
|
import "../../../shared-utils/isNil.js";
|
|
@@ -301,12 +301,22 @@ import "../../../Sculpt/Editors/RectangleMeshEditor.js";
|
|
|
301
301
|
import "../../../Sculpt/utils/sortPositionsByCameraPosition.js";
|
|
302
302
|
const Z = /* @__PURE__ */ new Map(), z = /* @__PURE__ */ new Map();
|
|
303
303
|
class Xr extends B {
|
|
304
|
-
constructor(t,
|
|
305
|
-
super(t,
|
|
306
|
-
|
|
307
|
-
|
|
304
|
+
constructor(t, e) {
|
|
305
|
+
super(t, e);
|
|
306
|
+
y(this, "_floorIndex");
|
|
307
|
+
y(this, "_floorIndexDirty", !0);
|
|
308
|
+
y(this, "_opacity");
|
|
308
309
|
this.state.unfolded = !0, this.loadModel();
|
|
309
310
|
}
|
|
311
|
+
/** 获取透明度 */
|
|
312
|
+
get opacity() {
|
|
313
|
+
var t, e;
|
|
314
|
+
return this._opacity !== void 0 ? this._opacity : (e = (t = this.data) == null ? void 0 : t.opacity) != null ? e : 1;
|
|
315
|
+
}
|
|
316
|
+
/** 设置透明度 (0-1) */
|
|
317
|
+
set opacity(t) {
|
|
318
|
+
t !== this._opacity && (this._opacity = t, this.mediaPlane && (this.mediaPlane.opacity = t));
|
|
319
|
+
}
|
|
310
320
|
/** 获取楼层索引(惰性计算 + 缓存) */
|
|
311
321
|
get floorIndex() {
|
|
312
322
|
return (this._floorIndexDirty || this._floorIndex === void 0) && (this._floorIndex = this.computeFloorIndex(), this._floorIndexDirty = !1), this._floorIndex;
|
|
@@ -316,72 +326,73 @@ class Xr extends B {
|
|
|
316
326
|
this._floorIndexDirty = !0;
|
|
317
327
|
}
|
|
318
328
|
applyVisible() {
|
|
319
|
-
var
|
|
320
|
-
this.computeRenderType() === "Mesh" ? (this.initialSculpt(), ((i = (
|
|
329
|
+
var e, i, o, l, m, r;
|
|
330
|
+
this.computeRenderType() === "Mesh" ? (this.initialSculpt(), ((i = (e = this.data.mediaData) == null ? void 0 : e[0]) == null ? void 0 : i.type) === "Video" ? this.renderVideoPlane() : ((l = (o = this.data.mediaData) == null ? void 0 : o[0]) == null ? void 0 : l.type) === "Image" ? this.renderImagePlane() : this.renderEmptyPlane()) : ((m = this.tag3DContentSvelte) == null || m.svelteApp.$set({ tag: this, state: this.plugin.state, temporaryState: this.plugin.temporaryState }), (r = this.tag3DContentSvelte) != null && r.css3DInstance && (this.tag3DContentSvelte.css3DInstance.visible = this.visible, this.five.needsRender = !0));
|
|
321
331
|
}
|
|
322
|
-
set(t,
|
|
323
|
-
super.set(t,
|
|
332
|
+
set(t, e = !0) {
|
|
333
|
+
super.set(t, e), x(this.five).then(() => {
|
|
324
334
|
this.tag3DContentSvelte && (t.data ? this.tag3DContentSvelte.svelteApp.$set({ tag: this, state: this.plugin.state, temporaryState: this.plugin.temporaryState }) : t.position && this.loadModel());
|
|
325
335
|
});
|
|
326
336
|
}
|
|
327
337
|
setData(...t) {
|
|
328
|
-
var i,
|
|
329
|
-
super.setData(...t), this.computeRenderType() === "Mesh" ? ((
|
|
338
|
+
var i, o, l, m, r;
|
|
339
|
+
super.setData(...t), this.computeRenderType() === "Mesh" ? (((o = (i = this.data.mediaData) == null ? void 0 : i[0]) == null ? void 0 : o.type) === "Video" ? this.renderVideoPlane() : ((m = (l = this.data.mediaData) == null ? void 0 : l[0]) == null ? void 0 : m.type) === "Image" ? this.renderImagePlane() : this.renderEmptyPlane(), this.mediaPlane && (this.mediaPlane.opacity = this.opacity)) : (r = this.tag3DContentSvelte) == null || r.svelteApp.$set({ tag: this });
|
|
330
340
|
}
|
|
331
341
|
/** 计算楼层索引 */
|
|
332
342
|
computeFloorIndex() {
|
|
343
|
+
var m, r;
|
|
333
344
|
const t = /* @__PURE__ */ new Map();
|
|
334
|
-
this.five.observers.forEach((n) => {
|
|
335
|
-
var
|
|
336
|
-
const
|
|
337
|
-
if (!t.has(
|
|
338
|
-
const
|
|
339
|
-
|
|
345
|
+
((r = (m = this.five.works.getWork(this.workUtil.workCode)) == null ? void 0 : m.observers) != null ? r : []).forEach((n) => {
|
|
346
|
+
var h;
|
|
347
|
+
const s = (h = n.floorIndex) != null ? h : 0;
|
|
348
|
+
if (!t.has(s)) {
|
|
349
|
+
const u = q(this.five, s);
|
|
350
|
+
u.isEmpty() || t.set(s, u);
|
|
340
351
|
}
|
|
341
352
|
});
|
|
342
|
-
const
|
|
343
|
-
if (t.forEach((n,
|
|
344
|
-
|
|
345
|
-
}),
|
|
346
|
-
return
|
|
347
|
-
if (
|
|
348
|
-
let n = 1 / 0,
|
|
349
|
-
return
|
|
350
|
-
const
|
|
351
|
-
|
|
352
|
-
const
|
|
353
|
-
|
|
354
|
-
}),
|
|
353
|
+
const i = G(...this.position.map(T)), o = [], l = [];
|
|
354
|
+
if (t.forEach((n, s) => {
|
|
355
|
+
l.push({ floorIndex: s, box: n }), n.containsPoint(i) && o.push({ floorIndex: s, box: n });
|
|
356
|
+
}), o.length === 1)
|
|
357
|
+
return o[0].floorIndex;
|
|
358
|
+
if (o.length > 1) {
|
|
359
|
+
let n = 1 / 0, s = o[0].floorIndex;
|
|
360
|
+
return o.forEach(({ floorIndex: h, box: u }) => {
|
|
361
|
+
const p = new E.Vector3();
|
|
362
|
+
u.getCenter(p);
|
|
363
|
+
const a = i.distanceTo(p);
|
|
364
|
+
a < n && (n = a, s = h);
|
|
365
|
+
}), s;
|
|
355
366
|
}
|
|
356
|
-
if (
|
|
357
|
-
let n = 1 / 0,
|
|
358
|
-
return
|
|
359
|
-
const
|
|
360
|
-
|
|
361
|
-
const
|
|
362
|
-
|
|
363
|
-
}),
|
|
367
|
+
if (l.length > 0) {
|
|
368
|
+
let n = 1 / 0, s = l[0].floorIndex;
|
|
369
|
+
return l.forEach(({ floorIndex: h, box: u }) => {
|
|
370
|
+
const p = new E.Vector3();
|
|
371
|
+
u.getCenter(p);
|
|
372
|
+
const a = i.distanceTo(p);
|
|
373
|
+
a < n && (n = a, s = h);
|
|
374
|
+
}), s;
|
|
364
375
|
}
|
|
365
376
|
}
|
|
366
377
|
loadModel() {
|
|
367
378
|
return C(this, null, function* () {
|
|
368
|
-
var
|
|
379
|
+
var e, i, o, l, m, r;
|
|
369
380
|
if (yield x(this.five), this.computeRenderType() === "Mesh")
|
|
370
|
-
this.initialSculpt(), ((i = (
|
|
381
|
+
this.initialSculpt(), ((i = (e = this.data.mediaData) == null ? void 0 : e[0]) == null ? void 0 : i.type) === "Video" ? this.renderVideoPlane() : ((l = (o = this.data.mediaData) == null ? void 0 : o[0]) == null ? void 0 : l.type) === "Image" ? this.renderImagePlane() : this.renderEmptyPlane();
|
|
371
382
|
else {
|
|
372
383
|
H(this.five);
|
|
373
|
-
const
|
|
374
|
-
(r = (
|
|
375
|
-
const
|
|
376
|
-
|
|
377
|
-
const
|
|
378
|
-
|
|
384
|
+
const n = this.position.map(T);
|
|
385
|
+
(r = (m = this.tag3DContentSvelte) == null ? void 0 : m.dispose) == null || r.call(m);
|
|
386
|
+
const s = document.createElement("div");
|
|
387
|
+
s.classList.add("tag-media-container");
|
|
388
|
+
const h = b({ mode: "front", cornerPoints: n, container: s }, this.config.tag3DConfig), u = this.computeRenderType() === "BehindDom" || h.mode === "behind" ? "behind" : "front", p = new _(S(b({}, h), { mode: u })), a = this.computeNormal();
|
|
389
|
+
p.position.add(a.clone().setLength(M.Z_FIGHTING_OFFSET)), this.plugin.group.add(p);
|
|
379
390
|
let v;
|
|
380
|
-
|
|
381
|
-
this.plugin.hooks.emit("click", { event:
|
|
391
|
+
p.mode === "behind" && this.config.clickable !== !1 && (v = this.addObjectClickHandler(this, p, (g) => {
|
|
392
|
+
this.plugin.hooks.emit("click", { event: g, target: "TagContent", tag: this });
|
|
382
393
|
}));
|
|
383
|
-
const
|
|
384
|
-
target:
|
|
394
|
+
const f = new N({
|
|
395
|
+
target: s,
|
|
385
396
|
props: {
|
|
386
397
|
tag: this,
|
|
387
398
|
hooks: this.plugin.hooks,
|
|
@@ -392,15 +403,15 @@ class Xr extends B {
|
|
|
392
403
|
}
|
|
393
404
|
});
|
|
394
405
|
this.tag3DContentSvelte = {
|
|
395
|
-
svelteApp:
|
|
406
|
+
svelteApp: f,
|
|
396
407
|
domContainer: {
|
|
397
|
-
css3DObject:
|
|
408
|
+
css3DObject: p
|
|
398
409
|
},
|
|
399
|
-
css3DInstance:
|
|
400
|
-
initialNormal:
|
|
401
|
-
currentNormal:
|
|
410
|
+
css3DInstance: p,
|
|
411
|
+
initialNormal: a,
|
|
412
|
+
currentNormal: a,
|
|
402
413
|
dispose: () => {
|
|
403
|
-
|
|
414
|
+
f.$destroy(), p.dispose(), v == null || v();
|
|
404
415
|
}
|
|
405
416
|
}, this.five.needsRender = !0;
|
|
406
417
|
}
|
|
@@ -413,11 +424,11 @@ class Xr extends B {
|
|
|
413
424
|
magnifier: null
|
|
414
425
|
});
|
|
415
426
|
t.clear(), t.group.removeFromParent();
|
|
416
|
-
const
|
|
427
|
+
const e = $(), i = new W(
|
|
417
428
|
{
|
|
418
|
-
id:
|
|
429
|
+
id: e,
|
|
419
430
|
type: "Rectangle",
|
|
420
|
-
points: this.position.map(
|
|
431
|
+
points: this.position.map(P),
|
|
421
432
|
style: {
|
|
422
433
|
color: 2203620,
|
|
423
434
|
opacity: 0.1,
|
|
@@ -429,8 +440,8 @@ class Xr extends B {
|
|
|
429
440
|
}
|
|
430
441
|
);
|
|
431
442
|
i.visible = !1, this.plugin.imagePlaneGroup.add(i), this.rectanglePlane = i, i.editor.hooks.on("objectUpdate", () => {
|
|
432
|
-
var
|
|
433
|
-
(
|
|
443
|
+
var o;
|
|
444
|
+
(o = this.mediaPlane) == null || o.changePointsOrParams({ cornerPoints: i.data.points.map(P) });
|
|
434
445
|
}), i.editor.disable();
|
|
435
446
|
}
|
|
436
447
|
editorEnable() {
|
|
@@ -439,80 +450,81 @@ class Xr extends B {
|
|
|
439
450
|
editorDisable(t) {
|
|
440
451
|
var i;
|
|
441
452
|
this.rectanglePlane.visible = !1;
|
|
442
|
-
const
|
|
443
|
-
(i = this.mediaPlane) == null || i.changePointsOrParams({ cornerPoints:
|
|
444
|
-
points:
|
|
453
|
+
const e = t || this.position.map(P);
|
|
454
|
+
(i = this.mediaPlane) == null || i.changePointsOrParams({ cornerPoints: e }), this.rectanglePlane.setData({
|
|
455
|
+
points: e
|
|
445
456
|
}), this.rectanglePlane.editor.disable();
|
|
446
457
|
}
|
|
447
458
|
renderVideoPlane() {
|
|
448
|
-
var
|
|
459
|
+
var s, h, u;
|
|
449
460
|
const t = this.data.mediaData[0];
|
|
450
461
|
if (!t)
|
|
451
462
|
return;
|
|
452
|
-
const { url:
|
|
453
|
-
if (!
|
|
463
|
+
const { url: e } = t;
|
|
464
|
+
if (!e)
|
|
454
465
|
return;
|
|
455
|
-
const i = (
|
|
456
|
-
(
|
|
457
|
-
const
|
|
458
|
-
if (
|
|
459
|
-
let
|
|
460
|
-
this.rectanglePlane && (
|
|
461
|
-
const
|
|
466
|
+
const i = (s = this.data.objectFit) != null ? s : "contain", o = this.currentVisible, l = (() => !!(this.mediaPlane && !o))(), m = (() => !!(!this.mediaPlane && o))(), r = (() => !!(this.mediaPlane && (this.mediaPlane.src !== e || this.mediaPlane.objectFit !== i)))();
|
|
467
|
+
(l || r) && this.mediaPlane && (this.plugin.imagePlaneGroup.remove(this.mediaPlane), this.mediaPlane.dispose(), this.mediaPlane.removeFromParent(), this.mediaPlane = void 0);
|
|
468
|
+
const n = (() => !!(this.mediaPlane && this.mediaPlane.objectFit && this.mediaPlane.objectFit !== i))();
|
|
469
|
+
if (m || r) {
|
|
470
|
+
let p = this.position.map(P);
|
|
471
|
+
this.rectanglePlane && (p = this.rectanglePlane.data.points.map(P));
|
|
472
|
+
const a = new L(e, p, {
|
|
462
473
|
videoCoverSrc: t.videoCoverUrl,
|
|
463
474
|
playButton: this.data.playIcon,
|
|
464
|
-
paused: !((
|
|
475
|
+
paused: !((h = this.data.autoplayConfig) != null && h.autoplayVideo),
|
|
465
476
|
objectFit: this.data.objectFit,
|
|
466
477
|
videoTextureMap: Z,
|
|
467
478
|
ImageTextureMap: z,
|
|
468
|
-
domEvents: this.plugin.domEvents
|
|
479
|
+
domEvents: this.plugin.domEvents,
|
|
480
|
+
opacity: this.opacity
|
|
469
481
|
});
|
|
470
|
-
this.plugin.domEvents.addAutoBindEventListener(
|
|
471
|
-
var
|
|
472
|
-
!((
|
|
473
|
-
event:
|
|
482
|
+
this.plugin.domEvents.addAutoBindEventListener(a, "click", (f) => {
|
|
483
|
+
var g, D;
|
|
484
|
+
!((g = a.videoInstance) != null && g.paused) && ((D = a.videoInstance) == null ? void 0 : D.muted) === !1 && this.plugin.hooks.emit("playStateChange", {
|
|
485
|
+
event: f,
|
|
474
486
|
state: "playing",
|
|
475
487
|
tag: this,
|
|
476
|
-
mediaInstance:
|
|
488
|
+
mediaInstance: a.videoInstance
|
|
477
489
|
});
|
|
478
|
-
}),
|
|
479
|
-
|
|
480
|
-
this.plugin.mediaStore.set({ currentMediaElement:
|
|
481
|
-
}),
|
|
482
|
-
this.plugin.hooks.emit("playStateChange", { event:
|
|
483
|
-
}),
|
|
484
|
-
this.plugin.hooks.emit("playStateChange", { event:
|
|
490
|
+
}), a.onVideoReady = (f) => {
|
|
491
|
+
f.addEventListener("play", (g) => {
|
|
492
|
+
this.plugin.mediaStore.set({ currentMediaElement: a.videoInstance }), this.plugin.hooks.emit("playStateChange", { event: g, state: "playing", tag: this, mediaInstance: a.videoInstance });
|
|
493
|
+
}), f.addEventListener("pause", (g) => {
|
|
494
|
+
this.plugin.hooks.emit("playStateChange", { event: g, state: "paused", tag: this, mediaInstance: a.videoInstance });
|
|
495
|
+
}), f.addEventListener("ended", (g) => {
|
|
496
|
+
this.plugin.hooks.emit("playStateChange", { event: g, state: "paused", tag: this, mediaInstance: a.videoInstance });
|
|
485
497
|
});
|
|
486
498
|
};
|
|
487
|
-
const v = (
|
|
488
|
-
|
|
499
|
+
const v = (f) => (this.five.on("renderFrame", f), () => this.five.off("renderFrame", f));
|
|
500
|
+
a.initialRenderHooks(v), this.mediaPlane = a, this.play = () => a.play(), this.pause = () => a.pause(), this.plugin.imagePlaneGroup.add(this.mediaPlane);
|
|
489
501
|
}
|
|
490
|
-
if (
|
|
491
|
-
const
|
|
492
|
-
(
|
|
502
|
+
if (n) {
|
|
503
|
+
const p = this.rectanglePlane.data.points.map(P);
|
|
504
|
+
(u = this.mediaPlane) == null || u.changePointsOrParams({ cornerPoints: p, params: { objectFit: i } });
|
|
493
505
|
}
|
|
494
506
|
this.five.needsRender = !0;
|
|
495
507
|
}
|
|
496
508
|
renderImagePlane() {
|
|
497
|
-
var
|
|
498
|
-
const t = this.data.mediaData[0],
|
|
509
|
+
var h, u;
|
|
510
|
+
const t = this.data.mediaData[0], e = (h = this.data.objectFit) != null ? h : "contain";
|
|
499
511
|
if (!t)
|
|
500
512
|
return;
|
|
501
513
|
const { url: i } = t;
|
|
502
514
|
if (!i)
|
|
503
515
|
return;
|
|
504
|
-
let
|
|
505
|
-
const
|
|
506
|
-
if ((
|
|
516
|
+
let o = this.position.map(P);
|
|
517
|
+
const l = this.currentVisible, m = (() => !!(this.mediaPlane && !l))(), r = (() => !!(!this.mediaPlane && l))(), n = (() => !!(this.mediaPlane && this.mediaPlane.src !== i))(), s = (() => !!(this.mediaPlane && this.mediaPlane.objectFit && this.mediaPlane.objectFit !== e))();
|
|
518
|
+
if ((m || n) && this.mediaPlane && (this.plugin.imagePlaneGroup.remove(this.mediaPlane), this.mediaPlane.dispose(), this.mediaPlane.removeFromParent(), this.mediaPlane = void 0), (r || n) && (this.rectanglePlane && (o = this.rectanglePlane.data.points.map(P)), this.mediaPlane = new A(i, o, { objectFit: this.data.objectFit, opacity: this.opacity }), this.getConfig().clickable !== !1 && this.plugin.domEvents.addAutoBindEventListener(
|
|
507
519
|
this.mediaPlane,
|
|
508
520
|
"click",
|
|
509
|
-
(
|
|
510
|
-
this.plugin.hooks.emit("click", { tag: this, target: "TagContent", event:
|
|
521
|
+
(p) => {
|
|
522
|
+
this.plugin.hooks.emit("click", { tag: this, target: "TagContent", event: p.origDomEvent });
|
|
511
523
|
},
|
|
512
524
|
{ noEmitWhenHide: !0 }
|
|
513
|
-
), this.plugin.imagePlaneGroup.add(this.mediaPlane)),
|
|
514
|
-
const
|
|
515
|
-
(
|
|
525
|
+
), this.plugin.imagePlaneGroup.add(this.mediaPlane)), s) {
|
|
526
|
+
const p = this.rectanglePlane.data.points.map(P);
|
|
527
|
+
(u = this.mediaPlane) == null || u.changePointsOrParams({ cornerPoints: p, params: { objectFit: e } });
|
|
516
528
|
}
|
|
517
529
|
this.five.needsRender = !0;
|
|
518
530
|
}
|
|
@@ -520,7 +532,7 @@ class Xr extends B {
|
|
|
520
532
|
this.mediaPlane && (this.plugin.imagePlaneGroup.remove(this.mediaPlane), this.mediaPlane.dispose(), this.mediaPlane.removeFromParent(), this.mediaPlane = void 0);
|
|
521
533
|
}
|
|
522
534
|
computeNormal() {
|
|
523
|
-
return
|
|
535
|
+
return O(this.position);
|
|
524
536
|
}
|
|
525
537
|
}
|
|
526
538
|
export {
|
|
@@ -28,6 +28,7 @@ declare class ImagePlane extends MediaPlane {
|
|
|
28
28
|
constructor(imageSrc: string, cornerPoints: Vector3[], params?: {
|
|
29
29
|
objectFit?: ObjectFit;
|
|
30
30
|
resolveZFighting?: boolean;
|
|
31
|
+
opacity?: number;
|
|
31
32
|
});
|
|
32
33
|
changePointsOrParams(props: {
|
|
33
34
|
cornerPoints: Vector3[];
|
|
@@ -52,6 +53,7 @@ declare class VideoPlane extends MediaPlane {
|
|
|
52
53
|
private buttonMesh?;
|
|
53
54
|
private videoTextureMap;
|
|
54
55
|
private ImageTextureMap;
|
|
56
|
+
private initialOpacity;
|
|
55
57
|
constructor(videoSrc: string, cornerPoints: Vector3[], params?: {
|
|
56
58
|
paused?: boolean;
|
|
57
59
|
playButton?: 'withText' | 'withoutText' | string;
|
|
@@ -63,6 +65,7 @@ declare class VideoPlane extends MediaPlane {
|
|
|
63
65
|
transparent: boolean;
|
|
64
66
|
}>;
|
|
65
67
|
domEvents?: FiveDomEvents;
|
|
68
|
+
opacity?: number;
|
|
66
69
|
});
|
|
67
70
|
play(muted?: boolean): Promise<void>;
|
|
68
71
|
pause(): void;
|