@realsee/dnalogel 3.9.0 → 3.10.1

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.
@@ -115,6 +115,11 @@ export interface ServerAreaMakerItem {
115
115
  floor_index: number;
116
116
  /** 标注物体 */
117
117
  object_data: {
118
+ /**
119
+ * @description: 是否加载标注模型
120
+ * @default true
121
+ */
122
+ visible?: boolean;
118
123
  /** 标注底面形状,THREE.Shape().toJSON() 的结果 */
119
124
  shape: Record<string, any>;
120
125
  /** 标注底面 y 坐标 */
@@ -133,6 +138,11 @@ export interface ServerAreaMakerItemV1 {
133
138
  id: number;
134
139
  name: string;
135
140
  object_data: {
141
+ /**
142
+ * @description: 是否加载标注模型
143
+ * @default true
144
+ */
145
+ visible?: boolean;
136
146
  /** 绘制平面的三维世界坐标点集合 */
137
147
  points: number[][];
138
148
  /** 楼层索引 */
@@ -1,18 +1,18 @@
1
- var d = Object.defineProperty;
2
- var f = (a, e, t) => e in a ? d(a, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[e] = t;
3
- var i = (a, e, t) => (f(a, typeof e != "symbol" ? e + "" : e, t), t);
1
+ var f = Object.defineProperty;
2
+ var b = (a, e, t) => e in a ? f(a, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[e] = t;
3
+ var i = (a, e, t) => (b(a, typeof e != "symbol" ? e + "" : e, t), t);
4
4
  import * as n from "three";
5
5
  import "hammerjs";
6
6
  import "@realsee/five";
7
7
  import "../../vendor/@tweenjs/tween/dist/tween.esm.js.js";
8
8
  import "../../CSS3DRenderPlugin/utils/three/CSS3DRender.js";
9
9
  import "../../CSS3DRenderPlugin/utils/generateBehindFiveElement.js";
10
- import { Object3D as b } from "../../shared-utils/three/core/Object3D.js";
11
- import { LineSegments as k } from "../../shared-utils/three/objects/LineSegments.js";
12
- import { BetterTween as y } from "../../shared-utils/animationFrame/BetterTween.js";
13
- import { LabelItem as T } from "../../components/AreaLabel/LabelItem.js";
14
- import { getCenterPointOfPoints as C } from "../../shared-utils/math/planimetry.js";
15
- import { Subscribe as O } from "../../shared-utils/Subscribe.js";
10
+ import { Object3D as k } from "../../shared-utils/three/core/Object3D.js";
11
+ import { LineSegments as y } from "../../shared-utils/three/objects/LineSegments.js";
12
+ import { BetterTween as T } from "../../shared-utils/animationFrame/BetterTween.js";
13
+ import { LabelItem as C } from "../../components/AreaLabel/LabelItem.js";
14
+ import { getCenterPointOfPoints as O } from "../../shared-utils/math/planimetry.js";
15
+ import { Subscribe as v } from "../../shared-utils/Subscribe.js";
16
16
  import "../../shared-utils/positionToVector3.js";
17
17
  import "../../CSS3DRenderPlugin/utils/three/CSS3DRenderer.js";
18
18
  import "three/examples/jsm/renderers/CSS3DRenderer";
@@ -29,7 +29,7 @@ import "../../CSS3DRenderPlugin/utils/three/CSS3DGroup.js";
29
29
  import "../../shared-utils/animationFrame/index.js";
30
30
  import "../../vendor/svelte/internal/index.js";
31
31
  import "../../components/AreaLabel/Assets/roomLabelBg.js";
32
- class v extends b {
32
+ class M extends k {
33
33
  constructor(t) {
34
34
  super();
35
35
  i(this, "areaMakerItem");
@@ -39,7 +39,7 @@ class v extends b {
39
39
  this.areaMakerItem.makerObject.raycast(t, s);
40
40
  }
41
41
  }
42
- class Q {
42
+ class tt {
43
43
  constructor(e, t) {
44
44
  i(this, "id");
45
45
  /** 标注名称 */
@@ -85,7 +85,7 @@ class Q {
85
85
  /** 标注标签的显示层级 */
86
86
  i(this, "tagZIndex", 0);
87
87
  /** 标注实例的事件处理器 */
88
- i(this, "hooks", new O());
88
+ i(this, "hooks", new v());
89
89
  /** 自定义 Dom */
90
90
  i(this, "itemRenderer");
91
91
  /** 数据 */
@@ -126,7 +126,7 @@ class Q {
126
126
  return;
127
127
  }
128
128
  return new Promise((p) => {
129
- this.opacityAnime = new y({ makerObjectOpacity: s, outlineOpacity: r }).to({
129
+ this.opacityAnime = new T({ makerObjectOpacity: s, outlineOpacity: r }).to({
130
130
  makerObjectOpacity: o,
131
131
  outlineOpacity: l
132
132
  }).onUpdate(({ makerObjectOpacity: m, outlineOpacity: c }) => {
@@ -146,8 +146,13 @@ class Q {
146
146
  });
147
147
  /** 更新标注可见性 */
148
148
  i(this, "updateVisible", () => {
149
+ var o;
149
150
  const { result: e, msg: t } = this.checkVisible();
150
- this.checkMsg.checkVisibleMsg = t, this.visible !== e && (this.visible = e, this.modelGroup.visible = e, this.plugin.five.needsRender = !0);
151
+ if (this.checkMsg.checkVisibleMsg = t, this.visible === e)
152
+ return;
153
+ this.visible = e;
154
+ const s = (o = this.data.object_data.visible) != null ? o : !0;
155
+ this.modelGroup.visible = e && s, this.plugin.five.needsRender = !0;
151
156
  });
152
157
  /** 检测标注是否可见 */
153
158
  i(this, "checkVisible", () => {
@@ -203,12 +208,12 @@ class Q {
203
208
  };
204
209
  this.containerResizeTimeoutID && clearTimeout(this.containerResizeTimeoutID), this.containerResizeTimeoutID = setTimeout(t, 100);
205
210
  });
206
- var p, m, c;
211
+ var p, m, c, g;
207
212
  const s = t.object_data, o = s.bottom_y, r = s.height, l = new n.Color((p = s.color) != null ? p : "#FFFFFF"), h = (m = s.opacity) != null ? m : 0.4;
208
- this.data = t, this.id = t.id, this.name = (c = t.name) != null ? c : "", this.plugin = e, this.height = r, this.bottomY = o, this.opacity = h, this.shape = new n.Shape().fromJSON(s.shape), this.floorIndex = t.floor_index, this.makerObject = new n.Mesh(g(this.shape, r), M(l, h)), u(this.makerObject, o), this.makerObject.material.depthTest = this.plugin.config.modelDepthTest, this.outline = new k(
213
+ this.data = t, this.id = t.id, this.name = (c = t.name) != null ? c : "", this.plugin = e, this.height = r, this.bottomY = o, this.opacity = h, this.shape = new n.Shape().fromJSON(s.shape), this.floorIndex = t.floor_index, this.makerObject = new n.Mesh(d(this.shape, r), P(l, h)), u(this.makerObject, o), this.makerObject.material.depthTest = this.plugin.config.modelDepthTest, this.outline = new y(
209
214
  new n.EdgesGeometry(this.makerObject.geometry),
210
215
  new n.LineBasicMaterial({ color: l, transparent: !0 })
211
- ), u(this.outline, o), this.outline.material.depthTest = this.plugin.config.modelDepthTest, this.setHeight(r), this.modelGroup = new v(this);
216
+ ), u(this.outline, o), this.outline.material.depthTest = this.plugin.config.modelDepthTest, this.setHeight(r), this.modelGroup = new M(this), this.modelGroup.visible = (g = s.visible) != null ? g : !0;
212
217
  }
213
218
  /** 挂载标注 */
214
219
  mount() {
@@ -222,7 +227,7 @@ class Q {
222
227
  transform: `translate(${this.tagTransform.left}px, ${this.tagTransform.top}px)`,
223
228
  onClick: (r) => this.hooks.emit("tagClick", { target: this, nativeEvent: r })
224
229
  };
225
- this.tagApp = new T({ target: s, props: o }), this.updateTag();
230
+ this.tagApp = new C({ target: s, props: o }), this.updateTag();
226
231
  }
227
232
  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), (t = this.plugin.resizeIframe.contentWindow) == null || t.addEventListener("resize", this.onContainerResize);
228
233
  }
@@ -252,8 +257,8 @@ class Q {
252
257
  setHeight(e) {
253
258
  if (e <= 0)
254
259
  throw new Error("高度必须大于 0");
255
- this.height = e, this.makerObject.geometry = g(this.shape, e), this.outline.geometry = new n.EdgesGeometry(this.makerObject.geometry);
256
- const t = this.shape.extractPoints(10).shape.slice(0, -1), s = C(t), o = new n.Vector3(s.x, s.y, e);
260
+ this.height = e, this.makerObject.geometry = d(this.shape, e), this.outline.geometry = new n.EdgesGeometry(this.makerObject.geometry);
261
+ const t = this.shape.extractPoints(10).shape.slice(0, -1), s = O(t), o = new n.Vector3(s.x, s.y, e);
257
262
  u(o, this.bottomY), this.tagPosition.copy(o), this.updateTag(), this.plugin.five.needsRender = !0;
258
263
  }
259
264
  /** 更改标注标签的显示层级
@@ -269,13 +274,13 @@ class Q {
269
274
  this.tagZIndex !== e && ((t = this.tagApp) == null || t.$set({ zIndex: e }));
270
275
  }
271
276
  }
272
- function g(a, e) {
277
+ function d(a, e) {
273
278
  return new n.ExtrudeBufferGeometry(a, {
274
279
  depth: e,
275
280
  bevelEnabled: !1
276
281
  });
277
282
  }
278
- function M(a, e) {
283
+ function P(a, e) {
279
284
  return new n.MeshBasicMaterial({
280
285
  color: a,
281
286
  opacity: e,
@@ -287,5 +292,5 @@ function u(a, e) {
287
292
  t.multiply(s), t.multiply(o), t.multiply(r), a.applyMatrix4(t);
288
293
  }
289
294
  export {
290
- Q as AreaMakerItem
295
+ tt as AreaMakerItem
291
296
  };
@@ -12,7 +12,7 @@ var M = (b, e, i) => e in b ? $(b, e, { enumerable: !0, configurable: !0, writab
12
12
  }, D = (b, e) => w(b, E(e));
13
13
  import * as F from "three";
14
14
  import { is3DTag as z, isMediaModelTag as R } from "../utils/tag/tagCheck.js";
15
- import { getTagCenterPosition as I, getTagPosition as O } from "../utils/tagPosition.js";
15
+ import { getTagCenterPosition as C, getTagPosition as O } from "../utils/tagPosition.js";
16
16
  import { checkRange as h } from "../utils/checkRange.js";
17
17
  import { isPanoramaLike as y, isModelLike as Z } from "../../shared-utils/five/mode.js";
18
18
  import "hammerjs";
@@ -64,7 +64,8 @@ import "../utils/tag/adaptConfig.js";
64
64
  import "../../shared-utils/typescript/entries.js";
65
65
  import "../../shared-utils/url/getUrl.js";
66
66
  import "../../shared-utils/five/transformPosition.js";
67
- const C = new F.Raycaster();
67
+ const I = new F.Raycaster();
68
+ I.params.Points.threshold = 0.1;
68
69
  class Je extends H {
69
70
  constructor(e) {
70
71
  super(e);
@@ -254,7 +255,7 @@ class Je extends H {
254
255
  * @description 一个点的标签
255
256
  */
256
257
  getTagProject(e) {
257
- const i = I(e);
258
+ const i = C(e);
258
259
  if (!i)
259
260
  return;
260
261
  const { x: f, y: t, z: o } = i.project(this.five.camera);
@@ -271,20 +272,20 @@ class Je extends H {
271
272
  (() => {
272
273
  var g;
273
274
  const v = (g = f.checkPoints) != null ? g : "center";
274
- return v === "center" ? I(e) : v === "corner" ? O(e) : Array.isArray(v) ? v : [];
275
+ return v === "center" ? C(e) : v === "corner" ? O(e) : Array.isArray(v) ? v : [];
275
276
  })()
276
277
  );
277
278
  let s = 0, c = 0;
278
279
  for (const v of d) {
279
280
  const g = new F.Vector3().subVectors(v, o).normalize();
280
- C.set(o, g);
281
- const P = o.distanceTo(v), [l] = this.five.model.intersectRaycaster(C), p = (() => {
281
+ I.set(o, g);
282
+ const P = o.distanceTo(v), [l] = this.five.model.intersectRaycaster(I), p = (() => {
282
283
  if (!R(e))
283
284
  return;
284
285
  const V = this.tags.filter(R).map((A) => {
285
286
  var T;
286
287
  return (T = A.model) == null ? void 0 : T.object;
287
- }).filter(q), [B] = C.intersectObjects(V, !0);
288
+ }).filter(q), [B] = I.intersectObjects(V, !0);
288
289
  return B;
289
290
  })(), S = (r = f.distanceAccuracy) != null ? r : 0.01;
290
291
  Math.min((a = l == null ? void 0 : l.distance) != null ? a : 1 / 0, (u = p == null ? void 0 : p.distance) != null ? u : 1 / 0) + S >= P ? s++ : c++;
@@ -306,7 +307,7 @@ class Je extends H {
306
307
  var o, d, s, c, n, r, a;
307
308
  let i = 0;
308
309
  const f = (o = e.fiveState) == null ? void 0 : o.panoIndex;
309
- f !== void 0 ? i = (d = this.work.observers[f]) == null ? void 0 : d.floorIndex : i = N(this.work, (a = (r = (c = (s = e.model) == null ? void 0 : s.object) == null ? void 0 : c.position) != null ? r : (n = e.mediaPlane) == null ? void 0 : n.position) != null ? a : I(e));
310
+ f !== void 0 ? i = (d = this.work.observers[f]) == null ? void 0 : d.floorIndex : i = N(this.work, (a = (r = (c = (s = e.model) == null ? void 0 : s.object) == null ? void 0 : c.position) != null ? r : (n = e.mediaPlane) == null ? void 0 : n.position) != null ? a : C(e));
310
311
  const t = this.five.model.shownFloor;
311
312
  return t === null || t === i;
312
313
  }
@@ -14,7 +14,7 @@ let b = class {
14
14
  /**
15
15
  * @realsee/dnalogel 版本号
16
16
  */
17
- i(this, "VERSION", "3.9.0");
17
+ i(this, "VERSION", "3.10.1");
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.9.0",
3
+ "%c %c@realsee/dnalogel %cv3.10.1",
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.9.0",
10
+ "version": "3.10.1",
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*",
@@ -36,7 +36,7 @@
36
36
  },
37
37
  "devDependencies": {
38
38
  "@babel/core": "^7.22.9",
39
- "@realsee/five": "6.0.0-alpha.52",
39
+ "@realsee/five": "6.0.0-alpha.57",
40
40
  "@sveltejs/vite-plugin-svelte": "^2.4.2",
41
41
  "@tsconfig/svelte": "^4.0.1",
42
42
  "@tweenjs/tween.js": "^20.0.3",