@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,19 +1,19 @@
1
- var B = Object.defineProperty, E = Object.defineProperties;
2
- var $ = Object.getOwnPropertyDescriptors;
3
- var C = Object.getOwnPropertySymbols;
4
- var w = Object.prototype.hasOwnProperty, O = Object.prototype.propertyIsEnumerable;
5
- var k = (m, e, i) => e in m ? B(m, e, { enumerable: !0, configurable: !0, writable: !0, value: i }) : m[e] = i, g = (m, e) => {
1
+ var $ = Object.defineProperty, w = Object.defineProperties;
2
+ var E = Object.getOwnPropertyDescriptors;
3
+ var T = Object.getOwnPropertySymbols;
4
+ var L = Object.prototype.hasOwnProperty, _ = Object.prototype.propertyIsEnumerable;
5
+ var k = (p, e, i) => e in p ? $(p, e, { enumerable: !0, configurable: !0, writable: !0, value: i }) : p[e] = i, h = (p, e) => {
6
6
  for (var i in e || (e = {}))
7
- w.call(e, i) && k(m, i, e[i]);
8
- if (C)
9
- for (var i of C(e))
10
- O.call(e, i) && k(m, i, e[i]);
11
- return m;
12
- }, M = (m, e) => E(m, $(e));
13
- import * as j from "three";
14
- import { is3DTag as L, isMediaModelTag as D } from "../utils/tag/tagCheck.js";
15
- import { getTagCenterPosition as x, getTagPosition as z } from "../utils/tagPosition.js";
16
- import { checkRange as p } from "../utils/checkRange.js";
7
+ L.call(e, i) && k(p, i, e[i]);
8
+ if (T)
9
+ for (var i of T(e))
10
+ _.call(e, i) && k(p, i, e[i]);
11
+ return p;
12
+ }, M = (p, e) => w(p, E(e));
13
+ import * as U from "three";
14
+ import { is3DTag as z, isMediaModelTag as D } from "../utils/tag/tagCheck.js";
15
+ import { getTagCenterPosition as P, getTagPosition as O } from "../utils/tagPosition.js";
16
+ import { checkRange as m } from "../utils/checkRange.js";
17
17
  import { isPanoramaLike as b, isModelLike as Z } from "../../shared-utils/five/mode.js";
18
18
  import "hammerjs";
19
19
  import "@realsee/five";
@@ -64,7 +64,7 @@ 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 I = new j.Raycaster();
67
+ const I = new U.Raycaster();
68
68
  class Je extends N {
69
69
  constructor(e) {
70
70
  super(e);
@@ -73,80 +73,80 @@ class Je extends N {
73
73
  * @description: 获取是否可见
74
74
  */
75
75
  getVisible(e, i) {
76
- const l = g(g({}, this.five.getCurrentState()), i), { panoIndex: t, mode: n } = l, f = b(n) ? this.getPanoIndexCache({ panoIndex: t, id: e.id }) : void 0;
77
- if ((f == null ? void 0 : f.visible) !== void 0)
78
- return f.visible;
76
+ const f = h(h({}, this.five.getCurrentState()), i), { panoIndex: t, mode: s } = f, d = b(s) ? this.getPanoIndexCache({ panoIndex: t, id: e.id }) : void 0;
77
+ if ((d == null ? void 0 : d.visible) !== void 0)
78
+ return d.visible;
79
79
  {
80
- const s = [], u = (() => {
81
- var r, c, v;
82
- const o = (r = this.getTagConfig(e).visibleConfig) != null ? r : {};
83
- if (typeof o == "function")
84
- return { value: o(this.five, { tag: e, distance: this.getDistance(e) }), checkedList: s, reason: "config function result" };
85
- if (o.keep === "hidden")
86
- return { value: !1, checkedList: s, reason: "config.keep is hidden" };
87
- if (o.keep === "visible")
88
- return { value: !0, checkedList: s, reason: "config.keep is visible" };
89
- if (o.visibleFiveMode !== void 0) {
90
- const a = typeof o.visibleFiveMode == "function" ? o.visibleFiveMode(e) : o.visibleFiveMode;
91
- let d = !1;
92
- if (Array.isArray(a) ? d = a.includes(n) : a === "ModelLike" ? d = Z(n) : a === "PanoramaLike" ? d = !b(n) : a === "all" ? d = !0 : typeof a == "string" && (d = a === n), d === !1)
80
+ const o = [], u = (() => {
81
+ var r, l, v;
82
+ const n = (r = this.getTagConfig(e).visibleConfig) != null ? r : {};
83
+ if (typeof n == "function")
84
+ return { value: n(this.five, { tag: e, distance: this.getDistance(e) }), checkedList: o, reason: "config function result" };
85
+ if (n.keep === "hidden")
86
+ return { value: !1, checkedList: o, reason: "config.keep is hidden" };
87
+ if (n.keep === "visible")
88
+ return { value: !0, checkedList: o, reason: "config.keep is visible" };
89
+ if (n.visibleFiveMode !== void 0) {
90
+ const a = typeof n.visibleFiveMode == "function" ? n.visibleFiveMode(e) : n.visibleFiveMode;
91
+ let c = !1;
92
+ if (Array.isArray(a) ? c = a.includes(s) : a === "ModelLike" ? c = Z(s) : a === "PanoramaLike" ? c = !b(s) : a === "all" ? c = !0 : typeof a == "string" && (c = a === s), c === !1)
93
93
  return {
94
94
  value: !1,
95
- checkedList: s,
95
+ checkedList: o,
96
96
  reason: "current mode is not included in visibleFiveMode",
97
- visibleFiveMode: o.visibleFiveMode,
98
- mode: n
97
+ visibleFiveMode: n.visibleFiveMode,
98
+ mode: s
99
99
  };
100
100
  }
101
- if (o.followModelVisibility === !0 && (n === "Floorplan" || n === "Mapview") && this.getVisibleByFloorIndex(e) === !1)
102
- return { value: !1, checkedList: s, reason: "followModelVisibility check failed" };
103
- if (b(n) && o.visiblePanoIndex !== void 0 && o.visiblePanoIndex !== "all" && t !== void 0) {
104
- if (s.push("visiblePanoIndex"), Array.isArray(o.visiblePanoIndex) && !o.visiblePanoIndex.includes(t))
101
+ if (n.followModelVisibility === !0 && (s === "Floorplan" || s === "Mapview") && this.getVisibleByFloorIndex(e) === !1)
102
+ return { value: !1, checkedList: o, reason: "followModelVisibility check failed" };
103
+ if (b(s) && n.visiblePanoIndex !== void 0 && n.visiblePanoIndex !== "all" && t !== void 0) {
104
+ if (o.push("visiblePanoIndex"), Array.isArray(n.visiblePanoIndex) && !n.visiblePanoIndex.includes(t))
105
105
  return {
106
106
  value: !1,
107
- checkedList: s,
108
- reason: `current panoIndex is not included in visiblePano. currentPanoIndex: ${t}, visiblePanoIndex: ${o.visiblePanoIndex}`
107
+ checkedList: o,
108
+ reason: `current panoIndex is not included in visiblePano. currentPanoIndex: ${t}, visiblePanoIndex: ${n.visiblePanoIndex}`
109
109
  };
110
- if (o.visiblePanoIndex === "current" && t !== ((c = e.fiveState) == null ? void 0 : c.panoIndex))
110
+ if (n.visiblePanoIndex === "current" && t !== ((l = e.fiveState) == null ? void 0 : l.panoIndex))
111
111
  return {
112
112
  value: !1,
113
- checkedList: s,
113
+ checkedList: o,
114
114
  reason: `current panoIndex is not equal to tag.panoIndex. currentPanoIndex: ${t}, tag.panoIndex: ${(v = e.fiveState) == null ? void 0 : v.panoIndex}`
115
115
  };
116
116
  }
117
- if (o.visibleDistance !== void 0 && (s.push("visibleDistance"), o.visibleDistance !== "unLimited")) {
117
+ if (n.visibleDistance !== void 0 && (o.push("visibleDistance"), n.visibleDistance !== "unLimited")) {
118
118
  const a = this.getDistance(e);
119
- if (p(a, o.visibleDistance) === !1)
119
+ if (m(a, n.visibleDistance) === !1)
120
120
  return {
121
121
  value: !1,
122
- checkedList: s,
123
- reason: `distance is not in visibleDistance. distance: ${a}, visibleDistance: ${o.visibleDistance}`
122
+ checkedList: o,
123
+ reason: `distance is not in visibleDistance. distance: ${a}, visibleDistance: ${n.visibleDistance}`
124
124
  };
125
125
  }
126
- if (b(n) && o.angleRange && L(e)) {
127
- s.push("angleRange");
126
+ if (b(s) && n.angleRange && z(e)) {
127
+ o.push("angleRange");
128
128
  const a = this.getAngle(e);
129
- if (p(a, o.angleRange) === !1)
130
- return { value: !1, checkedList: s, reason: `angle is not in angleRange. angle: ${a}, angleRange: ${o.angleRange}` };
129
+ if (m(a, n.angleRange) === !1)
130
+ return { value: !1, checkedList: o, reason: `angle is not in angleRange. angle: ${a}, angleRange: ${n.angleRange}` };
131
131
  }
132
- if (o.intersectRaycaster !== !1 && (typeof o.intersectRaycaster != "object" || o.intersectRaycaster.enabled !== !1)) {
133
- if (s.push("intersectRaycaster"), t === void 0)
132
+ if (n.intersectRaycaster !== !1 && (typeof n.intersectRaycaster != "object" || n.intersectRaycaster.enabled !== !1)) {
133
+ if (o.push("intersectRaycaster"), t === void 0)
134
134
  return {
135
135
  value: !1,
136
- checkedList: s,
136
+ checkedList: o,
137
137
  reason: `intersectRaycaster check failed: panoIndex is ${t}`
138
138
  };
139
139
  const a = this.getTagEnableByIntersect(e, t);
140
140
  if (a.value === !1)
141
- return Object.assign(a, { checkedList: s });
141
+ return Object.assign(a, { checkedList: o });
142
142
  }
143
143
  return {
144
144
  value: !0,
145
- checkedList: s,
145
+ checkedList: o,
146
146
  reason: "all check passed"
147
147
  };
148
148
  })();
149
- return f && (f.visible = u.value, f.__debug_visible_reason__ = u), u.value;
149
+ return d && (d.visible = u.value, d.__debug_visible_reason__ = u), u.value;
150
150
  }
151
151
  }
152
152
  /**
@@ -159,22 +159,22 @@ class Je extends N {
159
159
  if (t.unfolded !== void 0)
160
160
  return t.unfolded;
161
161
  {
162
- const n = this.getTagConfig(e).unfoldedConfig;
163
- if (!n)
162
+ const s = this.getTagConfig(e).unfoldedConfig;
163
+ if (!s)
164
164
  return;
165
- const f = (() => {
166
- if (typeof n == "function")
167
- return n(this.five, { tag: e, distance: this.getDistance(e) });
168
- if (n.keep === "folded")
165
+ const d = (() => {
166
+ if (typeof s == "function")
167
+ return s(this.five, { tag: e, distance: this.getDistance(e) });
168
+ if (s.keep === "folded")
169
169
  return !1;
170
- if (n.keep === "unfolded")
170
+ if (s.keep === "unfolded")
171
171
  return !0;
172
- if (n.unfoldDistance && p(this.getDistance(e), n.unfoldDistance) === !1)
172
+ if (s.unfoldDistance && m(this.getDistance(e), s.unfoldDistance) === !1)
173
173
  return !1;
174
174
  })();
175
- t.unfolded = f;
176
- const s = this.getUnfoldedByCamera(e);
177
- return s !== void 0 ? s : t.unfolded;
175
+ t.unfolded = d;
176
+ const o = this.getUnfoldedByCamera(e);
177
+ return o !== void 0 ? o : t.unfolded;
178
178
  }
179
179
  }
180
180
  /**
@@ -182,7 +182,7 @@ class Je extends N {
182
182
  */
183
183
  getUnfoldedByCamera(e) {
184
184
  return this.getCurrentVisibleState(e) ? (() => {
185
- var n;
185
+ var s;
186
186
  const t = this.getTagConfig(e).unfoldedConfig;
187
187
  if (t) {
188
188
  if (typeof t == "function")
@@ -194,25 +194,25 @@ class Je extends N {
194
194
  if (t.autoUnfold === void 0 || t.autoUnfold === !1 || t.autoUnfold.enable === !1 || !t.autoUnfold.strategy)
195
195
  return;
196
196
  if (t.autoUnfold.strategy === "ScreenPostion") {
197
- const f = this.getTagProject(e);
198
- if (f && p(f.x, t.autoUnfold.autoUnfoldProjectX) === !1)
197
+ const d = this.getTagProject(e);
198
+ if (d && m(d.x, t.autoUnfold.autoUnfoldProjectX) === !1)
199
199
  return !1;
200
200
  }
201
201
  if (t.autoUnfold.strategy === "MinimumDistance") {
202
202
  const u = this.filterPointTag.filter((r) => this.getCurrentVisibleState(r)).filter((r) => {
203
- const c = this.getTagProject(r);
204
- if (!c)
203
+ const l = this.getTagProject(r);
204
+ if (!l)
205
205
  return !1;
206
- const { x: v, y: a, z: d } = c;
207
- return !(Math.abs(d) > 1 || Math.abs(v) > 1 || Math.abs(a) > 1);
208
- }).map((r) => ({ tag: r, id: r.id, tagConfig: this.getTagConfig(r).unfoldedConfig })).filter(({ tag: r, tagConfig: c }) => {
206
+ const { x: v, y: a, z: c } = l;
207
+ return !(Math.abs(c) > 1 || Math.abs(v) > 1 || Math.abs(a) > 1);
208
+ }).map((r) => ({ tag: r, id: r.id, tagConfig: this.getTagConfig(r).unfoldedConfig })).filter(({ tag: r, tagConfig: l }) => {
209
209
  var v, a;
210
- return !(typeof c == "function" || c.keep || c.autoUnfold === !1 || ((v = c.autoUnfold) == null ? void 0 : v.enable) === !1 || ((a = c.autoUnfold) == null ? void 0 : a.strategy) !== "MinimumDistance");
211
- }).map((r) => M(g({}, r), { distance: this.getDistance(r.tag) })).filter(({ distance: r, tagConfig: c }) => {
212
- const v = c.autoUnfold.distance;
213
- return !(v && p(r, v) === !1);
214
- }).sort((r, c) => r.distance - c.distance).findIndex((r) => r.id === e.id);
215
- if (u === -1 || u <= ((n = t.autoUnfold.maxNumber) != null ? n : 1) - 1 === !1)
210
+ return !(typeof l == "function" || l.keep || l.autoUnfold === !1 || ((v = l.autoUnfold) == null ? void 0 : v.enable) === !1 || ((a = l.autoUnfold) == null ? void 0 : a.strategy) !== "MinimumDistance");
211
+ }).map((r) => M(h({}, r), { distance: this.getDistance(r.tag) })).filter(({ distance: r, tagConfig: l }) => {
212
+ const v = l.autoUnfold.distance;
213
+ return !(v && m(r, v) === !1);
214
+ }).sort((r, l) => r.distance - l.distance).findIndex((r) => r.id === e.id);
215
+ if (u === -1 || u <= ((s = t.autoUnfold.maxNumber) != null ? s : 1) - 1 === !1)
216
216
  return !1;
217
217
  }
218
218
  return !0;
@@ -228,37 +228,18 @@ class Je extends N {
228
228
  const i = this.getDistance(e);
229
229
  return Math.round((1e4 - (i != null ? i : 0)) * 100);
230
230
  }
231
- /**
232
- * @description: 一个点的标签
233
- */
234
- setPointTagPosition() {
235
- const e = this.filterPointTag;
236
- e.length !== 0 && e.forEach((i) => {
237
- var f;
238
- const l = this.getCurrentVisibleState(i), t = (f = i.__Object__) != null ? f : {
239
- timeoutId: void 0,
240
- inAnimation: !0
241
- };
242
- if (i.__Object__ = t, !l && i.screenPosition ? (t.inAnimation = !0, t.timeoutId = setTimeout(() => {
243
- this.getCurrentVisibleState(i) || (t.inAnimation = !1, i.screenPosition = null);
244
- }, 1e3)) : t.timeoutId && (t.inAnimation = !1, clearTimeout(t.timeoutId)), !l && !t.inAnimation)
245
- return;
246
- const n = this.getTagProject(i);
247
- n ? i.screenPosition = { leftPercent: (n.x + 1) / 2 * 100, topPercent: (-n.y + 1) / 2 * 100 } : i.screenPosition = null;
248
- });
249
- }
250
231
  setVisible(e) {
251
232
  (e != null ? e : this.tags).forEach((i) => {
252
- const l = this.getVisible(i);
253
- i.state && (i.state.visible = l);
233
+ const f = this.getVisible(i);
234
+ i.state && (i.state.visible = f);
254
235
  });
255
236
  }
256
237
  setUnfoldedByPanoIndex() {
257
238
  this.tags.forEach((e) => {
258
239
  const i = this.getUnfoldedByPanoIndex(e);
259
240
  if (e.state && (i !== void 0 && (e.state.unfolded = i), i && !e.state.visible)) {
260
- const l = this.getTagConfig(e);
261
- typeof l.unfoldedConfig == "object" && l.unfoldedConfig.autoFoldWhenHide !== !1 && (e.state.unfolded = !1);
241
+ const f = this.getTagConfig(e);
242
+ typeof f.unfoldedConfig == "object" && f.unfoldedConfig.autoFoldWhenHide !== !1 && (e.state.unfolded = !1);
262
243
  }
263
244
  });
264
245
  }
@@ -266,59 +247,59 @@ class Je extends N {
266
247
  * @description 一个点的标签
267
248
  */
268
249
  getTagProject(e) {
269
- const i = x(e);
250
+ const i = P(e);
270
251
  if (!i)
271
252
  return;
272
- const { x: l, y: t, z: n } = i.project(this.five.camera);
273
- if (!(n > 1))
274
- return { x: l, y: t, z: n };
253
+ const { x: f, y: t, z: s } = i.project(this.five.camera);
254
+ if (!(s > 1))
255
+ return { x: f, y: t, z: s };
275
256
  }
276
257
  /** 通过射线检测标签可用性 */
277
258
  getTagEnableByIntersect(e, i) {
278
- var o, r, c, v, a;
279
- const l = R(R((o = this.getTagConfig(e).visibleConfig) != null ? o : {}).intersectRaycaster), t = i != null ? i : this.five.getCurrentState().panoIndex, n = b(this.five.getCurrentState().mode) ? this.getObserverPosition(t) : this.five.camera.position;
280
- if (n === void 0)
259
+ var n, r, l, v, a;
260
+ const f = R(R((n = this.getTagConfig(e).visibleConfig) != null ? n : {}).intersectRaycaster), t = i != null ? i : this.five.getCurrentState().panoIndex, s = b(this.five.getCurrentState().mode) ? this.getObserverPosition(t) : this.five.camera.position;
261
+ if (s === void 0)
281
262
  return { value: !1, reason: { type: "startPosition is undefined", fivePanoIndex: t } };
282
- const f = W(
263
+ const d = W(
283
264
  (() => {
284
- var h;
285
- const d = (h = l.checkPoints) != null ? h : "center";
286
- return d === "center" ? x(e) : d === "corner" ? z(e) : Array.isArray(d) ? d : [];
265
+ var g;
266
+ const c = (g = f.checkPoints) != null ? g : "center";
267
+ return c === "center" ? P(e) : c === "corner" ? O(e) : Array.isArray(c) ? c : [];
287
268
  })()
288
269
  );
289
- let s = 0, u = 0;
290
- for (const d of f) {
291
- const h = new j.Vector3().subVectors(d, n).normalize();
292
- I.set(n, h);
293
- const U = n.distanceTo(d), [y] = this.five.model.intersectRaycaster(I), P = (() => {
270
+ let o = 0, u = 0;
271
+ for (const c of d) {
272
+ const g = new U.Vector3().subVectors(c, s).normalize();
273
+ I.set(s, g);
274
+ const F = s.distanceTo(c), [y] = this.five.model.intersectRaycaster(I), x = (() => {
294
275
  if (!D(e))
295
276
  return;
296
- const A = this.tags.filter(D).map((V) => {
297
- var T;
298
- return (T = V.model) == null ? void 0 : T.object;
299
- }).filter(H), [S] = I.intersectObjects(A, !0);
300
- return S;
301
- })(), _ = (r = l.distanceAccuracy) != null ? r : 0.01;
302
- Math.min((c = y == null ? void 0 : y.distance) != null ? c : 1 / 0, (v = P == null ? void 0 : P.distance) != null ? v : 1 / 0) + _ >= U ? s++ : u++;
303
- const F = (a = l.needPassed) != null ? a : 1;
304
- if (s >= F)
277
+ const V = this.tags.filter(D).map((A) => {
278
+ var C;
279
+ return (C = A.model) == null ? void 0 : C.object;
280
+ }).filter(H), [B] = I.intersectObjects(V, !0);
281
+ return B;
282
+ })(), j = (r = f.distanceAccuracy) != null ? r : 0.01;
283
+ Math.min((l = y == null ? void 0 : y.distance) != null ? l : 1 / 0, (v = x == null ? void 0 : x.distance) != null ? v : 1 / 0) + j >= F ? o++ : u++;
284
+ const S = (a = f.needPassed) != null ? a : 1;
285
+ if (o >= S)
305
286
  return { value: !0 };
306
287
  }
307
288
  return u === 0 ? { value: !0 } : {
308
289
  value: !1,
309
290
  reason: {
310
291
  type: "intersectRaycaster check failed",
311
- passedCount: s,
312
- needPassed: l.needPassed
292
+ passedCount: o,
293
+ needPassed: f.needPassed
313
294
  }
314
295
  };
315
296
  }
316
297
  /** 检测是否匹配当前楼层 */
317
298
  getVisibleByFloorIndex(e) {
318
- var n, f, s, u, o, r, c;
299
+ var s, d, o, u, n, r, l;
319
300
  let i = 0;
320
- const l = (n = e.fiveState) == null ? void 0 : n.panoIndex;
321
- l !== void 0 ? i = (f = this.work.observers[l]) == null ? void 0 : f.floorIndex : i = q(this.work, (c = (r = (u = (s = e.model) == null ? void 0 : s.object) == null ? void 0 : u.position) != null ? r : (o = e.mediaPlane) == null ? void 0 : o.position) != null ? c : x(e));
301
+ const f = (s = e.fiveState) == null ? void 0 : s.panoIndex;
302
+ f !== void 0 ? i = (d = this.work.observers[f]) == null ? void 0 : d.floorIndex : i = q(this.work, (l = (r = (u = (o = e.model) == null ? void 0 : o.object) == null ? void 0 : u.position) != null ? r : (n = e.mediaPlane) == null ? void 0 : n.position) != null ? l : P(e));
322
303
  const t = this.five.model.shownFloor;
323
304
  return t === null || t === i;
324
305
  }
@@ -55,6 +55,10 @@ export declare abstract class TagRender extends TagComputer {
55
55
  protected updateTagCss3DObjectMatrix<S extends 'Model' | 'Plane' = 'Model'>(tag: TagInstance<TagContentType, S>, model: Object3D): void;
56
56
  /** 添加模型标签 */
57
57
  protected addMediaModelTag(tags: Tag[]): Promise<void>;
58
+ /**
59
+ * @description: 一个点的标签
60
+ */
61
+ protected setPointTagPosition(): void;
58
62
  /**
59
63
  * @description: 渲染单个点的标签
60
64
  */