@realsee/dnalogel 3.73.1-alpha.1 → 3.73.1-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.
- 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 +1628 -1588
- 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 +91 -80
- 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/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 需要重新计算(在位置等相关数据变化时调用) */
|
|
@@ -2,36 +2,36 @@ var j = Object.defineProperty, R = Object.defineProperties;
|
|
|
2
2
|
var V = Object.getOwnPropertyDescriptors;
|
|
3
3
|
var F = Object.getOwnPropertySymbols;
|
|
4
4
|
var k = Object.prototype.hasOwnProperty, M = Object.prototype.propertyIsEnumerable;
|
|
5
|
-
var
|
|
6
|
-
for (var t in
|
|
7
|
-
k.call(
|
|
5
|
+
var I = (d, p, t) => p in d ? j(d, p, { enumerable: !0, configurable: !0, writable: !0, value: t }) : d[p] = t, b = (d, p) => {
|
|
6
|
+
for (var t in p || (p = {}))
|
|
7
|
+
k.call(p, t) && I(d, t, p[t]);
|
|
8
8
|
if (F)
|
|
9
|
-
for (var t of F(
|
|
10
|
-
M.call(
|
|
9
|
+
for (var t of F(p))
|
|
10
|
+
M.call(p, t) && I(d, t, p[t]);
|
|
11
11
|
return d;
|
|
12
|
-
}, S = (d,
|
|
13
|
-
var
|
|
14
|
-
var C = (d,
|
|
15
|
-
var
|
|
12
|
+
}, S = (d, p) => R(d, V(p));
|
|
13
|
+
var y = (d, p, t) => (I(d, typeof p != "symbol" ? p + "" : p, t), t);
|
|
14
|
+
var C = (d, p, t) => new Promise((e, i) => {
|
|
15
|
+
var n = (r) => {
|
|
16
16
|
try {
|
|
17
|
-
|
|
18
|
-
} catch (
|
|
19
|
-
i(
|
|
17
|
+
o(t.next(r));
|
|
18
|
+
} catch (m) {
|
|
19
|
+
i(m);
|
|
20
20
|
}
|
|
21
|
-
},
|
|
21
|
+
}, a = (r) => {
|
|
22
22
|
try {
|
|
23
|
-
|
|
24
|
-
} catch (
|
|
25
|
-
i(
|
|
23
|
+
o(t.throw(r));
|
|
24
|
+
} catch (m) {
|
|
25
|
+
i(m);
|
|
26
26
|
}
|
|
27
|
-
},
|
|
28
|
-
|
|
27
|
+
}, o = (r) => r.done ? e(r.value) : Promise.resolve(r.value).then(n, a);
|
|
28
|
+
o((t = t.apply(d, p)).next());
|
|
29
29
|
});
|
|
30
|
-
import { CONST as
|
|
31
|
-
import { CSS3DObjectPlus as
|
|
30
|
+
import { CONST as _ } from "../../../shared-utils/constants.js";
|
|
31
|
+
import { CSS3DObjectPlus as w } from "../../../shared-utils/CSS3DRender/CSS3DObject.js";
|
|
32
32
|
import { anyPositionToVector3 as T, arrayPositionToVector3 as g } 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";
|
|
@@ -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,66 +326,66 @@ 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, n, a, o, 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() : ((a = (n = this.data.mediaData) == null ? void 0 : n[0]) == null ? void 0 : a.type) === "Image" ? this.renderImagePlane() : this.renderEmptyPlane()) : ((o = this.tag3DContentSvelte) == null || o.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, n, a, o, r;
|
|
339
|
+
super.setData(...t), this.computeRenderType() === "Mesh" ? (((n = (i = this.data.mediaData) == null ? void 0 : i[0]) == null ? void 0 : n.type) === "Video" ? this.renderVideoPlane() : ((o = (a = this.data.mediaData) == null ? void 0 : a[0]) == null ? void 0 : o.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() {
|
|
333
343
|
const t = /* @__PURE__ */ new Map();
|
|
334
|
-
this.five.observers.forEach((
|
|
344
|
+
this.five.observers.forEach((a) => {
|
|
335
345
|
var r;
|
|
336
|
-
const
|
|
337
|
-
if (!t.has(
|
|
338
|
-
const
|
|
339
|
-
|
|
346
|
+
const o = (r = a.floorIndex) != null ? r : 0;
|
|
347
|
+
if (!t.has(o)) {
|
|
348
|
+
const m = W(this.five, o);
|
|
349
|
+
m.isEmpty() || t.set(o, m);
|
|
340
350
|
}
|
|
341
351
|
});
|
|
342
|
-
const
|
|
343
|
-
if (t.forEach((
|
|
344
|
-
|
|
352
|
+
const e = G(...this.position.map(T)), i = [], n = [];
|
|
353
|
+
if (t.forEach((a, o) => {
|
|
354
|
+
n.push({ floorIndex: o, box: a }), a.containsPoint(e) && i.push({ floorIndex: o, box: a });
|
|
345
355
|
}), i.length === 1)
|
|
346
356
|
return i[0].floorIndex;
|
|
347
357
|
if (i.length > 1) {
|
|
348
|
-
let
|
|
349
|
-
return i.forEach(({ floorIndex: r, box:
|
|
358
|
+
let a = 1 / 0, o = i[0].floorIndex;
|
|
359
|
+
return i.forEach(({ floorIndex: r, box: m }) => {
|
|
350
360
|
const h = new E.Vector3();
|
|
351
|
-
|
|
352
|
-
const c =
|
|
353
|
-
c <
|
|
354
|
-
}),
|
|
361
|
+
m.getCenter(h);
|
|
362
|
+
const c = e.distanceTo(h);
|
|
363
|
+
c < a && (a = c, o = r);
|
|
364
|
+
}), o;
|
|
355
365
|
}
|
|
356
|
-
if (
|
|
357
|
-
let
|
|
358
|
-
return
|
|
366
|
+
if (n.length > 0) {
|
|
367
|
+
let a = 1 / 0, o = n[0].floorIndex;
|
|
368
|
+
return n.forEach(({ floorIndex: r, box: m }) => {
|
|
359
369
|
const h = new E.Vector3();
|
|
360
|
-
|
|
361
|
-
const c =
|
|
362
|
-
c <
|
|
363
|
-
}),
|
|
370
|
+
m.getCenter(h);
|
|
371
|
+
const c = e.distanceTo(h);
|
|
372
|
+
c < a && (a = c, o = r);
|
|
373
|
+
}), o;
|
|
364
374
|
}
|
|
365
375
|
}
|
|
366
376
|
loadModel() {
|
|
367
377
|
return C(this, null, function* () {
|
|
368
|
-
var
|
|
378
|
+
var e, i, n, a, o, r;
|
|
369
379
|
if (yield x(this.five), this.computeRenderType() === "Mesh")
|
|
370
|
-
this.initialSculpt(), ((i = (
|
|
380
|
+
this.initialSculpt(), ((i = (e = this.data.mediaData) == null ? void 0 : e[0]) == null ? void 0 : i.type) === "Video" ? this.renderVideoPlane() : ((a = (n = this.data.mediaData) == null ? void 0 : n[0]) == null ? void 0 : a.type) === "Image" ? this.renderImagePlane() : this.renderEmptyPlane();
|
|
371
381
|
else {
|
|
372
382
|
H(this.five);
|
|
373
|
-
const
|
|
374
|
-
(r = (
|
|
383
|
+
const m = this.position.map(T);
|
|
384
|
+
(r = (o = this.tag3DContentSvelte) == null ? void 0 : o.dispose) == null || r.call(o);
|
|
375
385
|
const h = document.createElement("div");
|
|
376
386
|
h.classList.add("tag-media-container");
|
|
377
|
-
const c =
|
|
378
|
-
l.position.add(s.clone().setLength(
|
|
387
|
+
const c = b({ mode: "front", cornerPoints: m, container: h }, this.config.tag3DConfig), P = this.computeRenderType() === "BehindDom" || c.mode === "behind" ? "behind" : "front", l = new w(S(b({}, c), { mode: P })), s = this.computeNormal();
|
|
388
|
+
l.position.add(s.clone().setLength(_.Z_FIGHTING_OFFSET)), this.plugin.group.add(l);
|
|
379
389
|
let v;
|
|
380
390
|
l.mode === "behind" && this.config.clickable !== !1 && (v = this.addObjectClickHandler(this, l, (f) => {
|
|
381
391
|
this.plugin.hooks.emit("click", { event: f, target: "TagContent", tag: this });
|
|
@@ -413,9 +423,9 @@ class Xr extends B {
|
|
|
413
423
|
magnifier: null
|
|
414
424
|
});
|
|
415
425
|
t.clear(), t.group.removeFromParent();
|
|
416
|
-
const
|
|
426
|
+
const e = $(), i = new q(
|
|
417
427
|
{
|
|
418
|
-
id:
|
|
428
|
+
id: e,
|
|
419
429
|
type: "Rectangle",
|
|
420
430
|
points: this.position.map(g),
|
|
421
431
|
style: {
|
|
@@ -429,8 +439,8 @@ class Xr extends B {
|
|
|
429
439
|
}
|
|
430
440
|
);
|
|
431
441
|
i.visible = !1, this.plugin.imagePlaneGroup.add(i), this.rectanglePlane = i, i.editor.hooks.on("objectUpdate", () => {
|
|
432
|
-
var
|
|
433
|
-
(
|
|
442
|
+
var n;
|
|
443
|
+
(n = this.mediaPlane) == null || n.changePointsOrParams({ cornerPoints: i.data.points.map(g) });
|
|
434
444
|
}), i.editor.disable();
|
|
435
445
|
}
|
|
436
446
|
editorEnable() {
|
|
@@ -439,9 +449,9 @@ class Xr extends B {
|
|
|
439
449
|
editorDisable(t) {
|
|
440
450
|
var i;
|
|
441
451
|
this.rectanglePlane.visible = !1;
|
|
442
|
-
const
|
|
443
|
-
(i = this.mediaPlane) == null || i.changePointsOrParams({ cornerPoints:
|
|
444
|
-
points:
|
|
452
|
+
const e = t || this.position.map(g);
|
|
453
|
+
(i = this.mediaPlane) == null || i.changePointsOrParams({ cornerPoints: e }), this.rectanglePlane.setData({
|
|
454
|
+
points: e
|
|
445
455
|
}), this.rectanglePlane.editor.disable();
|
|
446
456
|
}
|
|
447
457
|
renderVideoPlane() {
|
|
@@ -449,23 +459,24 @@ class Xr extends B {
|
|
|
449
459
|
const t = this.data.mediaData[0];
|
|
450
460
|
if (!t)
|
|
451
461
|
return;
|
|
452
|
-
const { url:
|
|
453
|
-
if (!
|
|
462
|
+
const { url: e } = t;
|
|
463
|
+
if (!e)
|
|
454
464
|
return;
|
|
455
|
-
const i = (h = this.data.objectFit) != null ? h : "contain",
|
|
456
|
-
(
|
|
457
|
-
const
|
|
458
|
-
if (
|
|
465
|
+
const i = (h = this.data.objectFit) != null ? h : "contain", n = this.currentVisible, a = (() => !!(this.mediaPlane && !n))(), o = (() => !!(!this.mediaPlane && n))(), r = (() => !!(this.mediaPlane && (this.mediaPlane.src !== e || this.mediaPlane.objectFit !== i)))();
|
|
466
|
+
(a || r) && this.mediaPlane && (this.plugin.imagePlaneGroup.remove(this.mediaPlane), this.mediaPlane.dispose(), this.mediaPlane.removeFromParent(), this.mediaPlane = void 0);
|
|
467
|
+
const m = (() => !!(this.mediaPlane && this.mediaPlane.objectFit && this.mediaPlane.objectFit !== i))();
|
|
468
|
+
if (o || r) {
|
|
459
469
|
let l = this.position.map(g);
|
|
460
470
|
this.rectanglePlane && (l = this.rectanglePlane.data.points.map(g));
|
|
461
|
-
const s = new L(
|
|
471
|
+
const s = new L(e, l, {
|
|
462
472
|
videoCoverSrc: t.videoCoverUrl,
|
|
463
473
|
playButton: this.data.playIcon,
|
|
464
474
|
paused: !((c = this.data.autoplayConfig) != null && c.autoplayVideo),
|
|
465
475
|
objectFit: this.data.objectFit,
|
|
466
476
|
videoTextureMap: Z,
|
|
467
477
|
ImageTextureMap: z,
|
|
468
|
-
domEvents: this.plugin.domEvents
|
|
478
|
+
domEvents: this.plugin.domEvents,
|
|
479
|
+
opacity: this.opacity
|
|
469
480
|
});
|
|
470
481
|
this.plugin.domEvents.addAutoBindEventListener(s, "click", (u) => {
|
|
471
482
|
var f, D;
|
|
@@ -487,7 +498,7 @@ class Xr extends B {
|
|
|
487
498
|
const v = (u) => (this.five.on("renderFrame", u), () => this.five.off("renderFrame", u));
|
|
488
499
|
s.initialRenderHooks(v), this.mediaPlane = s, this.play = () => s.play(), this.pause = () => s.pause(), this.plugin.imagePlaneGroup.add(this.mediaPlane);
|
|
489
500
|
}
|
|
490
|
-
if (
|
|
501
|
+
if (m) {
|
|
491
502
|
const l = this.rectanglePlane.data.points.map(g);
|
|
492
503
|
(P = this.mediaPlane) == null || P.changePointsOrParams({ cornerPoints: l, params: { objectFit: i } });
|
|
493
504
|
}
|
|
@@ -495,15 +506,15 @@ class Xr extends B {
|
|
|
495
506
|
}
|
|
496
507
|
renderImagePlane() {
|
|
497
508
|
var c, P;
|
|
498
|
-
const t = this.data.mediaData[0],
|
|
509
|
+
const t = this.data.mediaData[0], e = (c = this.data.objectFit) != null ? c : "contain";
|
|
499
510
|
if (!t)
|
|
500
511
|
return;
|
|
501
512
|
const { url: i } = t;
|
|
502
513
|
if (!i)
|
|
503
514
|
return;
|
|
504
|
-
let
|
|
505
|
-
const
|
|
506
|
-
if ((
|
|
515
|
+
let n = this.position.map(g);
|
|
516
|
+
const a = this.currentVisible, o = (() => !!(this.mediaPlane && !a))(), r = (() => !!(!this.mediaPlane && a))(), m = (() => !!(this.mediaPlane && this.mediaPlane.src !== i))(), h = (() => !!(this.mediaPlane && this.mediaPlane.objectFit && this.mediaPlane.objectFit !== e))();
|
|
517
|
+
if ((o || m) && this.mediaPlane && (this.plugin.imagePlaneGroup.remove(this.mediaPlane), this.mediaPlane.dispose(), this.mediaPlane.removeFromParent(), this.mediaPlane = void 0), (r || m) && (this.rectanglePlane && (n = this.rectanglePlane.data.points.map(g)), this.mediaPlane = new A(i, n, { objectFit: this.data.objectFit, opacity: this.opacity }), this.getConfig().clickable !== !1 && this.plugin.domEvents.addAutoBindEventListener(
|
|
507
518
|
this.mediaPlane,
|
|
508
519
|
"click",
|
|
509
520
|
(l) => {
|
|
@@ -512,7 +523,7 @@ class Xr extends B {
|
|
|
512
523
|
{ noEmitWhenHide: !0 }
|
|
513
524
|
), this.plugin.imagePlaneGroup.add(this.mediaPlane)), h) {
|
|
514
525
|
const l = this.rectanglePlane.data.points.map(g);
|
|
515
|
-
(P = this.mediaPlane) == null || P.changePointsOrParams({ cornerPoints: l, params: { objectFit:
|
|
526
|
+
(P = this.mediaPlane) == null || P.changePointsOrParams({ cornerPoints: l, params: { objectFit: e } });
|
|
516
527
|
}
|
|
517
528
|
this.five.needsRender = !0;
|
|
518
529
|
}
|
|
@@ -520,7 +531,7 @@ class Xr extends B {
|
|
|
520
531
|
this.mediaPlane && (this.plugin.imagePlaneGroup.remove(this.mediaPlane), this.mediaPlane.dispose(), this.mediaPlane.removeFromParent(), this.mediaPlane = void 0);
|
|
521
532
|
}
|
|
522
533
|
computeNormal() {
|
|
523
|
-
return
|
|
534
|
+
return O(this.position);
|
|
524
535
|
}
|
|
525
536
|
}
|
|
526
537
|
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;
|