@realsee/dnalogel 3.3.4 → 3.3.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.
@@ -1,40 +1,40 @@
1
- var V = Object.defineProperty;
1
+ var A = Object.defineProperty;
2
2
  var R = Object.getOwnPropertySymbols;
3
- var E = Object.prototype.hasOwnProperty, A = Object.prototype.propertyIsEnumerable;
4
- var C = (c, l, t) => l in c ? V(c, l, { enumerable: !0, configurable: !0, writable: !0, value: t }) : c[l] = t, j = (c, l) => {
3
+ var V = Object.prototype.hasOwnProperty, E = Object.prototype.propertyIsEnumerable;
4
+ var C = (c, l, t) => l in c ? A(c, l, { enumerable: !0, configurable: !0, writable: !0, value: t }) : c[l] = t, j = (c, l) => {
5
5
  for (var t in l || (l = {}))
6
- E.call(l, t) && C(c, t, l[t]);
6
+ V.call(l, t) && C(c, t, l[t]);
7
7
  if (R)
8
8
  for (var t of R(l))
9
- A.call(l, t) && C(c, t, l[t]);
9
+ E.call(l, t) && C(c, t, l[t]);
10
10
  return c;
11
11
  };
12
12
  var f = (c, l, t) => (C(c, typeof l != "symbol" ? l + "" : l, t), t);
13
13
  var S = (c, l, t) => new Promise((e, o) => {
14
- var i = (r) => {
14
+ var i = (s) => {
15
15
  try {
16
- a(t.next(r));
16
+ a(t.next(s));
17
17
  } catch (n) {
18
18
  o(n);
19
19
  }
20
- }, s = (r) => {
20
+ }, r = (s) => {
21
21
  try {
22
- a(t.throw(r));
22
+ a(t.throw(s));
23
23
  } catch (n) {
24
24
  o(n);
25
25
  }
26
- }, a = (r) => r.done ? e(r.value) : Promise.resolve(r.value).then(i, s);
26
+ }, a = (s) => s.done ? e(s.value) : Promise.resolve(s.value).then(i, r);
27
27
  a((t = t.apply(c, l)).next());
28
28
  });
29
- import { TagComputer as x } from "./TagComputer.js";
30
- import { Group as y, Quaternion as O, Vector3 as b, Matrix4 as v } from "three";
31
- import I from "../Components/TagContainer.js";
29
+ import { TagComputer as I } from "./TagComputer.js";
30
+ import { Group as y, Quaternion as O, Vector3 as T, Matrix4 as v } from "three";
31
+ import x from "../Components/TagContainer.js";
32
32
  import G from "../Components/Tag/index.js";
33
33
  import { CSS3DRenderPlugin as F } from "../../CSS3DRenderPlugin/index.js";
34
- import { loadGLTF as L } from "../../shared-utils/three/GLTFLoader.js";
35
- import { isMediaModelTag as D, isStickModelTag as W } from "../utils/tag/tagCheck.js";
34
+ import { loadGLTF as _ } from "../../shared-utils/three/GLTFLoader.js";
35
+ import { isMediaModelTag as D, isStickModelTag as L } from "../utils/tag/tagCheck.js";
36
36
  import { VideoPlane as w, ImagePlane as k } from "../utils/model/mediaPlane.js";
37
- import { centerPoint as $ } from "../../shared-utils/three/centerPoint.js";
37
+ import { centerPoint as W } from "../../shared-utils/three/centerPoint.js";
38
38
  import { arrayPositionToVector3 as g } from "../../shared-utils/positionToVector3.js";
39
39
  import "../utils/tagPosition.js";
40
40
  import "../utils/checkRange.js";
@@ -158,8 +158,8 @@ import "../Components/Tag/CustomTag.js";
158
158
  import "../../CSS3DRenderPlugin/Controller.js";
159
159
  import "../../CSS3DRenderPlugin/utils/waitFiveModelLoaded.js";
160
160
  import "@realsee/five/gltf-loader";
161
- const q = /* @__PURE__ */ new Map(), B = /* @__PURE__ */ new Map();
162
- class ui extends x {
161
+ const $ = /* @__PURE__ */ new Map(), q = /* @__PURE__ */ new Map();
162
+ class ui extends I {
163
163
  constructor(t) {
164
164
  super(t);
165
165
  f(this, "group", new y());
@@ -179,13 +179,13 @@ class ui extends x {
179
179
  if (!e)
180
180
  return;
181
181
  t.loading = !0;
182
- const o = L(e).then((r) => {
182
+ const o = _(e).then((s) => {
183
183
  var m;
184
- const n = Object.assign(r.scene, {
184
+ const n = Object.assign(s.scene, {
185
185
  customID: t.id,
186
186
  isTagModel: !0,
187
187
  removeEventListener: this.getTagConfig(t).clickable === !1 ? () => {
188
- } : this.addObjectClickHandler(t, r.scene, (h) => {
188
+ } : this.addObjectClickHandler(t, s.scene, (h) => {
189
189
  this.hooks.emit("click", { target: "TagModel", tag: t, event: h });
190
190
  })
191
191
  });
@@ -196,14 +196,14 @@ class ui extends x {
196
196
  if (t.loading = !1, ((a = t.model) == null ? void 0 : a.promise) !== o || !this.tags.includes(t))
197
197
  return;
198
198
  t.model.object = i;
199
- const s = this.gltfObjectGroup.children.find((r) => r.customID === t.id);
200
- if (s && (this.gltfObjectGroup.remove(s), s.removeEventListener()), this.updateRender3DDomTag(), D(t)) {
199
+ const r = this.gltfObjectGroup.children.find((s) => s.customID === t.id);
200
+ if (r && (this.gltfObjectGroup.remove(r), r.removeEventListener()), this.updateRender3DDomTag(), D(t)) {
201
201
  if (this.getRenderType(t) === "Mesh" && !t.mediaPlane) {
202
- const r = t.data.mediaPosition.map(g);
202
+ const s = t.data.mediaPosition.map(g);
203
203
  t.mediaPlane = new k(t.data.mediaData[0].url, t.data.mediaPosition.map(g), {
204
204
  objectFit: t.data.objectFit
205
205
  });
206
- const n = new b().addVectors(r[0], r[2]).divideScalar(2);
206
+ const n = new T().addVectors(s[0], s[2]).divideScalar(2);
207
207
  t.mediaPlane.position.copy(n), i.add(t.mediaPlane);
208
208
  }
209
209
  this.getRenderType(t) !== "Mesh" && (i.updateTagCss3DObjectMatrix = () => this.updateTagCss3DObjectMatrix(t, i), i.updateTagCss3DObjectMatrix());
@@ -248,22 +248,22 @@ class ui extends x {
248
248
  if (!i)
249
249
  return;
250
250
  e.mediaPlane && !((h = (m = e.state) == null ? void 0 : m.visible) == null || h) && e.mediaPlane instanceof w && e.mediaPlane.pause();
251
- const s = e.position.map(g), a = this.getCurrentVisibleState(e), r = (() => !!(e.mediaPlane && !a))(), n = (() => !!(!e.mediaPlane && a))(), p = (() => !!(e.mediaPlane && e.mediaPlane.src !== i))();
252
- if ((r || p) && e.mediaPlane && (this.imagePlaneGroup.remove(e.mediaPlane), e.mediaPlane.dispose(), e.mediaPlane.removeFromParent(), e.mediaPlane = void 0), n || p) {
253
- const d = new w(i, s, {
251
+ const r = e.position.map(g), a = this.getCurrentVisibleState(e), s = (() => !!(e.mediaPlane && !a))(), n = (() => !!(!e.mediaPlane && a))(), d = (() => !!(e.mediaPlane && e.mediaPlane.src !== i))();
252
+ if ((s || d) && e.mediaPlane && (this.imagePlaneGroup.remove(e.mediaPlane), e.mediaPlane.dispose(), e.mediaPlane.removeFromParent(), e.mediaPlane = void 0), n || d) {
253
+ const p = new w(i, r, {
254
254
  videoCoverSrc: o.videoCoverUrl,
255
255
  playButton: e.data.playIcon,
256
256
  paused: !((P = e.data.autoplayConfig) != null && P.autoplayVideo),
257
257
  objectFit: e.data.objectFit,
258
- videoTextureMap: q,
259
- ImageTextureMap: B,
258
+ videoTextureMap: $,
259
+ ImageTextureMap: q,
260
260
  domEvents: this.domEvents
261
261
  });
262
- d.onVideoReady = (u) => {
263
- u.addEventListener("play", () => this.mediaStore.set({ currentMediaElement: d.videoInstance }));
262
+ p.onVideoReady = (u) => {
263
+ u.addEventListener("play", () => this.mediaStore.set({ currentMediaElement: p.videoInstance }));
264
264
  };
265
- const T = (u) => (this.five.on("renderFrame", u), () => this.five.off("renderFrame", u));
266
- d.initialRenderHooks(T), e.mediaPlane = d, this.imagePlaneGroup.add(e.mediaPlane);
265
+ const b = (u) => (this.five.on("renderFrame", u), () => this.five.off("renderFrame", u));
266
+ p.initialRenderHooks(b), e.mediaPlane = p, this.imagePlaneGroup.add(e.mediaPlane);
267
267
  }
268
268
  });
269
269
  }
@@ -278,9 +278,9 @@ class ui extends x {
278
278
  const { url: o } = e.data.mediaData[0];
279
279
  if (!o)
280
280
  return;
281
- const i = e.position.map(g), s = this.getCurrentVisibleState(e), a = (() => !!(e.mediaPlane && !s))(), r = (() => !!(!e.mediaPlane && s))(), n = (() => !!(e.mediaPlane && e.mediaPlane.src !== o))();
282
- (a || n) && e.mediaPlane && (this.imagePlaneGroup.remove(e.mediaPlane), e.mediaPlane.dispose(), e.mediaPlane.removeFromParent(), e.mediaPlane = void 0), (r || n) && (e.mediaPlane = new k(o, i, { objectFit: e.data.objectFit }), this.getTagConfig(e).clickable !== !1 && this.domEvents.addAutoBindEventListener(e.mediaPlane, "click", (p) => {
283
- this.hooks.emit("click", { tag: e, target: "TagContent", event: p.origDomEvent });
281
+ const i = e.position.map(g), r = this.getCurrentVisibleState(e), a = (() => !!(e.mediaPlane && !r))(), s = (() => !!(!e.mediaPlane && r))(), n = (() => !!(e.mediaPlane && e.mediaPlane.src !== o))();
282
+ (a || n) && e.mediaPlane && (this.imagePlaneGroup.remove(e.mediaPlane), e.mediaPlane.dispose(), e.mediaPlane.removeFromParent(), e.mediaPlane = void 0), (s || n) && (e.mediaPlane = new k(o, i, { objectFit: e.data.objectFit }), this.getTagConfig(e).clickable !== !1 && this.domEvents.addAutoBindEventListener(e.mediaPlane, "click", (d) => {
283
+ this.hooks.emit("click", { tag: e, target: "TagContent", event: d.origDomEvent });
284
284
  }), this.imagePlaneGroup.add(e.mediaPlane));
285
285
  });
286
286
  }
@@ -289,12 +289,12 @@ class ui extends x {
289
289
  */
290
290
  updateRender3DDomTag() {
291
291
  this.filterCSS3DTag.forEach((e) => {
292
- var o, i, s;
292
+ var o, i, r;
293
293
  if (e.tag3DContentSvelte) {
294
- const { svelteApp: a, css3DInstance: r, initialNormal: n, currentNormal: p } = e.tag3DContentSvelte;
295
- if (a.$set({ tag: e, hooks: this.hooks, state: this.state, temporaryState: this.temporaryState }), !n.equals(p)) {
296
- const m = new O().setFromUnitVectors(n, p);
297
- r.css3DObject.setRotationFromQuaternion(m);
294
+ const { svelteApp: a, css3DInstance: s, initialNormal: n, currentNormal: d } = e.tag3DContentSvelte;
295
+ if (a.$set({ tag: e, hooks: this.hooks, state: this.state, temporaryState: this.temporaryState }), !n.equals(d)) {
296
+ const m = new O().setFromUnitVectors(n, d);
297
+ s.css3DObject.setRotationFromQuaternion(m);
298
298
  }
299
299
  return;
300
300
  } else {
@@ -305,24 +305,24 @@ class ui extends x {
305
305
  const a = this.getPositions(e);
306
306
  if (!a)
307
307
  return;
308
- const r = this.getTagNormal(e);
309
- if (!r)
308
+ const s = this.getTagNormal(e);
309
+ if (!s)
310
310
  return;
311
- const n = this.getTagConfig(e), p = j({ wrapperStyle: { zIndex: this.calculateTagZIndex(e).toString() } }, n.tag3DConfig);
312
- if (this.getRenderType(e) === "BehindDom" || p.mode === "behind") {
313
- p.mode = "behind", p.container = document.createElement("div");
311
+ const n = this.getTagConfig(e), d = j({ wrapperStyle: { zIndex: this.calculateTagZIndex(e).toString() } }, n.tag3DConfig);
312
+ if (this.getRenderType(e) === "BehindDom" || d.mode === "behind") {
313
+ d.mode = "behind", d.container = document.createElement("div");
314
314
  const P = "black";
315
- p.container.style.backgroundColor = P, p.container.style.border = `3px solid ${P}`, this.css3DRenderPlugin.hooks.on("render", () => {
316
- var d;
315
+ d.container.style.backgroundColor = P, d.container.style.border = `3px solid ${P}`, this.css3DRenderPlugin.hooks.on("render", () => {
316
+ var p;
317
317
  if (m.css3DObject.opacityMesh && n.clickable !== !1) {
318
- const T = this.addObjectClickHandler(e, m.css3DObject.opacityMesh, (u) => {
318
+ const b = this.addObjectClickHandler(e, m.css3DObject.opacityMesh, (u) => {
319
319
  this.hooks.emit("click", { event: u, target: "TagContent", tag: e });
320
320
  });
321
- (d = this.store.css3DRenderDisposer.get(e.id)) == null || d.push(T);
321
+ (p = this.store.css3DRenderDisposer.get(e.id)) == null || p.push(b);
322
322
  }
323
323
  });
324
324
  }
325
- const m = this.css3DRenderPlugin.create3DDomContainer(a, p);
325
+ const m = this.css3DRenderPlugin.create3DDomContainer(a, d);
326
326
  if (!m)
327
327
  return;
328
328
  this.store.css3DRenderDisposer.set(e.id, [m.dispose]);
@@ -341,12 +341,12 @@ class ui extends x {
341
341
  svelteApp: h,
342
342
  domContainer: m,
343
343
  css3DInstance: m,
344
- initialNormal: r,
345
- currentNormal: r,
344
+ initialNormal: s,
345
+ currentNormal: s,
346
346
  dispose: () => {
347
347
  h.$destroy(), m.dispose();
348
348
  }
349
- }, D(e) && ((s = e.model) != null && s.object) && this.updateTagCss3DObjectMatrix(e, e.model.object);
349
+ }, D(e) && ((r = e.model) != null && r.object) && this.updateTagCss3DObjectMatrix(e, e.model.object);
350
350
  }
351
351
  }), this.clearUnusedPanelTag();
352
352
  }
@@ -360,8 +360,8 @@ class ui extends x {
360
360
  updateRenderModelTag() {
361
361
  const t = (i) => !this.enabledModelTagSet.has(i.customID), e = this.gltfObjectGroup.children.filter(t);
362
362
  e.forEach((i) => i.removeEventListener()), this.gltfObjectGroup.remove(...e), this.tags.filter((i) => i.stickType === "Model").forEach((i) => {
363
- var s;
364
- (s = i.model) == null || s.promise.then((a) => {
363
+ var r;
364
+ (r = i.model) == null || r.promise.then((a) => {
365
365
  a.visible = this.getCurrentVisibleState(i);
366
366
  });
367
367
  }), this.five.needsRender = !0;
@@ -378,26 +378,45 @@ class ui extends x {
378
378
  * @param model 模型
379
379
  */
380
380
  updateTagCss3DObjectMatrix(t, e) {
381
- var T, u, M;
382
- const o = (u = (T = this.getTagConfig(t).tag3DConfig) == null ? void 0 : T.ratio) != null ? u : 216e-5, i = (M = t.tag3DContentSvelte) == null ? void 0 : M.css3DInstance.css3DObject;
381
+ var b, u, M;
382
+ const o = (u = (b = this.getTagConfig(t).tag3DConfig) == null ? void 0 : b.ratio) != null ? u : 216e-5, i = (M = t.tag3DContentSvelte) == null ? void 0 : M.css3DInstance.css3DObject;
383
383
  if (!i)
384
384
  return;
385
- const s = D(t) ? t.data.mediaPosition : t.position;
386
- if (!s || s.length !== 4 || !Array.isArray(s[0]) || !Array.isArray(s[2]))
385
+ const r = D(t) ? t.data.mediaPosition : t.position;
386
+ if (!r || r.length !== 4 || !Array.isArray(r[0]) || !Array.isArray(r[2]))
387
387
  return;
388
388
  e.updateWorldMatrix(!1, !1);
389
- const a = e.matrixWorld, r = new b().fromArray(s[0]), n = new b().fromArray(s[2]), p = $(r, n).add(new b(0, 0, 5e-4)), m = new v().setPosition(p), h = new v().makeScale(o, o, o), P = new v().multiply(a).multiply(m).multiply(h);
389
+ const a = e.matrixWorld, s = new T().fromArray(r[0]), n = new T().fromArray(r[2]), d = W(s, n).add(new T(0, 0, 5e-4)), m = new v().setPosition(d), h = new v().makeScale(o, o, o), P = new v().multiply(a).multiply(m).multiply(h);
390
390
  P.decompose(i.position, i.quaternion, i.scale);
391
- const d = i.opacityMesh;
392
- d && P.decompose(d.position, d.quaternion, d.scale);
391
+ const p = i.opacityMesh;
392
+ p && P.decompose(p.position, p.quaternion, p.scale);
393
393
  }
394
394
  /** 添加模型标签 */
395
395
  addMediaModelTag(t) {
396
396
  return S(this, null, function* () {
397
- const e = t.filter(W).map((o) => this.loadModel(o));
397
+ const e = t.filter(L).map((o) => this.loadModel(o));
398
398
  yield Promise.all(e), this.setVisible(), this.updateRenderAllTags();
399
399
  });
400
400
  }
401
+ /**
402
+ * @description: 一个点的标签
403
+ */
404
+ setPointTagPosition() {
405
+ const t = this.filterPointTag;
406
+ t.length !== 0 && t.forEach((e) => {
407
+ var a;
408
+ const o = this.getCurrentVisibleState(e), i = (a = e.__Object__) != null ? a : {
409
+ timeoutId: void 0,
410
+ inAnimation: !0
411
+ };
412
+ if (e.__Object__ = i, !o && e.screenPosition ? (i.inAnimation = !0, i.timeoutId = setTimeout(() => {
413
+ this.getCurrentVisibleState(e) || (i.inAnimation = !1, e.screenPosition = null, this.updateDomView());
414
+ }, 1e3)) : i.timeoutId && (i.inAnimation = !1, clearTimeout(i.timeoutId)), !o && !i.inAnimation)
415
+ return;
416
+ const r = this.getTagProject(e);
417
+ r ? e.screenPosition = { leftPercent: (r.x + 1) / 2 * 100, topPercent: (-r.y + 1) / 2 * 100 } : e.screenPosition = null;
418
+ });
419
+ }
401
420
  /**
402
421
  * @description: 渲染单个点的标签
403
422
  */
@@ -415,8 +434,8 @@ class ui extends x {
415
434
  temporaryState: this.temporaryState,
416
435
  withAnimation: this.store.visibleWithAnimation
417
436
  }), this.filterCSS3DTag.forEach((e) => {
418
- var o, i, s, a, r;
419
- (a = (i = (o = e.tag3DContentSvelte) == null ? void 0 : o.css3DInstance) == null ? void 0 : i.css3DObject) == null || a.setVisible((this.state.visible && ((s = e.state) == null ? void 0 : s.visible)) !== !1), (r = e.tag3DContentSvelte) == null || r.svelteApp.$set({
437
+ var o, i, r, a, s;
438
+ (a = (i = (o = e.tag3DContentSvelte) == null ? void 0 : o.css3DInstance) == null ? void 0 : i.css3DObject) == null || a.setVisible((this.state.visible && ((r = e.state) == null ? void 0 : r.visible)) !== !1), (s = e.tag3DContentSvelte) == null || s.svelteApp.$set({
420
439
  state: this.state,
421
440
  temporaryState: this.temporaryState,
422
441
  withAnimation: this.store.visibleWithAnimation
@@ -447,11 +466,11 @@ class ui extends x {
447
466
  if (this.TagContainerSvelte)
448
467
  this.TagContainerSvelte.$set({ tags: e, state: this.state, temporaryState: this.temporaryState });
449
468
  else {
450
- const s = (o = this.five.getElement()) == null ? void 0 : o.parentElement;
451
- if (!s)
469
+ const r = (o = this.five.getElement()) == null ? void 0 : o.parentElement;
470
+ if (!r)
452
471
  return console.error("updateRenderPlaneTag: tag2DContainer not found");
453
- this.TagContainerSvelte = new I({
454
- target: s,
472
+ this.TagContainerSvelte = new x({
473
+ target: r,
455
474
  props: {
456
475
  hooks: this.hooks,
457
476
  tags: e,
@@ -14,7 +14,7 @@ let b = class {
14
14
  /**
15
15
  * @realsee/dnalogel 版本号
16
16
  */
17
- i(this, "VERSION", "3.3.4");
17
+ i(this, "VERSION", "3.3.5");
18
18
  i(this, "five");
19
19
  /**
20
20
  * 插件事件钩子
@@ -1,6 +1,6 @@
1
1
  function A() {
2
2
  console.debug(
3
- "%c %c@realsee/dnalogel %cv3.3.4",
3
+ "%c %c@realsee/dnalogel %cv3.3.5",
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",
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "repository": "https://github.com/realsee-developer/dnalogel.git",
8
8
  "description": "如视 VR 看房插件合集",
9
9
  "private": false,
10
- "version": "3.3.4",
10
+ "version": "3.3.5",
11
11
  "license": "SEE LICENSE IN TERMS.txt",
12
12
  "scripts": {
13
13
  "clean": "rm -rf components dist docs libs types ./vite.config.js.timestamp*",