@realsee/dnalogel 2.28.1 → 2.28.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/index.js CHANGED
@@ -39,7 +39,7 @@ import cl from "animejs";
39
39
  import { GLTFLoader as Ff } from "@realsee/five/gltf-loader";
40
40
  function _f() {
41
41
  console.debug(
42
- "%c %c@realsee/dnalogel %cv2.28.1",
42
+ "%c %c@realsee/dnalogel %cv2.28.3",
43
43
  [
44
44
  "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=')",
45
45
  "background-repeat: no-repeat",
@@ -6849,7 +6849,7 @@ let ps = class {
6849
6849
  /**
6850
6850
  * @realsee/dnalogel 版本号
6851
6851
  */
6852
- f(this, "VERSION", "2.28.1");
6852
+ f(this, "VERSION", "2.28.3");
6853
6853
  f(this, "five");
6854
6854
  /**
6855
6855
  * 插件事件钩子
@@ -32196,11 +32196,16 @@ class lE {
32196
32196
  f(this, "tagTransform", { left: 0, top: 0 });
32197
32197
  /** 标注标签的显示层级 */
32198
32198
  f(this, "tagZIndex", 0);
32199
+ /** 标注实例的事件处理器 */
32199
32200
  f(this, "hooks", new Ri());
32200
32201
  /** Plugin 实例 */
32201
32202
  f(this, "plugin");
32202
32203
  /** 标注透明度动画 */
32203
32204
  f(this, "opacityAnime");
32205
+ /** 是否在容器 resize 动画中 */
32206
+ f(this, "isInContainerResizeAnimation", !1);
32207
+ /** 监听容器 resize 的计时器 id,用于判断 resize 过程是否结束 */
32208
+ f(this, "containerResizeTimeoutID", null);
32204
32209
  /** 显示标注 */
32205
32210
  // public show() {
32206
32211
  // return this.doOpacityAnime({
@@ -32243,6 +32248,10 @@ class lE {
32243
32248
  f(this, "onPluginConfigChange", (t) => {
32244
32249
  this.makerObject.material.depthTest = t.config.modelDepthTest, this.outline.material.depthTest = t.config.modelDepthTest, this.plugin.five.needsRender = !0;
32245
32250
  });
32251
+ /** 插件整体可见性变化时,需要更新自身可见性 */
32252
+ f(this, "onPluginStateChange", () => {
32253
+ this.updateVisible(), this.updateTagVisible();
32254
+ });
32246
32255
  /** 更新标注可见性 */
32247
32256
  f(this, "updateVisible", () => {
32248
32257
  const { result: t, msg: e } = this.checkVisible();
@@ -32280,6 +32289,8 @@ class lE {
32280
32289
  f(this, "checkTagVisible", () => {
32281
32290
  if (!this.visible)
32282
32291
  return { result: !1, msg: "标注整体不可见" };
32292
+ if (this.isInContainerResizeAnimation)
32293
+ return { result: !1, msg: "处于容器 resize 动画中" };
32283
32294
  const e = this.plugin.five, i = new P.Raycaster(), s = e.camera.position.clone();
32284
32295
  i.set(s.clone(), this.tagPosition.clone().sub(s).normalize());
32285
32296
  const [o] = e.model.intersectRaycaster(i), r = this.tagPosition.distanceTo(e.camera.position);
@@ -32292,6 +32303,14 @@ class lE {
32292
32303
  f(this, "onFiveCameraUpdate", () => {
32293
32304
  this.tagApp && this.visible && (this.updateTagNDCPosition(), this.updateTagDomTransform(), this.updateTagVisible());
32294
32305
  });
32306
+ /** tag container DOM 发生 resize */
32307
+ f(this, "onContainerResize", () => {
32308
+ this.isInContainerResizeAnimation === !1 && (this.isInContainerResizeAnimation = !0, this.updateTag());
32309
+ const e = () => {
32310
+ this.isInContainerResizeAnimation = !1, this.containerResizeTimeoutID = null, this.updateTag();
32311
+ };
32312
+ this.containerResizeTimeoutID && clearTimeout(this.containerResizeTimeoutID), this.containerResizeTimeoutID = setTimeout(e, 100);
32313
+ });
32295
32314
  var l, c, d;
32296
32315
  const i = e.object_data, s = i.bottom_y, o = i.height, r = new P.Color((l = i.color) != null ? l : "#FFFFFF"), a = (c = i.opacity) != null ? c : 0.4;
32297
32316
  this.id = e.id, this.name = (d = e.name) != null ? d : "", this.plugin = t, this.height = o, this.bottomY = s, this.opacity = a, this.shape = new P.Shape().fromJSON(i.shape), this.floorIndex = e.floor_index, this.makerObject = new P.Mesh(wh(this.shape, o), cE(r, a)), Jr(this.makerObject, s), this.makerObject.material.depthTest = this.plugin.config.modelDepthTest, this.outline = new Fh(
@@ -32310,12 +32329,12 @@ class lE {
32310
32329
  };
32311
32330
  this.tagApp = new rE({ target: e, props: i }), this.updateTag();
32312
32331
  }
32313
- this.plugin.five.needsRender = !0, this.plugin.hooks.on("configChange", this.onPluginConfigChange), this.plugin.hooks.on("stateChange", this.updateVisible), this.plugin.five.on("modeChange", this.updateVisible), this.plugin.five.on("modelShownFloorChange", this.updateVisible), this.plugin.five.on("cameraUpdate", this.onFiveCameraUpdate);
32332
+ this.plugin.five.needsRender = !0, this.plugin.hooks.on("stateChange", this.onPluginStateChange), this.plugin.hooks.on("configChange", this.onPluginConfigChange), this.plugin.five.on("modeChange", this.updateVisible), this.plugin.five.on("modelShownFloorChange", this.updateVisible), this.plugin.five.on("cameraUpdate", this.onFiveCameraUpdate), this.plugin.resizeIframe.contentWindow.addEventListener("resize", this.onContainerResize);
32314
32333
  }
32315
32334
  /** 卸载标注 */
32316
32335
  unmount() {
32317
32336
  var t;
32318
- this.mounted = !1, this.modelGroup.remove(...this.modelGroup.children), (t = this.tagApp) == null || t.$destroy(), this.tagApp = null, this.plugin.hooks.off("configChange", this.onPluginConfigChange), this.plugin.hooks.off("stateChange", this.updateVisible), this.plugin.five.off("modeChange", this.updateVisible), this.plugin.five.off("modelShownFloorChange", this.updateVisible), this.plugin.five.off("cameraUpdate", this.onFiveCameraUpdate);
32337
+ this.mounted = !1, this.modelGroup.remove(...this.modelGroup.children), (t = this.tagApp) == null || t.$destroy(), this.tagApp = null, this.plugin.hooks.off("stateChange", this.onPluginStateChange), this.plugin.hooks.off("configChange", this.onPluginConfigChange), this.plugin.five.off("modeChange", this.updateVisible), this.plugin.five.off("modelShownFloorChange", this.updateVisible), this.plugin.five.off("cameraUpdate", this.onFiveCameraUpdate), this.plugin.resizeIframe.contentWindow.removeEventListener("resize", this.onContainerResize);
32319
32338
  }
32320
32339
  /** 更改标注透明度
32321
32340
  * @param opacity 标注透明度,范围:0-1
@@ -32391,6 +32410,8 @@ class dE extends si {
32391
32410
  f(this, "data");
32392
32411
  /** tag 容器 */
32393
32412
  f(this, "tagDomContainer");
32413
+ /** 用于监听容器尺寸变化的 iframe */
32414
+ f(this, "resizeIframe");
32394
32415
  /** 查询问题使用的调试对象 */
32395
32416
  f(this, "checkMsg", {
32396
32417
  childrenMountedState: ""
@@ -32449,7 +32470,7 @@ class dE extends si {
32449
32470
  }))
32450
32471
  return !1;
32451
32472
  });
32452
- this.five = e, this.tagDomContainer = document.createElement("div"), this.tagDomContainer.style.position = "absolute", this.tagDomContainer.style.top = "0", this.tagDomContainer.style.left = "0", this.tagDomContainer.style.width = "100%", this.tagDomContainer.style.height = "100%", this.tagDomContainer.style.pointerEvents = "none";
32473
+ this.five = e, this.tagDomContainer = document.createElement("div"), this.tagDomContainer.style.position = "absolute", this.tagDomContainer.style.top = "0", this.tagDomContainer.style.left = "0", this.tagDomContainer.style.width = "100%", this.tagDomContainer.style.height = "100%", this.tagDomContainer.style.pointerEvents = "none", this.resizeIframe = document.createElement("iframe"), this.resizeIframe.style.position = "absolute", this.resizeIframe.style.top = "0", this.resizeIframe.style.left = "0", this.resizeIframe.style.width = "100%", this.resizeIframe.style.height = "100%", this.resizeIframe.style.border = "none", this.resizeIframe.style.pointerEvents = "none", this.resizeIframe.style.zIndex = "-1", this.tagDomContainer.appendChild(this.resizeIframe);
32453
32474
  const s = {
32454
32475
  enabled: !0,
32455
32476
  visible: !0
@@ -32628,10 +32649,10 @@ class dE extends si {
32628
32649
  this.state = V(V({}, this.state), e), this.hooks.emit("stateChange", { state: this.state, prevState: s, userAction: i });
32629
32650
  }
32630
32651
  _enable(e) {
32631
- this.hooks.emit("enable", { userAction: e.userAction }), this.five.scene.add(this.modelGroup), this.five.needsRender = !0, this.five.on("wantsTapGesture", this.onWantsFiveTapGesture), this.five.on("initAnimationWillStart", this.onFiveInitAnimationWillStart), this.five.on("initAnimationEnded", this.onFiveInitAnimationEnded), this.five.on("modeChange", this.onFiveModeChange), this.five.on("cameraUpdate", this.onFiveCameraUpdate);
32652
+ this.hooks.emit("enable", { userAction: e.userAction }), this.five.scene.add(this.modelGroup), this.updateChildrenMountedState(), this.five.needsRender = !0, this.five.on("wantsTapGesture", this.onWantsFiveTapGesture), this.five.on("initAnimationWillStart", this.onFiveInitAnimationWillStart), this.five.on("initAnimationEnded", this.onFiveInitAnimationEnded), this.five.on("modeChange", this.onFiveModeChange), this.five.on("cameraUpdate", this.onFiveCameraUpdate);
32632
32653
  }
32633
32654
  _disable(e) {
32634
- this.hooks.emit("disable", { userAction: e.userAction }), this.five.scene.remove(this.modelGroup), this.five.needsRender = !0, this.five.off("wantsTapGesture", this.onWantsFiveTapGesture), this.five.off("initAnimationWillStart", this.onFiveInitAnimationWillStart), this.five.off("initAnimationEnded", this.onFiveInitAnimationEnded), this.five.off("modeChange", this.onFiveModeChange), this.five.off("cameraUpdate", this.onFiveCameraUpdate);
32655
+ this.hooks.emit("disable", { userAction: e.userAction }), this.five.scene.remove(this.modelGroup), this.updateChildrenMountedState(), this.five.needsRender = !0, this.five.off("wantsTapGesture", this.onWantsFiveTapGesture), this.five.off("initAnimationWillStart", this.onFiveInitAnimationWillStart), this.five.off("initAnimationEnded", this.onFiveInitAnimationEnded), this.five.off("modeChange", this.onFiveModeChange), this.five.off("cameraUpdate", this.onFiveCameraUpdate);
32635
32656
  }
32636
32657
  _show(e) {
32637
32658
  return H(this, null, function* () {
@@ -32644,7 +32665,7 @@ class dE extends si {
32644
32665
  });
32645
32666
  }
32646
32667
  }
32647
- const Tk = (n) => new dE(n);
32668
+ const Tk = (n, t) => new dE(n, t);
32648
32669
  Wf();
32649
32670
  _f();
32650
32671
  export {