@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.
@@ -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 y = (d, m, t) => m in d ? j(d, m, { enumerable: !0, configurable: !0, writable: !0, value: t }) : d[m] = t, I = (d, m) => {
6
- for (var t in m || (m = {}))
7
- k.call(m, t) && y(d, t, m[t]);
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(m))
10
- M.call(m, t) && y(d, t, m[t]);
9
+ for (var t of F(p))
10
+ M.call(p, t) && I(d, t, p[t]);
11
11
  return d;
12
- }, S = (d, m) => R(d, V(m));
13
- var b = (d, m, t) => (y(d, typeof m != "symbol" ? m + "" : m, t), t);
14
- var C = (d, m, t) => new Promise((o, i) => {
15
- var a = (r) => {
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
- e(t.next(r));
18
- } catch (p) {
19
- i(p);
17
+ o(t.next(r));
18
+ } catch (m) {
19
+ i(m);
20
20
  }
21
- }, n = (r) => {
21
+ }, a = (r) => {
22
22
  try {
23
- e(t.throw(r));
24
- } catch (p) {
25
- i(p);
23
+ o(t.throw(r));
24
+ } catch (m) {
25
+ i(m);
26
26
  }
27
- }, e = (r) => r.done ? o(r.value) : Promise.resolve(r.value).then(a, n);
28
- e((t = t.apply(d, m)).next());
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 w } from "../../../shared-utils/constants.js";
31
- import { CSS3DObjectPlus as O } from "../../../shared-utils/CSS3DRender/CSS3DObject.js";
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 _ } from "../../utils/planeNormal.js";
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, o) {
305
- super(t, o);
306
- b(this, "_floorIndex");
307
- b(this, "_floorIndexDirty", !0);
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 o, i, a, n, e, r;
320
- this.computeRenderType() === "Mesh" ? (this.initialSculpt(), ((i = (o = this.data.mediaData) == null ? void 0 : o[0]) == null ? void 0 : i.type) === "Video" ? this.renderVideoPlane() : ((n = (a = this.data.mediaData) == null ? void 0 : a[0]) == null ? void 0 : n.type) === "Image" ? this.renderImagePlane() : this.renderEmptyPlane()) : ((e = this.tag3DContentSvelte) == null || e.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));
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, o = !0) {
323
- super.set(t, o), x(this.five).then(() => {
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, a, n, e, r;
329
- super.setData(...t), this.computeRenderType() === "Mesh" ? ((a = (i = this.data.mediaData) == null ? void 0 : i[0]) == null ? void 0 : a.type) === "Video" ? this.renderVideoPlane() : ((e = (n = this.data.mediaData) == null ? void 0 : n[0]) == null ? void 0 : e.type) === "Image" ? this.renderImagePlane() : this.renderEmptyPlane() : (r = this.tag3DContentSvelte) == null || r.svelteApp.$set({ tag: this });
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((n) => {
344
+ this.five.observers.forEach((a) => {
335
345
  var r;
336
- const e = (r = n.floorIndex) != null ? r : 0;
337
- if (!t.has(e)) {
338
- const p = W(this.five, e);
339
- p.isEmpty() || t.set(e, p);
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 o = G(...this.position.map(T)), i = [], a = [];
343
- if (t.forEach((n, e) => {
344
- a.push({ floorIndex: e, box: n }), n.containsPoint(o) && i.push({ floorIndex: e, box: n });
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 n = 1 / 0, e = i[0].floorIndex;
349
- return i.forEach(({ floorIndex: r, box: p }) => {
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
- p.getCenter(h);
352
- const c = o.distanceTo(h);
353
- c < n && (n = c, e = r);
354
- }), e;
361
+ m.getCenter(h);
362
+ const c = e.distanceTo(h);
363
+ c < a && (a = c, o = r);
364
+ }), o;
355
365
  }
356
- if (a.length > 0) {
357
- let n = 1 / 0, e = a[0].floorIndex;
358
- return a.forEach(({ floorIndex: r, box: p }) => {
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
- p.getCenter(h);
361
- const c = o.distanceTo(h);
362
- c < n && (n = c, e = r);
363
- }), e;
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 o, i, a, n, e, r;
378
+ var e, i, n, a, o, r;
369
379
  if (yield x(this.five), this.computeRenderType() === "Mesh")
370
- this.initialSculpt(), ((i = (o = this.data.mediaData) == null ? void 0 : o[0]) == null ? void 0 : i.type) === "Video" ? this.renderVideoPlane() : ((n = (a = this.data.mediaData) == null ? void 0 : a[0]) == null ? void 0 : n.type) === "Image" ? this.renderImagePlane() : this.renderEmptyPlane();
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 p = this.position.map(T);
374
- (r = (e = this.tag3DContentSvelte) == null ? void 0 : e.dispose) == null || r.call(e);
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 = I({ mode: "front", cornerPoints: p, container: h }, this.config.tag3DConfig), P = this.computeRenderType() === "BehindDom" || c.mode === "behind" ? "behind" : "front", l = new O(S(I({}, c), { mode: P })), s = this.computeNormal();
378
- l.position.add(s.clone().setLength(w.Z_FIGHTING_OFFSET)), this.plugin.group.add(l);
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 o = $(), i = new q(
426
+ const e = $(), i = new q(
417
427
  {
418
- id: o,
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 a;
433
- (a = this.mediaPlane) == null || a.changePointsOrParams({ cornerPoints: i.data.points.map(g) });
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 o = t || this.position.map(g);
443
- (i = this.mediaPlane) == null || i.changePointsOrParams({ cornerPoints: o }), this.rectanglePlane.setData({
444
- points: o
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: o } = t;
453
- if (!o)
462
+ const { url: e } = t;
463
+ if (!e)
454
464
  return;
455
- const i = (h = this.data.objectFit) != null ? h : "contain", a = this.currentVisible, n = (() => !!(this.mediaPlane && !a))(), e = (() => !!(!this.mediaPlane && a))(), r = (() => !!(this.mediaPlane && (this.mediaPlane.src !== o || this.mediaPlane.objectFit !== i)))();
456
- (n || r) && this.mediaPlane && (this.plugin.imagePlaneGroup.remove(this.mediaPlane), this.mediaPlane.dispose(), this.mediaPlane.removeFromParent(), this.mediaPlane = void 0);
457
- const p = (() => !!(this.mediaPlane && this.mediaPlane.objectFit && this.mediaPlane.objectFit !== i))();
458
- if (e || r) {
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(o, 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 (p) {
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], o = (c = this.data.objectFit) != null ? c : "contain";
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 a = this.position.map(g);
505
- const n = this.currentVisible, e = (() => !!(this.mediaPlane && !n))(), r = (() => !!(!this.mediaPlane && n))(), p = (() => !!(this.mediaPlane && this.mediaPlane.src !== i))(), h = (() => !!(this.mediaPlane && this.mediaPlane.objectFit && this.mediaPlane.objectFit !== o))();
506
- if ((e || p) && this.mediaPlane && (this.plugin.imagePlaneGroup.remove(this.mediaPlane), this.mediaPlane.dispose(), this.mediaPlane.removeFromParent(), this.mediaPlane = void 0), (r || p) && (this.rectanglePlane && (a = this.rectanglePlane.data.points.map(g)), this.mediaPlane = new A(i, a, { objectFit: this.data.objectFit }), this.getConfig().clickable !== !1 && this.plugin.domEvents.addAutoBindEventListener(
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: o } });
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 _(this.position);
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;