@realsee/dnalogel 3.74.3 → 3.74.4-alpha.0

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.
@@ -0,0 +1,2 @@
1
+ import type { Model } from "@realsee/five";
2
+ export declare function getDistanceFromModel(model: Model, fov: number, aspect: number): number;
@@ -1,11 +1,11 @@
1
1
  var I = Object.defineProperty;
2
2
  var M = (p, h, t) => h in p ? I(p, h, { enumerable: !0, configurable: !0, writable: !0, value: t }) : p[h] = t;
3
3
  var c = (p, h, t) => (M(p, typeof h != "symbol" ? h + "" : h, t), t);
4
- import { BaseTag as U } from "./BaseTag.js";
4
+ import { BaseTag as R } from "./BaseTag.js";
5
5
  import * as r from "three";
6
- import { Line as R } from "@realsee/five/line";
6
+ import { Line as U } from "@realsee/five/line";
7
7
  import { anyPositionToVector3 as g } from "../../../shared-utils/positionToVector3.js";
8
- import { transformPosition as P } from "../../../shared-utils/five/transformPosition.js";
8
+ import { transformPosition as D } from "../../../shared-utils/five/transformPosition.js";
9
9
  import "../../../shared-utils/Subscribe.js";
10
10
  import "../../utils/tag/calculateTagConfig.js";
11
11
  import "../../../vendor/object-assign-deep/objectAssignDeep.js";
@@ -88,8 +88,8 @@ import "../../../shared-utils/five/getFloorIndex.js";
88
88
  import "../../../shared-utils/safeObj.js";
89
89
  import "../../utils/Cache.js";
90
90
  import "../../../shared-utils/promise/withResolvers.js";
91
- const _ = new r.Vector2();
92
- class _i extends U {
91
+ const P = new r.Vector2();
92
+ class _i extends R {
93
93
  constructor(t, e) {
94
94
  var o, i, n, s, a;
95
95
  super(t, e);
@@ -133,8 +133,8 @@ class _i extends U {
133
133
  const t = this.config;
134
134
  if (!this.five.renderer || !((n = t == null ? void 0 : t.tagNormalLineConfig) != null && n.enabled) || !this.normalLineLength)
135
135
  return;
136
- const e = this.five.renderer.getSize(_), o = this.five.renderer.getPixelRatio(), i = P(g(this.originPosition), this.plugin.workUtil.transform);
137
- this.tagNormalLine = new R(new r.Vector3().fromArray(this.position), i), this.tagNormalLine.points.visible = !1, this.tagNormalLine.setMaterial({
136
+ const e = this.five.renderer.getSize(P), o = this.five.renderer.getPixelRatio(), i = D(g(this.originPosition), this.plugin.workUtil.transform);
137
+ this.tagNormalLine = new U(new r.Vector3().fromArray(this.position), i), this.tagNormalLine.points.visible = !1, this.tagNormalLine.setMaterial({
138
138
  color: new r.Vector3(1, 1, 1),
139
139
  linewidth: (a = (s = t == null ? void 0 : t.tagNormalLineConfig) == null ? void 0 : s.lineWidth) != null ? a : 1.2,
140
140
  dashed: !1
@@ -179,13 +179,12 @@ class _i extends U {
179
179
  }
180
180
  setPosition(t) {
181
181
  this.originPosition = t, this.position = (() => {
182
- const e = this.plugin.workUtil.transform;
183
- let o = P(g(t), e).toArray();
182
+ let e = g(t).toArray();
184
183
  if (this.normal && this.normalLineLength) {
185
- const i = this.computeNormal();
186
- o = new r.Vector3().fromArray(o).clone().add(i.clone().setLength(this.normalLineLength)).toArray();
184
+ const o = this.computeNormal();
185
+ e = new r.Vector3().fromArray(e).clone().add(o.clone().setLength(this.normalLineLength)).toArray();
187
186
  }
188
- return o;
187
+ return e;
189
188
  })(), this.cache.clear(), this._lastUpdateCache.position = [0, 0, 0], this.updateVisible(), this.updateScreenPosition(), this.updateZIndex(), this.plugin.addRenderQueue({ type: "TagContainerSvelte", keys: ["tags"] });
190
189
  }
191
190
  /**
@@ -193,7 +192,7 @@ class _i extends U {
193
192
  * 使用屏幕空间反投影方法,确保任意视角下都保持固定像素距离
194
193
  */
195
194
  updateTagNormalLinePosition(t) {
196
- var L, x, C, N, S, T, D;
195
+ var b, L, x, C, N, S, T;
197
196
  if (!this.screenPosition || !this.tagNormalLine)
198
197
  return;
199
198
  const { force: e = !1 } = t != null ? t : {};
@@ -203,29 +202,32 @@ class _i extends U {
203
202
  }
204
203
  const i = this._lastUpdateCache;
205
204
  if (!(this.visible !== i.visible)) {
206
- const u = Math.abs(this.position[0] - i.position[0]) > 1e-3 || Math.abs(this.position[1] - i.position[1]) > 1e-3 || Math.abs(this.position[2] - i.position[2]) > 1e-3, E = Math.abs(((L = this.screenPosition.leftPx) != null ? L : 0) - i.screenLeft) > 0.5 || Math.abs(((x = this.screenPosition.topPx) != null ? x : 0) - i.screenTop) > 0.5 || Math.abs(((C = this.screenPosition.scale) != null ? C : 1) - i.scale) > 2e-3;
205
+ const u = Math.abs(this.position[0] - i.position[0]) > 1e-3 || Math.abs(this.position[1] - i.position[1]) > 1e-3 || Math.abs(this.position[2] - i.position[2]) > 1e-3, E = Math.abs(((b = this.screenPosition.leftPx) != null ? b : 0) - i.screenLeft) > 0.5 || Math.abs(((L = this.screenPosition.topPx) != null ? L : 0) - i.screenTop) > 0.5 || Math.abs(((x = this.screenPosition.scale) != null ? x : 1) - i.scale) > 2e-3;
207
206
  if (!u && !E)
208
207
  return;
209
208
  }
210
- if (i.position = new r.Vector3().fromArray(this.position).toArray(), i.screenLeft = (N = this.screenPosition.leftPx) != null ? N : 0, i.screenTop = (S = this.screenPosition.topPx) != null ? S : 0, i.scale = (T = this.screenPosition.scale) != null ? T : 1, i.visible = this.visible, !this.five.renderer)
209
+ if (i.position = new r.Vector3().fromArray(this.position).toArray(), i.screenLeft = (C = this.screenPosition.leftPx) != null ? C : 0, i.screenTop = (N = this.screenPosition.topPx) != null ? N : 0, i.scale = (S = this.screenPosition.scale) != null ? S : 1, i.visible = this.visible, !this.five.renderer)
211
210
  return;
212
- const s = this.five.renderer.getSize(_), a = P(g(this.originPosition), this.plugin.workUtil.transform).toArray();
211
+ const s = this.five.renderer.getSize(P), a = D(
212
+ g(this.originPosition),
213
+ this.plugin.workUtil.transform
214
+ ).toArray();
213
215
  this._temp.lineStart.fromArray(a), this._temp.iconPos.fromArray(this.position), this._temp.lineStart.project(this.five.camera), this._temp.iconPos.project(this.five.camera), this._temp.screenDirPixel.set(
214
216
  (this._temp.iconPos.x - this._temp.lineStart.x) * s.x / 2,
215
217
  (this._temp.iconPos.y - this._temp.lineStart.y) * s.y / 2
216
218
  );
217
219
  const d = this._temp.screenDirPixel.length();
218
220
  this._temp.screenDirPixel.normalize();
219
- const m = this.iconPixelGap * ((D = this.screenPosition.scale) != null ? D : 1);
221
+ const m = this.iconPixelGap * ((T = this.screenPosition.scale) != null ? T : 1);
220
222
  this._temp.targetNDC.set(
221
223
  (this._temp.iconPos.x * s.x / 2 - this._temp.screenDirPixel.x * m) / (s.x / 2),
222
224
  (this._temp.iconPos.y * s.y / 2 - this._temp.screenDirPixel.y * m) / (s.y / 2)
223
225
  ), this._temp.raycaster.setFromCamera(this._temp.targetNDC, this.five.camera);
224
226
  const l = this._temp.raycaster.ray;
225
227
  this._temp.lineStart.fromArray(a), this._temp.iconPos.fromArray(this.position), this._temp.lineDir.copy(this._temp.iconPos).sub(this._temp.lineStart).normalize(), this._temp.lineEnd.copy(l.origin).sub(this._temp.lineStart);
226
- const A = l.direction.dot(l.direction), f = l.direction.dot(this._temp.lineDir), y = this._temp.lineDir.dot(this._temp.lineDir), w = l.direction.dot(this._temp.lineEnd), V = this._temp.lineDir.dot(this._temp.lineEnd), v = A * y - f * f;
227
- let b = 0;
228
- Math.abs(v) > 1e-4 && (b = (f * V - y * w) / v), this._temp.lineEnd.copy(l.origin).add(l.direction.multiplyScalar(Math.max(0, b)));
228
+ const A = l.direction.dot(l.direction), f = l.direction.dot(this._temp.lineDir), _ = this._temp.lineDir.dot(this._temp.lineDir), w = l.direction.dot(this._temp.lineEnd), V = this._temp.lineDir.dot(this._temp.lineEnd), y = A * _ - f * f;
229
+ let v = 0;
230
+ Math.abs(y) > 1e-4 && (v = (f * V - _ * w) / y), this._temp.lineEnd.copy(l.origin).add(l.direction.multiplyScalar(Math.max(0, v)));
229
231
  const k = this._temp.lineStart.distanceTo(this._temp.iconPos);
230
232
  if (this._temp.lineStart.distanceTo(this._temp.lineEnd) > k) {
231
233
  const u = Math.max(0, 1 - m / d);
@@ -254,7 +256,7 @@ class _i extends U {
254
256
  return 1;
255
257
  const l = 2 * Math.tan(0.5 * this.five.camera.fov / 180 * Math.PI);
256
258
  return Math.max(Math.min(1 - l * a / 40, 1), 0.7);
257
- })(), m = this.five.renderer.getSize(_);
259
+ })(), m = this.five.renderer.getSize(P);
258
260
  this.screenPosition = {
259
261
  leftPx: (n.x + 1) / 2 * m.x,
260
262
  topPx: (-n.y + 1) / 2 * m.y,
@@ -1,7 +1,7 @@
1
1
  var e = Object.defineProperty;
2
2
  var s = (o, t, i) => t in o ? e(o, t, { enumerable: !0, configurable: !0, writable: !0, value: i }) : o[t] = i;
3
3
  var r = (o, t, i) => (s(o, typeof t != "symbol" ? t + "" : t, i), i);
4
- import { Subscribe as m } from "../shared-utils/Subscribe.js";
4
+ import { Subscribe as l } from "../shared-utils/Subscribe.js";
5
5
  import "../shared-utils/tag.js";
6
6
  import "three";
7
7
  import "../vendor/hammerjs/hammer.js";
@@ -15,7 +15,7 @@ import "../shared-utils/three/blink.js";
15
15
  import "../vendor/@tweenjs/tween/dist/tween.esm.js.js";
16
16
  import "../CSS3DRenderPlugin/utils/three/CSS3DRender.js";
17
17
  import "../vendor/earcut/src/earcut.js";
18
- import { FiveUtil as l } from "../shared-utils/Utils/FiveUtil.js";
18
+ import { FiveUtil as m } from "../shared-utils/Utils/FiveUtil.js";
19
19
  import { DEFAULT_STATIC_PREFIX as p } from "../shared-utils/url/defaultUrls.js";
20
20
  import "../shared-utils/five/FivePuppet.js";
21
21
  let I = class {
@@ -23,7 +23,7 @@ let I = class {
23
23
  /**
24
24
  * @realsee/dnalogel 版本号
25
25
  */
26
- r(this, "VERSION", "3.74.3");
26
+ r(this, "VERSION", "3.74.4-alpha.0");
27
27
  r(this, "NAME");
28
28
  r(this, "five");
29
29
  r(this, "workUtil");
@@ -31,9 +31,9 @@ let I = class {
31
31
  /**
32
32
  * @description: 插件事件钩子
33
33
  */
34
- r(this, "hooks", new m());
34
+ r(this, "hooks", new l());
35
35
  r(this, "staticPrefix", p);
36
- this.five = t, this.fiveUtil = new l(t), this.workUtil = this.fiveUtil.workUtil, i != null && i.staticPrefix && (this.staticPrefix = i.staticPrefix);
36
+ this.five = t, this.fiveUtil = new m(t), this.workUtil = this.fiveUtil.workUtil, i != null && i.staticPrefix && (this.staticPrefix = i.staticPrefix);
37
37
  }
38
38
  set workCode(t) {
39
39
  this.workUtil.workCode = t, this.onWorkCodeChange();
@@ -101,6 +101,7 @@ import "../../shared-utils/five/transformPosition.js";
101
101
  import "../../shared-utils/five/getFiveModel.js";
102
102
  import "../../shared-utils/nearlyEqual.js";
103
103
  import "../../shared-utils/five/changeMode.js";
104
+ import "../../shared-utils/translateMode/getDistanceFromModel.js";
104
105
  import "../../shared-utils/positionToVector3.js";
105
106
  import "../../shared-utils/five/vector3ToScreen.js";
106
107
  import "../../shared-utils/three/temp.js";
@@ -155,7 +156,7 @@ function Q(l) {
155
156
  const { latitude: h, longitude: t } = l, e = Math.abs(h - Math.PI / 2) < 10 * Math.PI / 180, i = t < 30 * (Math.PI / 180) || t > 330 * (Math.PI / 180);
156
157
  return e && i;
157
158
  }
158
- class mi extends G {
159
+ class pi extends G {
159
160
  constructor(t, e) {
160
161
  var a, d;
161
162
  super(t);
@@ -513,5 +514,5 @@ class mi extends G {
513
514
  }
514
515
  }
515
516
  export {
516
- mi as Controller
517
+ pi as Controller
517
518
  };
@@ -115,11 +115,12 @@ import "../utils/correctFiveState.js";
115
115
  import "../utils/constant.js";
116
116
  import "../../shared-utils/nearlyEqual.js";
117
117
  import "../../shared-utils/five/changeMode.js";
118
+ import "../../shared-utils/translateMode/getDistanceFromModel.js";
118
119
  import "../../shared-utils/changeModelCanvasOpacity.js";
119
120
  import "../../shared-utils/url/replace-static-prefix.js";
120
121
  import "../../shared-utils/url/absoluteUrl.js";
121
- const gr = (o, r) => new t(o, r);
122
+ const vr = (o, r) => new t(o, r);
122
123
  export {
123
- gr as MapviewFloorplanPlugin,
124
- gr as default
124
+ vr as MapviewFloorplanPlugin,
125
+ vr as default
125
126
  };
@@ -99,6 +99,7 @@ import "../../shared-utils/five/transformPosition.js";
99
99
  import "../../shared-utils/five/getFiveModel.js";
100
100
  import "../../shared-utils/nearlyEqual.js";
101
101
  import "../../shared-utils/five/changeMode.js";
102
+ import "../../shared-utils/translateMode/getDistanceFromModel.js";
102
103
  import "../../shared-utils/positionToVector3.js";
103
104
  import "../../shared-utils/five/vector3ToScreen.js";
104
105
  import "../../shared-utils/three/temp.js";
@@ -153,7 +154,7 @@ function z(d) {
153
154
  const { latitude: s, longitude: t } = d, e = Math.abs(s - Math.PI / 2) < 10 * Math.PI / 180, i = t < 30 * (Math.PI / 180) || t > 330 * (Math.PI / 180);
154
155
  return e && i;
155
156
  }
156
- class ti extends T {
157
+ class ei extends T {
157
158
  constructor(t, e) {
158
159
  var a, p, c;
159
160
  super(t);
@@ -487,5 +488,5 @@ class ti extends T {
487
488
  }
488
489
  }
489
490
  export {
490
- ti as Controller
491
+ ei as Controller
491
492
  };
@@ -114,11 +114,12 @@ import "../utils/correctFiveState.js";
114
114
  import "../utils/constant.js";
115
115
  import "../../shared-utils/nearlyEqual.js";
116
116
  import "../../shared-utils/five/changeMode.js";
117
+ import "../../shared-utils/translateMode/getDistanceFromModel.js";
117
118
  import "../../shared-utils/changeModelCanvasOpacity.js";
118
119
  import "../../shared-utils/url/replace-static-prefix.js";
119
120
  import "../../shared-utils/url/absoluteUrl.js";
120
- const gr = (o, r) => new t(o, r);
121
+ const wr = (o, r) => new t(o, r);
121
122
  export {
122
- gr as ModelFloorplanPlugin,
123
- gr as default
123
+ wr as ModelFloorplanPlugin,
124
+ wr as default
124
125
  };
@@ -6,6 +6,7 @@ export interface ShowState {
6
6
  fov?: number;
7
7
  mode: Mode;
8
8
  offset?: THREE.Vector3;
9
+ distance?: number;
9
10
  }
10
11
  /** 判断当前状态是否可以展示户型图 */
11
12
  export declare function checkShowState(five: Five, showState: ShowState): boolean;
@@ -1,54 +1,57 @@
1
- var l = (e, t, o) => new Promise((m, n) => {
2
- var i = (r) => {
1
+ var l = (t, r, o) => new Promise((m, n) => {
2
+ var f = (e) => {
3
3
  try {
4
- u(o.next(r));
5
- } catch (f) {
6
- n(f);
4
+ i(o.next(e));
5
+ } catch (u) {
6
+ n(u);
7
7
  }
8
- }, a = (r) => {
8
+ }, a = (e) => {
9
9
  try {
10
- u(o.throw(r));
11
- } catch (f) {
12
- n(f);
10
+ i(o.throw(e));
11
+ } catch (u) {
12
+ n(u);
13
13
  }
14
- }, u = (r) => r.done ? m(r.value) : Promise.resolve(r.value).then(i, a);
15
- u((o = o.apply(e, t)).next());
14
+ }, i = (e) => e.done ? m(e.value) : Promise.resolve(e.value).then(f, a);
15
+ i((o = o.apply(t, r)).next());
16
16
  });
17
17
  import { to as s } from "../../shared-utils/to.js";
18
- import { FloorplanErrorType as p } from "./constant.js";
18
+ import { FloorplanErrorType as g } from "./constant.js";
19
19
  import { nearlyEqual as d } from "../../shared-utils/nearlyEqual.js";
20
- import { changeMode as M } from "../../shared-utils/five/changeMode.js";
21
- import { omit as g } from "../../shared-utils/filter.js";
22
- function h(e, t) {
23
- if (e.currentMode !== t.mode)
20
+ import { changeMode as C } from "../../shared-utils/five/changeMode.js";
21
+ import { omit as E } from "../../shared-utils/filter.js";
22
+ import { getDistanceFromModel as y } from "../../shared-utils/translateMode/getDistanceFromModel.js";
23
+ function h(t, r) {
24
+ if (t.currentMode !== r.mode)
24
25
  return !1;
25
- const { latitude: o, longitude: m, fov: n, offset: i } = t, { latitude: a, longitude: u, offset: r } = e.getCurrentState(), f = e.camera.fov;
26
- return !(!d(o, a, 2) || !d(m, u, 2) || i !== void 0 && i.distanceTo(r) > 0.01 || !d(n, f, 2));
26
+ const { latitude: o, longitude: m, fov: n, offset: f } = r, { latitude: a, longitude: i, offset: e } = t.getCurrentState(), u = t.camera.fov;
27
+ return !(!d(o, a, 2) || !d(m, i, 2) || f !== void 0 && f.distanceTo(e) > 0.01 || !d(n, u, 2));
27
28
  }
28
- function b(e, t, o = !0) {
29
+ function x(t, r, o = !0) {
29
30
  return l(this, null, function* () {
30
- if (h(e, t) === !0)
31
+ if (h(t, r) === !0)
31
32
  return;
32
- const n = e.getCurrentState();
33
- if (n.mode !== t.mode) {
34
- const [c] = yield s(M(e, [t.mode, t, void 0, o]));
33
+ const n = t.getCurrentState();
34
+ if (n.mode !== r.mode) {
35
+ const p = t.models.find((M) => M.name === t.state.workCode);
36
+ r.distance = y(p, r.fov, t.camera.aspect);
37
+ const [c] = yield s(C(t, [r.mode, r, void 0, o]));
35
38
  if (c)
36
39
  throw c;
37
40
  return;
38
41
  }
39
- const { latitude: i, longitude: a, fov: u } = n, r = Math.min(
42
+ const { latitude: f, longitude: a, fov: i } = n, e = Math.min(
40
43
  1e3,
41
44
  Math.max(
42
45
  200,
43
- Math.abs(i - Math.PI / 2) * 1e3,
46
+ Math.abs(f - Math.PI / 2) * 1e3,
44
47
  (a > Math.PI ? 2 * Math.PI - a : a) * 500,
45
- typeof t.fov == "number" ? Math.abs(u - t.fov) * 10 : 1 / 0
48
+ typeof r.fov == "number" ? Math.abs(i - r.fov) * 10 : 1 / 0
46
49
  )
47
- ), [f] = yield s(e.updateCamera(g(t, ["mode"]), r, o));
48
- if (f)
49
- throw new Error(p.UpdateCameraError);
50
+ ), [u] = yield s(t.updateCamera(E(r, ["mode"]), e, o));
51
+ if (u)
52
+ throw new Error(g.UpdateCameraError);
50
53
  });
51
54
  }
52
55
  export {
53
- b as correctFiveState
56
+ x as correctFiveState
54
57
  };