@vsleem-realsee-viewer/bimsee-plugin 2.0.12 → 2.0.13

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.
@@ -62,6 +62,7 @@ declare function __VLS_template(): {
62
62
  isMouseover: () => boolean;
63
63
  isMousedown: () => boolean;
64
64
  setState: (options?: Partial<import('..').MaskerProps>) => void;
65
+ setVisible: (visible: boolean) => void;
65
66
  setMousedown: (mousedown: boolean) => void;
66
67
  setMouseover: (mouseover: boolean) => void;
67
68
  setMinFov: (minFov: number) => void;
@@ -111,11 +112,12 @@ declare function __VLS_template(): {
111
112
  "onPosition-updated"?: ((...args: any[]) => any) | undefined;
112
113
  "onZoom-updated"?: ((...args: any[]) => any) | undefined;
113
114
  onReady?: ((...args: any[]) => any) | undefined;
114
- }>, "dataHelper" | "isMouseover" | "isMousedown" | "setState" | "setMousedown" | "setMouseover" | "setMinFov" | "setMaxFov" | "setMaskerStatus" | "zoom" | "rotate" | "getState" | "getPosition" | "getZoomLevel" | "getCameraPosition" | "getCameraTarget" | "getCameraHFov" | "getCameraStatus"> & import('vue').ShallowUnwrapRef<{
115
+ }>, "dataHelper" | "isMouseover" | "isMousedown" | "setState" | "setVisible" | "setMousedown" | "setMouseover" | "setMinFov" | "setMaxFov" | "setMaskerStatus" | "zoom" | "rotate" | "getState" | "getPosition" | "getZoomLevel" | "getCameraPosition" | "getCameraTarget" | "getCameraHFov" | "getCameraStatus"> & import('vue').ShallowUnwrapRef<{
115
116
  dataHelper: import('../types').DataHelper;
116
117
  isMouseover: () => boolean;
117
118
  isMousedown: () => boolean;
118
119
  setState: (options?: Partial<import('..').MaskerProps>) => void;
120
+ setVisible: (visible: boolean) => void;
119
121
  setMousedown: (mousedown: boolean) => void;
120
122
  setMouseover: (mouseover: boolean) => void;
121
123
  setMinFov: (minFov: number) => void;
@@ -221,6 +223,7 @@ declare const __VLS_component: import('vue').DefineComponent<BimseeProps, {
221
223
  isMouseover: () => boolean;
222
224
  isMousedown: () => boolean;
223
225
  setState: (options?: Partial<import('..').MaskerProps>) => void;
226
+ setVisible: (visible: boolean) => void;
224
227
  setMousedown: (mousedown: boolean) => void;
225
228
  setMouseover: (mouseover: boolean) => void;
226
229
  setMinFov: (minFov: number) => void;
@@ -270,11 +273,12 @@ declare const __VLS_component: import('vue').DefineComponent<BimseeProps, {
270
273
  "onPosition-updated"?: ((...args: any[]) => any) | undefined;
271
274
  "onZoom-updated"?: ((...args: any[]) => any) | undefined;
272
275
  onReady?: ((...args: any[]) => any) | undefined;
273
- }>, "dataHelper" | "isMouseover" | "isMousedown" | "setState" | "setMousedown" | "setMouseover" | "setMinFov" | "setMaxFov" | "setMaskerStatus" | "zoom" | "rotate" | "getState" | "getPosition" | "getZoomLevel" | "getCameraPosition" | "getCameraTarget" | "getCameraHFov" | "getCameraStatus"> & import('vue').ShallowUnwrapRef<{
276
+ }>, "dataHelper" | "isMouseover" | "isMousedown" | "setState" | "setVisible" | "setMousedown" | "setMouseover" | "setMinFov" | "setMaxFov" | "setMaskerStatus" | "zoom" | "rotate" | "getState" | "getPosition" | "getZoomLevel" | "getCameraPosition" | "getCameraTarget" | "getCameraHFov" | "getCameraStatus"> & import('vue').ShallowUnwrapRef<{
274
277
  dataHelper: import('../types').DataHelper;
275
278
  isMouseover: () => boolean;
276
279
  isMousedown: () => boolean;
277
280
  setState: (options?: Partial<import('..').MaskerProps>) => void;
281
+ setVisible: (visible: boolean) => void;
278
282
  setMousedown: (mousedown: boolean) => void;
279
283
  setMouseover: (mouseover: boolean) => void;
280
284
  setMinFov: (minFov: number) => void;
@@ -27,6 +27,7 @@ declare const __VLS_component: import('vue').DefineComponent<__VLS_Props, {
27
27
  isMouseover: () => boolean;
28
28
  isMousedown: () => boolean;
29
29
  setState: (options?: Partial<import('..').MaskerProps>) => void;
30
+ setVisible: (visible: boolean) => void;
30
31
  setMousedown: (mousedown: boolean) => void;
31
32
  setMouseover: (mouseover: boolean) => void;
32
33
  setMinFov: (minFov: number) => void;
package/dist/index.d.ts CHANGED
@@ -1,15 +1,12 @@
1
+ /** 组件导出 */
1
2
  export { Bimsee as BimseePlugin } from './components';
2
3
  export { default as Bimsee } from './components/Bimsee.vue';
3
- export type { SearchInfo, // 搜索信息
4
- BimseeSetting, //bim配置
5
- CameraStatus, //相机状态
6
- ViewerOptions, } from './types';
7
- export type { UpdatableBimseeProps, // 可更新的Bimsee属性
8
- BimseeProps, //Bimsee 组件属性
9
- BimseeElement, // Bimsee 元素类型
10
- BimseeStore, // Bimsee 状态管理元素类型
11
- UpdatableMaskerProps, // 可更新的蒙层属性
12
- MaskerProps, // 蒙层属性
13
- MaskerElement, } from './types';
14
- export { BIMSEE_CONFIG, // Realsee 默认设置
15
- MASKER_CONFIG, } from './settings';
4
+ /** 配置相关类型导出 */
5
+ export type { SearchInfo /** 搜索信息 */, BimseeSetting /** bim配置 */, CameraStatus /** 相机状态 */, ViewerOptions /** 视图选项 */, } from './types';
6
+ /** 组件属性类型导出 */
7
+ export type {
8
+ /** Bimsee 相关 */
9
+ UpdatableBimseeProps /** 可更新的Bimsee属性 */, BimseeProps /** Bimsee 组件属性 */, BimseeElement /** Bimsee 元素类型 */, BimseeStore /** Bimsee 状态管理元素类型 */,
10
+ /** 蒙层相关 */
11
+ UpdatableMaskerProps /** 可更新的蒙层属性 */, MaskerProps /** 蒙层属性 */, MaskerElement /** 蒙层元素类型 */, } from './types';
12
+ export { BIMSEE_CONFIG /** Realsee 默认设置 */, MASKER_CONFIG /** 蒙层默认配置 */, } from './settings';
package/dist/index.mjs CHANGED
@@ -1,26 +1,18 @@
1
- import { ref as y, computed as F, watch as $, unref as C, defineComponent as ae, onBeforeUnmount as re, createElementBlock as se, openBlock as ie, withDirectives as Se, renderSlot as H, createElementVNode as ke, vShow as Te, normalizeProps as q, guardReactiveProps as K, onMounted as Ee, createVNode as Ce, mergeProps as Le, toHandlers as _e, withCtx as Ie } from "vue";
2
- import { APP_SETTING as Fe, utils as ue, Position as G, Vector3 as te, Point as Re, CoordinateModelType as be, AppError as j, DataSource as ze, http as xe } from "@vsleem-realsee-viewer/shared";
1
+ import { ref as y, computed as F, watch as $, unref as C, defineComponent as ae, onBeforeUnmount as re, createElementBlock as se, openBlock as ie, withDirectives as ke, renderSlot as H, createElementVNode as Te, vShow as Ee, normalizeProps as q, guardReactiveProps as K, onMounted as Ce, createVNode as Le, mergeProps as _e, toHandlers as Ie, withCtx as Fe } from "vue";
2
+ import { APP_SETTING as be, utils as ue, Position as G, Vector3 as te, Point as Re, CoordinateModelType as ze, AppError as j, DataSource as xe, http as Be } from "@vsleem-realsee-viewer/shared";
3
3
  const W = {
4
4
  visible: !0,
5
- //是否可见
6
5
  defaultYaw: 0,
7
- // 默认偏航角
8
6
  defaultPitch: 0,
9
- // 默认俯仰角
10
7
  defaultZoomLvl: 30,
11
- // 默认缩放级别
12
8
  minFov: 20,
13
- //最小视野角度
14
9
  maxFov: 120
15
- // 最大视野角度
16
- }, Be = {
17
- appSetting: Fe,
18
- //全局设置
10
+ }, Ne = {
11
+ appSetting: be,
19
12
  masker: W,
20
13
  immediate: !0
21
- // 是否立即生效
22
- }, { cloneDeep: oe, deepMergeProps: Ne, getDiffProps: De } = ue;
23
- function Ye(r, m, n, d) {
14
+ }, { cloneDeep: oe, deepMergeProps: De, getDiffProps: Ye } = ue;
15
+ function $e(r, m, n, d) {
24
16
  const a = y(oe(W)), s = y(), f = y(), t = F(() => a.value), h = F(() => {
25
17
  const { coordinateTree: e, mappedCoordinateTree: o, currentSpace: v, currentModel: M, currentPoint: w } = m.value || {};
26
18
  return {
@@ -35,22 +27,22 @@ function Ye(r, m, n, d) {
35
27
  });
36
28
  $(() => oe(r.value.masker), S, { immediate: !0, deep: !0 });
37
29
  function S(e, o) {
38
- const v = De(e, o);
39
- l(v);
30
+ const v = Ye(e, o);
31
+ c(v);
40
32
  }
41
33
  function u() {
42
34
  return C(t);
43
35
  }
44
- function l(e) {
45
- e && Ne(a.value, e);
36
+ function c(e) {
37
+ e && De(a.value, e);
46
38
  }
47
39
  function k() {
48
40
  const e = C(n);
49
- e && (e.addEventListener("mousedown", L), e.addEventListener("touchstart", L), e.addEventListener("click", I), window.addEventListener("mousemove", E), window.addEventListener("touchmove", E), window.addEventListener("mouseup", p), window.addEventListener("touchend", p), e.addEventListener("mouseover", i), e.addEventListener("mouseout", c), e.addEventListener("wheel", g));
41
+ e && (e.addEventListener("mousedown", L), e.addEventListener("touchstart", L), e.addEventListener("click", I), window.addEventListener("mousemove", E), window.addEventListener("touchmove", E), window.addEventListener("mouseup", p), window.addEventListener("touchend", p), e.addEventListener("mouseover", i), e.addEventListener("mouseout", l), e.addEventListener("wheel", g));
50
42
  }
51
43
  function T() {
52
44
  const e = C(n);
53
- e && (e.removeEventListener("mousedown", L), e.removeEventListener("touchstart", L), window.removeEventListener("mousemove", E), window.removeEventListener("touchmove", E), window.removeEventListener("mouseup", p), window.removeEventListener("touchend", p), e.removeEventListener("mouseover", i), e.removeEventListener("mouseout", c), e.removeEventListener("wheel", g));
45
+ e && (e.removeEventListener("mousedown", L), e.removeEventListener("touchstart", L), window.removeEventListener("mousemove", E), window.removeEventListener("touchmove", E), window.removeEventListener("mouseup", p), window.removeEventListener("touchend", p), e.removeEventListener("mouseover", i), e.removeEventListener("mouseout", l), e.removeEventListener("wheel", g));
54
46
  }
55
47
  function I(e) {
56
48
  d("click", e);
@@ -66,10 +58,10 @@ function Ye(r, m, n, d) {
66
58
  }
67
59
  function E(e) {
68
60
  if (!f.value || !J()) return;
69
- const o = e instanceof TouchEvent ? e.touches[0] : e, { pageX: v, pageY: M } = o, { pageX: w, pageY: _ } = f.value, { defaultYaw: R = 0, defaultPitch: Y = 0 } = f.value, x = Math.PI * 0.15 / 180;
70
- let B = (Number(R) - (v - w) * x) % (2 * Math.PI), b = (Number(Y) + (M - _) * x) % (2 * Math.PI);
71
- b = Math.max(-Math.PI / 2, Math.min(Math.PI / 2, b));
72
- const X = new G({ yaw: B, pitch: b });
61
+ const o = e instanceof TouchEvent ? e.touches[0] : e, { pageX: v, pageY: M } = o, { pageX: w, pageY: _ } = f.value, { defaultYaw: b = 0, defaultPitch: Y = 0 } = f.value, x = Math.PI * 0.15 / 180;
62
+ let B = (Number(b) - (v - w) * x) % (2 * Math.PI), R = (Number(Y) + (M - _) * x) % (2 * Math.PI);
63
+ R = Math.max(-Math.PI / 2, Math.min(Math.PI / 2, R));
64
+ const X = new G({ yaw: B, pitch: R });
73
65
  Q(X);
74
66
  }
75
67
  function p() {
@@ -78,7 +70,7 @@ function Ye(r, m, n, d) {
78
70
  function i() {
79
71
  U(!0);
80
72
  }
81
- function c() {
73
+ function l() {
82
74
  U(!1);
83
75
  }
84
76
  function g(e) {
@@ -116,56 +108,59 @@ function Ye(r, m, n, d) {
116
108
  function A(e) {
117
109
  s.value = { ...s.value, ...e };
118
110
  }
111
+ function me(e) {
112
+ c({ visible: e });
113
+ }
119
114
  function U(e) {
120
- l({ mouseover: e });
115
+ c({ mouseover: e });
121
116
  }
122
117
  function O(e) {
123
- l({ mousedown: e });
124
- }
125
- function me(e) {
126
- l({ minFov: e });
118
+ c({ mousedown: e });
127
119
  }
128
120
  function fe(e) {
129
- l({ maxFov: e });
121
+ c({ minFov: e });
130
122
  }
131
123
  function pe(e) {
124
+ c({ maxFov: e });
125
+ }
126
+ function he(e) {
132
127
  const { currentPoint: o } = m.value;
133
128
  if (o) {
134
- const { minFov: v, maxFov: M } = t.value, { yaw: w = 0, pitch: _ = 0, zoomLevel: R = 0 } = e, Y = new G({ yaw: w, pitch: _ }), x = z.modelPointToCameraPosition(o), B = z.maskerRotateToCameraTarget(Y, x), b = z.zoomLevelToFov(R);
135
- l({ defaultYaw: w, defaultPitch: _, defaultZoomLvl: R }), A({ position: x, target: B, hFov: b, minFov: v, maxFov: M });
129
+ const { minFov: v, maxFov: M } = t.value, { yaw: w = 0, pitch: _ = 0, zoomLevel: b = 0 } = e, Y = new G({ yaw: w, pitch: _ }), x = z.modelPointToCameraPosition(o), B = z.maskerRotateToCameraTarget(Y, x), R = z.zoomLevelToFov(b);
130
+ c({ defaultYaw: w, defaultPitch: _, defaultZoomLvl: b }), A({ position: x, target: B, hFov: R, minFov: v, maxFov: M });
136
131
  }
137
132
  }
138
133
  function Q(e) {
139
134
  const o = s.value?.position;
140
135
  if (!o) return;
141
- const { yaw: v, pitch: M } = e, w = Number(m.value.currentPoint?.yaw || 0) + v, _ = new G({ yaw: Number(w), pitch: Number(M) }), R = z.maskerRotateToCameraTarget(_, o);
142
- l({ defaultYaw: w, defaultPitch: M }), A({ target: R }), d("position-updated", { position: e, target: R });
136
+ const { yaw: v, pitch: M } = e, w = Number(m.value.currentPoint?.yaw || 0) + v, _ = new G({ yaw: Number(w), pitch: Number(M) }), b = z.maskerRotateToCameraTarget(_, o);
137
+ c({ defaultYaw: w, defaultPitch: M }), A({ target: b }), d("position-updated", { position: e, target: b });
143
138
  }
144
139
  function ee(e) {
145
140
  const o = z.zoomLevelToFov(e);
146
- l({ defaultZoomLvl: e }), A({ hFov: o }), d("zoom-updated", { zoomLevel: e, hFov: o });
141
+ c({ defaultZoomLvl: e }), A({ hFov: o }), d("zoom-updated", { zoomLevel: e, hFov: o });
147
142
  }
148
- function he(e) {
143
+ function we(e) {
149
144
  return new te(e);
150
145
  }
151
- function we(e, o) {
152
- const { x: v = 0, y: M = 0, z: w = 0 } = o, { yaw: _, pitch: R } = e, Y = -_, x = R, B = 100, b = 0, X = B * Math.cos(b + Y) + v, ge = B * Math.sin(b + Y) + M, ye = B * Math.tan(x) + w;
153
- return new te({ x: X, y: ge, z: ye });
146
+ function Me(e, o) {
147
+ const { x: v = 0, y: M = 0, z: w = 0 } = o, { yaw: _, pitch: b } = e, Y = -_, x = b, B = 100, R = 0, X = B * Math.cos(R + Y) + v, ye = B * Math.sin(R + Y) + M, Se = B * Math.tan(x) + w;
148
+ return new te({ x: X, y: ye, z: Se });
154
149
  }
155
- function Me(e) {
150
+ function Pe(e) {
156
151
  const { minFov: o = 20, maxFov: v = 120 } = t.value, w = 100 - (Math.max(o, Math.min(v, e)) - o) / (v - o) * 100;
157
152
  return Math.max(0, Math.min(100, Math.round(w)));
158
153
  }
159
- function Pe(e) {
154
+ function ge(e) {
160
155
  const { minFov: o = 20, maxFov: v = 120 } = t.value;
161
156
  let M = v + e / 100 * (o - v);
162
157
  return Math.max(o, Math.min(v, M));
163
158
  }
164
159
  const z = {
165
- modelPointToCameraPosition: he,
166
- maskerRotateToCameraTarget: we,
167
- fovToZoomLevel: Me,
168
- zoomLevelToFov: Pe
160
+ modelPointToCameraPosition: we,
161
+ maskerRotateToCameraTarget: Me,
162
+ fovToZoomLevel: Pe,
163
+ zoomLevelToFov: ge
169
164
  };
170
165
  return {
171
166
  getProps: t,
@@ -174,12 +169,13 @@ function Ye(r, m, n, d) {
174
169
  dataHelper: z,
175
170
  isMouseover: ve,
176
171
  isMousedown: J,
177
- setState: l,
172
+ setState: c,
173
+ setVisible: me,
178
174
  setMousedown: O,
179
175
  setMouseover: U,
180
- setMinFov: me,
181
- setMaxFov: fe,
182
- setMaskerStatus: pe,
176
+ setMinFov: fe,
177
+ setMaxFov: pe,
178
+ setMaskerStatus: he,
183
179
  zoom: ee,
184
180
  rotate: Q,
185
181
  getState: u,
@@ -194,7 +190,7 @@ function Ye(r, m, n, d) {
194
190
  handleUninstallEvents: T
195
191
  };
196
192
  }
197
- const $e = { class: "vsleem-masker" }, Ve = /* @__PURE__ */ ae({
193
+ const Ve = { class: "vsleem-masker" }, Ze = /* @__PURE__ */ ae({
198
194
  __name: "Masker",
199
195
  props: {
200
196
  bimseeProps: {},
@@ -202,10 +198,10 @@ const $e = { class: "vsleem-masker" }, Ve = /* @__PURE__ */ ae({
202
198
  },
203
199
  emits: ["ready", "click", "mousedown", "zoom-updated", "position-updated"],
204
200
  setup(r, { expose: m, emit: n }) {
205
- const d = r, a = n, s = y(), f = F(() => d.bimseeProps), t = F(() => d.bimseeStore), { getProps: h, getBindValue: S, maskerAction: u, handleMaskerEvents: l, handleUninstallEvents: k } = Ye(f, t, s, a);
201
+ const d = r, a = n, s = y(), f = F(() => d.bimseeProps), t = F(() => d.bimseeStore), { getProps: h, getBindValue: S, maskerAction: u, handleMaskerEvents: c, handleUninstallEvents: k } = $e(f, t, s, a);
206
202
  $(() => C(t)?.ready, T, { immediate: !0 }), re(L);
207
203
  function T(E) {
208
- E && (I(), l());
204
+ E && (I(), c());
209
205
  }
210
206
  function I() {
211
207
  a("ready", u?.getCameraStatus());
@@ -213,13 +209,13 @@ const $e = { class: "vsleem-masker" }, Ve = /* @__PURE__ */ ae({
213
209
  function L() {
214
210
  k();
215
211
  }
216
- return m(u), (E, p) => (ie(), se("div", $e, [
217
- Se(ke("div", {
212
+ return m(u), (E, p) => (ie(), se("div", Ve, [
213
+ ke(Te("div", {
218
214
  ref_key: "maskerElRef",
219
215
  ref: s,
220
216
  class: "masker-container"
221
217
  }, null, 512), [
222
- [Te, C(h).visible]
218
+ [Ee, C(h).visible]
223
219
  ]),
224
220
  H(E.$slots, "default", q(K(C(S))), void 0, !0)
225
221
  ]));
@@ -229,21 +225,21 @@ const $e = { class: "vsleem-masker" }, Ve = /* @__PURE__ */ ae({
229
225
  for (const [d, a] of m)
230
226
  n[d] = a;
231
227
  return n;
232
- }, Ze = /* @__PURE__ */ ce(Ve, [["__scopeId", "data-v-605902cc"]]);
228
+ }, Ae = /* @__PURE__ */ ce(Ze, [["__scopeId", "data-v-605902cc"]]);
233
229
  var V = /* @__PURE__ */ ((r) => (r[r.StoreMissParams = 11e3] = "StoreMissParams", r[r.StoreNoCSTree = 11001] = "StoreNoCSTree", r[r.StoreSelectNoBIMModel = 11002] = "StoreSelectNoBIMModel", r))(V || {});
234
- function Ae(r, { setReferPoint: m }) {
230
+ function Ue(r, { setReferPoint: m }) {
235
231
  const n = y(), d = y(), a = y(!1), s = y(!1), f = y(), t = y(), h = F(() => n.value?.findCsById(f.value)), S = F(() => h.value?.findParentSpace());
236
232
  async function u(i) {
237
- const { projectId: c, modelCsId: g } = i || {};
233
+ const { projectId: l, modelCsId: g } = i || {};
238
234
  try {
239
- if (!c)
235
+ if (!l)
240
236
  throw new j(V.StoreMissParams, "缺少必要的查询参数");
241
- if (a.value = !0, c != n.value?.projectId) {
242
- const N = await ze.getCoordinateTree(c), D = await r.value.handleResponseFn?.(N) || N;
237
+ if (a.value = !0, l != n.value?.projectId) {
238
+ const N = await xe.getCoordinateTree(l), D = await r.value.handleResponseFn?.(N) || N;
243
239
  if (!D)
244
240
  throw new j(
245
241
  V.StoreNoCSTree,
246
- `未查询到项目ID为 ${c} 的坐标系树`
242
+ `未查询到项目ID为 ${l} 的坐标系树`
247
243
  );
248
244
  n.value = D;
249
245
  }
@@ -255,32 +251,32 @@ function Ae(r, { setReferPoint: m }) {
255
251
  a.value = !1;
256
252
  }
257
253
  }
258
- function l(i = !1) {
254
+ function c(i = !1) {
259
255
  s.value = i;
260
256
  }
261
257
  function k(i) {
262
- const { modelCsId: c } = i;
263
- c && T({ id: c });
258
+ const { modelCsId: l } = i;
259
+ l && T({ id: l });
264
260
  }
265
261
  function T(i) {
266
- const { id: c } = i;
267
- if (n.value?.findCsById(c)?.modelType === be.BIMModel)
268
- f.value = c;
262
+ const { id: l } = i;
263
+ if (n.value?.findCsById(l)?.modelType === ze.BIMModel)
264
+ f.value = l;
269
265
  else
270
- throw new j(V.StoreSelectNoBIMModel, `未找到ID为 ${c} 的BIM模型坐标系`);
266
+ throw new j(V.StoreSelectNoBIMModel, `未找到ID为 ${l} 的BIM模型坐标系`);
271
267
  }
272
268
  function I(i) {
273
269
  t.value = i;
274
270
  }
275
271
  function L(i) {
276
272
  if (!h.value || !i) return;
277
- const c = n.value?.findCsById(i.coordinate?.id);
278
- if (!c) return;
279
- const g = c?.getDestRelativeMap(h.value);
273
+ const l = n.value?.findCsById(i.coordinate?.id);
274
+ if (!l) return;
275
+ const g = l?.getDestRelativeMap(h.value);
280
276
  if (!g) return;
281
277
  const P = new Re(i.point).projection(
282
278
  g,
283
- c,
279
+ l,
284
280
  h.value
285
281
  );
286
282
  if (P)
@@ -315,35 +311,35 @@ function Ae(r, { setReferPoint: m }) {
315
311
  return {
316
312
  storeRef: p,
317
313
  getStore: E,
318
- setReady: l
314
+ setReady: c
319
315
  };
320
316
  }
321
- const { cloneDeep: ne, deepMergeProps: Ue, getDiffProps: Oe } = ue;
322
- function Xe(r, m, n) {
323
- const d = y(ne(Be)), a = F(() => d.value);
317
+ const { cloneDeep: ne, deepMergeProps: Oe, getDiffProps: Xe } = ue;
318
+ function Ge(r, m, n) {
319
+ const d = y(ne(Ne)), a = F(() => d.value);
324
320
  $(() => ne(r), u, { immediate: !0, deep: !0 }), $(
325
321
  () => a.value.searchInfo,
326
322
  () => I(s.value.ready),
327
323
  { deep: !0 }
328
324
  );
329
- const { storeRef: s, getStore: f, setReady: t } = Ae(a, { setReferPoint: E });
330
- Ee(h), re(S);
325
+ const { storeRef: s, getStore: f, setReady: t } = Ue(a, { setReferPoint: E });
326
+ Ce(h), re(S);
331
327
  async function h() {
332
328
  const { appSetting: p, immediate: i } = C(a);
333
- p && xe.setRequestGlobalConfig(p), i && (await I(!0), setTimeout(T, 0));
329
+ p && Be.setRequestGlobalConfig(p), i && (await I(!0), setTimeout(T, 0));
334
330
  }
335
331
  function S() {
336
332
  n?.("destroy");
337
333
  }
338
334
  function u(p, i) {
339
- const c = Oe(p, i);
340
- k(c);
335
+ const l = Xe(p, i);
336
+ k(l);
341
337
  }
342
- function l() {
338
+ function c() {
343
339
  return C(a);
344
340
  }
345
341
  function k(p) {
346
- p && Ue(d.value, p);
342
+ p && Oe(d.value, p);
347
343
  }
348
344
  function T() {
349
345
  t(!0), n?.("ready");
@@ -356,11 +352,11 @@ function Xe(r, m, n) {
356
352
  return m.value;
357
353
  }
358
354
  async function E(p, i) {
359
- const c = f();
360
- if (c) {
361
- const g = c.normalizeToModelPoint(p);
355
+ const l = f();
356
+ if (l) {
357
+ const g = l.normalizeToModelPoint(p);
362
358
  if (!g) return;
363
- c.selectPoint(g.point);
359
+ l.selectPoint(g.point);
364
360
  const { yaw: P = 0, pitch: N = 0, zoomLevel: D = 0 } = i, Z = g.point?.yaw + P;
365
361
  L()?.setMaskerStatus({ yaw: Z, pitch: N, zoomLevel: D });
366
362
  }
@@ -369,19 +365,19 @@ function Xe(r, m, n) {
369
365
  storeRef: s,
370
366
  getStore: f,
371
367
  getMasker: L,
372
- getState: l,
368
+ getState: c,
373
369
  setState: k
374
370
  };
375
371
  }
376
- function Ge(r, m, n) {
372
+ function je(r, m, n) {
377
373
  const d = F(() => r.value.ready && !!r.value.currentModel), a = F(() => {
378
- const { coordinateTree: t, mappedCoordinateTree: h, currentSpace: S, currentModel: u, currentPoint: l } = r.value || {};
374
+ const { coordinateTree: t, mappedCoordinateTree: h, currentSpace: S, currentModel: u, currentPoint: c } = r.value || {};
379
375
  return {
380
376
  coordinateTree: t,
381
377
  mappedCoordinateTree: h,
382
378
  currentSpace: S,
383
379
  currentModel: u,
384
- currentPoint: l
380
+ currentPoint: c
385
381
  };
386
382
  });
387
383
  $(
@@ -413,7 +409,7 @@ function Ge(r, m, n) {
413
409
  getBindValue: a
414
410
  };
415
411
  }
416
- function je(r, m) {
412
+ function He(r, m) {
417
413
  const n = y({ yaw: 0, pitch: 0 });
418
414
  function d(u) {
419
415
  m("masker-ready", u);
@@ -431,8 +427,8 @@ function je(r, m) {
431
427
  m("masker-position-updated", u, h(u));
432
428
  }
433
429
  function h(u) {
434
- const { yaw: l, pitch: k } = u.position, { yaw: T, pitch: I } = C(n);
435
- return n.value = { yaw: l, pitch: k }, { yaw: l - T, pitch: k - I };
430
+ const { yaw: c, pitch: k } = u.position, { yaw: T, pitch: I } = C(n);
431
+ return n.value = { yaw: c, pitch: k }, { yaw: c - T, pitch: k - I };
436
432
  }
437
433
  return { maskerEvents: {
438
434
  ready: d,
@@ -442,7 +438,7 @@ function je(r, m) {
442
438
  positionUpdated: t
443
439
  } };
444
440
  }
445
- const He = { class: "vsleem-bimsee" }, qe = /* @__PURE__ */ ae({
441
+ const qe = { class: "vsleem-bimsee" }, Ke = /* @__PURE__ */ ae({
446
442
  name: "Bimsee",
447
443
  __name: "Bimsee",
448
444
  props: {
@@ -468,26 +464,26 @@ const He = { class: "vsleem-bimsee" }, qe = /* @__PURE__ */ ae({
468
464
  "masker-position-updated"
469
465
  ],
470
466
  setup(r, { expose: m, emit: n }) {
471
- const d = r, a = n, s = y(), f = Xe(d, s, a), { storeRef: t, getMasker: h } = f, { getBindValue: S } = Ge(t, h, a), { maskerEvents: u } = je(h, a);
472
- return m(f), (l, k) => (ie(), se("div", He, [
473
- Ce(Ze, Le({
467
+ const d = r, a = n, s = y(), f = Ge(d, s, a), { storeRef: t, getMasker: h } = f, { getBindValue: S } = je(t, h, a), { maskerEvents: u } = He(h, a);
468
+ return m(f), (c, k) => (ie(), se("div", qe, [
469
+ Le(Ae, _e({
474
470
  ref_key: "maskerElRef",
475
471
  ref: s,
476
472
  bimseeProps: d,
477
473
  bimseeStore: C(t)
478
- }, _e(C(u))), {
479
- default: Ie((T) => [
480
- H(l.$slots, "masker", q(K(T)), void 0, !0)
474
+ }, Ie(C(u))), {
475
+ default: Fe((T) => [
476
+ H(c.$slots, "masker", q(K(T)), void 0, !0)
481
477
  ]),
482
478
  _: 3
483
479
  }, 16, ["bimseeStore"]),
484
- H(l.$slots, "default", q(K(C(S))), void 0, !0)
480
+ H(c.$slots, "default", q(K(C(S))), void 0, !0)
485
481
  ]));
486
482
  }
487
- }), Qe = /* @__PURE__ */ ce(qe, [["__scopeId", "data-v-348a21e7"]]);
483
+ }), et = /* @__PURE__ */ ce(Ke, [["__scopeId", "data-v-348a21e7"]]);
488
484
  export {
489
- Be as BIMSEE_CONFIG,
490
- Qe as Bimsee,
491
- Qe as BimseePlugin,
485
+ Ne as BIMSEE_CONFIG,
486
+ et as Bimsee,
487
+ et as BimseePlugin,
492
488
  W as MASKER_CONFIG
493
489
  };
package/dist/index.umd.js CHANGED
@@ -1 +1 @@
1
- (function(_,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("@vsleem-realsee-viewer/shared")):typeof define=="function"&&define.amd?define(["exports","vue","@vsleem-realsee-viewer/shared"],e):(_=typeof globalThis<"u"?globalThis:_||self,e(_.BimseePlugin={},_.Vue,_.VSLeemShared))})(this,(function(_,e,g){"use strict";const V={visible:!0,defaultYaw:0,defaultPitch:0,defaultZoomLvl:30,minFov:20,maxFov:120},j={appSetting:g.APP_SETTING,masker:V,immediate:!0},{cloneDeep:X,deepMergeProps:ee,getDiffProps:te}=g.utils;function oe(s,p,a,f){const r=e.ref(X(V)),i=e.ref(),v=e.ref(),o=e.computed(()=>r.value),w=e.computed(()=>{const{coordinateTree:t,mappedCoordinateTree:n,currentSpace:m,currentModel:P,currentPoint:M}=p.value||{};return{coordinateTree:t,mappedCoordinateTree:n,currentSpace:m,currentModel:P,currentPoint:M,cameraStatus:i.value,state:o.value}});e.watch(()=>X(s.value.masker),k,{immediate:!0,deep:!0});function k(t,n){const m=te(t,n);d(m)}function u(){return e.unref(o)}function d(t){t&&ee(r.value,t)}function E(){const t=e.unref(a);t&&(t.addEventListener("mousedown",L),t.addEventListener("touchstart",L),t.addEventListener("click",F),window.addEventListener("mousemove",C),window.addEventListener("touchmove",C),window.addEventListener("mouseup",h),window.addEventListener("touchend",h),t.addEventListener("mouseover",c),t.addEventListener("mouseout",l),t.addEventListener("wheel",S))}function T(){const t=e.unref(a);t&&(t.removeEventListener("mousedown",L),t.removeEventListener("touchstart",L),window.removeEventListener("mousemove",C),window.removeEventListener("touchmove",C),window.removeEventListener("mouseup",h),window.removeEventListener("touchend",h),t.removeEventListener("mouseover",c),t.removeEventListener("mouseout",l),t.removeEventListener("wheel",S))}function F(t){f("click",t)}function L(t){const n=t instanceof TouchEvent?t.touches[0]:t,{defaultYaw:m=0,defaultPitch:P=0}=o.value,M=Number(m)-Number(p.value.currentPoint?.yaw||0);v.value={pageX:n.pageX,pageY:n.pageY,defaultYaw:M,defaultPitch:P},Z(!0),f("mousedown",t)}function C(t){if(!v.value||!W())return;const n=t instanceof TouchEvent?t.touches[0]:t,{pageX:m,pageY:P}=n,{pageX:M,pageY:I}=v.value,{defaultYaw:B=0,defaultPitch:Y=0}=v.value,z=Math.PI*.15/180;let N=(Number(B)-(m-M)*z)%(2*Math.PI),R=(Number(Y)+(P-I)*z)%(2*Math.PI);R=Math.max(-Math.PI/2,Math.min(Math.PI/2,R));const G=new g.Position({yaw:N,pitch:R});J(G)}function h(){Z(!1),v.value=void 0}function c(){U(!0)}function l(){U(!1)}function S(t){t.preventDefault(),t.stopPropagation();const n=Math.sign(t.deltaY)*5;if(n===0)return;const{minFov:m=0,maxFov:P=0}=o.value,{hFov:M=0}=i.value||{},I=Math.min(Math.max(M+n,m),P);I!==M&&Q(b.fovToZoomLevel(I))}function y(){const{defaultYaw:t,defaultPitch:n}=o.value;return{yaw:t,pitch:n}}function x(){return o.value.defaultZoomLvl}function D(){return i.value?.position}function A(){return i.value?.hFov}function me(){return i.value?.target}function pe(){return i.value}function ve(){return o.value?.mouseover??!1}function W(){return o.value?.mousedown??!1}function O(t){i.value={...i.value,...t}}function U(t){d({mouseover:t})}function Z(t){d({mousedown:t})}function he(t){d({minFov:t})}function we(t){d({maxFov:t})}function Me(t){const{currentPoint:n}=p.value;if(n){const{minFov:m,maxFov:P}=o.value,{yaw:M=0,pitch:I=0,zoomLevel:B=0}=t,Y=new g.Position({yaw:M,pitch:I}),z=b.modelPointToCameraPosition(n),N=b.maskerRotateToCameraTarget(Y,z),R=b.zoomLevelToFov(B);d({defaultYaw:M,defaultPitch:I,defaultZoomLvl:B}),O({position:z,target:N,hFov:R,minFov:m,maxFov:P})}}function J(t){const n=i.value?.position;if(!n)return;const{yaw:m,pitch:P}=t,M=Number(p.value.currentPoint?.yaw||0)+m,I=new g.Position({yaw:Number(M),pitch:Number(P)}),B=b.maskerRotateToCameraTarget(I,n);d({defaultYaw:M,defaultPitch:P}),O({target:B}),f("position-updated",{position:t,target:B})}function Q(t){const n=b.zoomLevelToFov(t);d({defaultZoomLvl:t}),O({hFov:n}),f("zoom-updated",{zoomLevel:t,hFov:n})}function Pe(t){return new g.Vector3(t)}function ge(t,n){const{x:m=0,y:P=0,z:M=0}=n,{yaw:I,pitch:B}=t,Y=-I,z=B,N=100,R=0,G=N*Math.cos(R+Y)+m,ke=N*Math.sin(R+Y)+P,Ee=N*Math.tan(z)+M;return new g.Vector3({x:G,y:ke,z:Ee})}function ye(t){const{minFov:n=20,maxFov:m=120}=o.value,M=100-(Math.max(n,Math.min(m,t))-n)/(m-n)*100;return Math.max(0,Math.min(100,Math.round(M)))}function Se(t){const{minFov:n=20,maxFov:m=120}=o.value;let P=m+t/100*(n-m);return Math.max(n,Math.min(m,P))}const b={modelPointToCameraPosition:Pe,maskerRotateToCameraTarget:ge,fovToZoomLevel:ye,zoomLevelToFov:Se};return{getProps:o,getBindValue:w,maskerAction:{dataHelper:b,isMouseover:ve,isMousedown:W,setState:d,setMousedown:Z,setMouseover:U,setMinFov:he,setMaxFov:we,setMaskerStatus:Me,zoom:Q,rotate:J,getState:u,getPosition:y,getZoomLevel:x,getCameraPosition:D,getCameraTarget:me,getCameraHFov:A,getCameraStatus:pe},handleMaskerEvents:E,handleUninstallEvents:T}}const ne={class:"vsleem-masker"},ae=e.defineComponent({__name:"Masker",props:{bimseeProps:{},bimseeStore:{}},emits:["ready","click","mousedown","zoom-updated","position-updated"],setup(s,{expose:p,emit:a}){const f=s,r=a,i=e.ref(),v=e.computed(()=>f.bimseeProps),o=e.computed(()=>f.bimseeStore),{getProps:w,getBindValue:k,maskerAction:u,handleMaskerEvents:d,handleUninstallEvents:E}=oe(v,o,i,r);e.watch(()=>e.unref(o)?.ready,T,{immediate:!0}),e.onBeforeUnmount(L);function T(C){C&&(F(),d())}function F(){r("ready",u?.getCameraStatus())}function L(){E()}return p(u),(C,h)=>(e.openBlock(),e.createElementBlock("div",ne,[e.withDirectives(e.createElementVNode("div",{ref_key:"maskerElRef",ref:i,class:"masker-container"},null,512),[[e.vShow,e.unref(w).visible]]),e.renderSlot(C.$slots,"default",e.normalizeProps(e.guardReactiveProps(e.unref(k))),void 0,!0)]))}}),q=(s,p)=>{const a=s.__vccOpts||s;for(const[f,r]of p)a[f]=r;return a},re=q(ae,[["__scopeId","data-v-605902cc"]]);var $=(s=>(s[s.StoreMissParams=11e3]="StoreMissParams",s[s.StoreNoCSTree=11001]="StoreNoCSTree",s[s.StoreSelectNoBIMModel=11002]="StoreSelectNoBIMModel",s))($||{});function se(s,{setReferPoint:p}){const a=e.ref(),f=e.ref(),r=e.ref(!1),i=e.ref(!1),v=e.ref(),o=e.ref(),w=e.computed(()=>a.value?.findCsById(v.value)),k=e.computed(()=>w.value?.findParentSpace());async function u(c){const{projectId:l,modelCsId:S}=c||{};try{if(!l)throw new g.AppError($.StoreMissParams,"缺少必要的查询参数");if(r.value=!0,l!=a.value?.projectId){const x=await g.DataSource.getCoordinateTree(l),D=await s.value.handleResponseFn?.(x)||x;if(!D)throw new g.AppError($.StoreNoCSTree,`未查询到项目ID为 ${l} 的坐标系树`);a.value=D}const y=a.value?.findCsById(S);f.value=y?.getMappedCsTree(),E({modelCsId:S}),s.value.fetchSuccess?.(a.value)}catch(y){console.error(y),s.value.fetchError?.(y)}finally{r.value=!1}}function d(c=!1){i.value=c}function E(c){const{modelCsId:l}=c;l&&T({id:l})}function T(c){const{id:l}=c;if(a.value?.findCsById(l)?.modelType===g.CoordinateModelType.BIMModel)v.value=l;else throw new g.AppError($.StoreSelectNoBIMModel,`未找到ID为 ${l} 的BIM模型坐标系`)}function F(c){o.value=c}function L(c){if(!w.value||!c)return;const l=a.value?.findCsById(c.coordinate?.id);if(!l)return;const S=l?.getDestRelativeMap(w.value);if(!S)return;const y=new g.Point(c.point).projection(S,l,w.value);if(y)return y.y=-y.y,{...c,coordinate:w.value,point:y,position:y}}function C(){return h.value}const h=e.computed(()=>({ready:i.value,coordinateTree:a.value,mappedCoordinateTree:f.value,currentPoint:o.value,currentSpace:k.value,currentModel:w.value,reload:u,selectModel:T,selectPoint:F,setReferPoint:p,normalizeToModelPoint:L}));return{storeRef:h,getStore:C,setReady:d}}const{cloneDeep:H,deepMergeProps:ie,getDiffProps:ce}=g.utils;function ue(s,p,a){const f=e.ref(H(j)),r=e.computed(()=>f.value);e.watch(()=>H(s),u,{immediate:!0,deep:!0}),e.watch(()=>r.value.searchInfo,()=>F(i.value.ready),{deep:!0});const{storeRef:i,getStore:v,setReady:o}=se(r,{setReferPoint:C});e.onMounted(w),e.onBeforeUnmount(k);async function w(){const{appSetting:h,immediate:c}=e.unref(r);h&&g.http.setRequestGlobalConfig(h),c&&(await F(!0),setTimeout(T,0))}function k(){a?.("destroy")}function u(h,c){const l=ce(h,c);E(l)}function d(){return e.unref(r)}function E(h){h&&ie(f.value,h)}function T(){o(!0),a?.("ready")}async function F(h){const{searchInfo:c}=r.value;h&&c&&(await i.value?.reload(c),a?.("reload"))}function L(){return p.value}async function C(h,c){const l=v();if(l){const S=l.normalizeToModelPoint(h);if(!S)return;l.selectPoint(S.point);const{yaw:y=0,pitch:x=0,zoomLevel:D=0}=c,A=S.point?.yaw+y;L()?.setMaskerStatus({yaw:A,pitch:x,zoomLevel:D})}}return{storeRef:i,getStore:v,getMasker:L,getState:d,setState:E}}function le(s,p,a){const f=e.computed(()=>s.value.ready&&!!s.value.currentModel),r=e.computed(()=>{const{coordinateTree:o,mappedCoordinateTree:w,currentSpace:k,currentModel:u,currentPoint:d}=s.value||{};return{coordinateTree:o,mappedCoordinateTree:w,currentSpace:k,currentModel:u,currentPoint:d}});e.watch(()=>r.value?.currentModel?.id,o=>{o&&i(r.value?.currentModel)},{immediate:!0}),e.watch(()=>r.value?.currentPoint,o=>{o&&v(r.value?.currentPoint)},{immediate:!0,deep:!0});function i(o){a("change-model",o)}function v(o){a("change-point",o)}return{getShow:f,getBindValue:r}}function de(s,p){const a=e.ref({yaw:0,pitch:0});function f(u){p("masker-ready",u)}function r(u){p("masker-click",u)}function i(u){p("masker-mousedown",u)}function v(u){p("masker-zoom-updated",u)}function o(u){p("masker-position-updated",u,w(u))}function w(u){const{yaw:d,pitch:E}=u.position,{yaw:T,pitch:F}=e.unref(a);return a.value={yaw:d,pitch:E},{yaw:d-T,pitch:E-F}}return{maskerEvents:{ready:f,click:r,mousedown:i,zoomUpdated:v,positionUpdated:o}}}const fe={class:"vsleem-bimsee"},K=q(e.defineComponent({name:"Bimsee",__name:"Bimsee",props:{appSetting:{},searchInfo:{},bimseeSetting:{},masker:{default:()=>V},immediate:{type:Boolean,default:!0},handleResponseFn:{},fetchSuccess:{},fetchError:{}},emits:["ready","reload","destroy","change-model","change-point","masker-ready","masker-click","masker-mousedown","masker-zoom-updated","masker-position-updated"],setup(s,{expose:p,emit:a}){const f=s,r=a,i=e.ref(),v=ue(f,i,r),{storeRef:o,getMasker:w}=v,{getBindValue:k}=le(o,w,r),{maskerEvents:u}=de(w,r);return p(v),(d,E)=>(e.openBlock(),e.createElementBlock("div",fe,[e.createVNode(re,e.mergeProps({ref_key:"maskerElRef",ref:i,bimseeProps:f,bimseeStore:e.unref(o)},e.toHandlers(e.unref(u))),{default:e.withCtx(T=>[e.renderSlot(d.$slots,"masker",e.normalizeProps(e.guardReactiveProps(T)),void 0,!0)]),_:3},16,["bimseeStore"]),e.renderSlot(d.$slots,"default",e.normalizeProps(e.guardReactiveProps(e.unref(k))),void 0,!0)]))}}),[["__scopeId","data-v-348a21e7"]]);_.BIMSEE_CONFIG=j,_.Bimsee=K,_.BimseePlugin=K,_.MASKER_CONFIG=V,Object.defineProperty(_,Symbol.toStringTag,{value:"Module"})}));
1
+ (function(_,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("@vsleem-realsee-viewer/shared")):typeof define=="function"&&define.amd?define(["exports","vue","@vsleem-realsee-viewer/shared"],e):(_=typeof globalThis<"u"?globalThis:_||self,e(_.BimseePlugin={},_.Vue,_.VSLeemShared))})(this,(function(_,e,g){"use strict";const V={visible:!0,defaultYaw:0,defaultPitch:0,defaultZoomLvl:30,minFov:20,maxFov:120},j={appSetting:g.APP_SETTING,masker:V,immediate:!0},{cloneDeep:X,deepMergeProps:ee,getDiffProps:te}=g.utils;function oe(s,p,a,f){const r=e.ref(X(V)),i=e.ref(),v=e.ref(),o=e.computed(()=>r.value),w=e.computed(()=>{const{coordinateTree:t,mappedCoordinateTree:n,currentSpace:m,currentModel:P,currentPoint:M}=p.value||{};return{coordinateTree:t,mappedCoordinateTree:n,currentSpace:m,currentModel:P,currentPoint:M,cameraStatus:i.value,state:o.value}});e.watch(()=>X(s.value.masker),k,{immediate:!0,deep:!0});function k(t,n){const m=te(t,n);l(m)}function u(){return e.unref(o)}function l(t){t&&ee(r.value,t)}function E(){const t=e.unref(a);t&&(t.addEventListener("mousedown",L),t.addEventListener("touchstart",L),t.addEventListener("click",F),window.addEventListener("mousemove",C),window.addEventListener("touchmove",C),window.addEventListener("mouseup",h),window.addEventListener("touchend",h),t.addEventListener("mouseover",c),t.addEventListener("mouseout",d),t.addEventListener("wheel",S))}function T(){const t=e.unref(a);t&&(t.removeEventListener("mousedown",L),t.removeEventListener("touchstart",L),window.removeEventListener("mousemove",C),window.removeEventListener("touchmove",C),window.removeEventListener("mouseup",h),window.removeEventListener("touchend",h),t.removeEventListener("mouseover",c),t.removeEventListener("mouseout",d),t.removeEventListener("wheel",S))}function F(t){f("click",t)}function L(t){const n=t instanceof TouchEvent?t.touches[0]:t,{defaultYaw:m=0,defaultPitch:P=0}=o.value,M=Number(m)-Number(p.value.currentPoint?.yaw||0);v.value={pageX:n.pageX,pageY:n.pageY,defaultYaw:M,defaultPitch:P},Z(!0),f("mousedown",t)}function C(t){if(!v.value||!W())return;const n=t instanceof TouchEvent?t.touches[0]:t,{pageX:m,pageY:P}=n,{pageX:M,pageY:I}=v.value,{defaultYaw:B=0,defaultPitch:Y=0}=v.value,z=Math.PI*.15/180;let N=(Number(B)-(m-M)*z)%(2*Math.PI),R=(Number(Y)+(P-I)*z)%(2*Math.PI);R=Math.max(-Math.PI/2,Math.min(Math.PI/2,R));const G=new g.Position({yaw:N,pitch:R});J(G)}function h(){Z(!1),v.value=void 0}function c(){U(!0)}function d(){U(!1)}function S(t){t.preventDefault(),t.stopPropagation();const n=Math.sign(t.deltaY)*5;if(n===0)return;const{minFov:m=0,maxFov:P=0}=o.value,{hFov:M=0}=i.value||{},I=Math.min(Math.max(M+n,m),P);I!==M&&Q(b.fovToZoomLevel(I))}function y(){const{defaultYaw:t,defaultPitch:n}=o.value;return{yaw:t,pitch:n}}function x(){return o.value.defaultZoomLvl}function D(){return i.value?.position}function A(){return i.value?.hFov}function me(){return i.value?.target}function pe(){return i.value}function ve(){return o.value?.mouseover??!1}function W(){return o.value?.mousedown??!1}function O(t){i.value={...i.value,...t}}function he(t){l({visible:t})}function U(t){l({mouseover:t})}function Z(t){l({mousedown:t})}function we(t){l({minFov:t})}function Me(t){l({maxFov:t})}function Pe(t){const{currentPoint:n}=p.value;if(n){const{minFov:m,maxFov:P}=o.value,{yaw:M=0,pitch:I=0,zoomLevel:B=0}=t,Y=new g.Position({yaw:M,pitch:I}),z=b.modelPointToCameraPosition(n),N=b.maskerRotateToCameraTarget(Y,z),R=b.zoomLevelToFov(B);l({defaultYaw:M,defaultPitch:I,defaultZoomLvl:B}),O({position:z,target:N,hFov:R,minFov:m,maxFov:P})}}function J(t){const n=i.value?.position;if(!n)return;const{yaw:m,pitch:P}=t,M=Number(p.value.currentPoint?.yaw||0)+m,I=new g.Position({yaw:Number(M),pitch:Number(P)}),B=b.maskerRotateToCameraTarget(I,n);l({defaultYaw:M,defaultPitch:P}),O({target:B}),f("position-updated",{position:t,target:B})}function Q(t){const n=b.zoomLevelToFov(t);l({defaultZoomLvl:t}),O({hFov:n}),f("zoom-updated",{zoomLevel:t,hFov:n})}function ge(t){return new g.Vector3(t)}function ye(t,n){const{x:m=0,y:P=0,z:M=0}=n,{yaw:I,pitch:B}=t,Y=-I,z=B,N=100,R=0,G=N*Math.cos(R+Y)+m,Ee=N*Math.sin(R+Y)+P,Te=N*Math.tan(z)+M;return new g.Vector3({x:G,y:Ee,z:Te})}function Se(t){const{minFov:n=20,maxFov:m=120}=o.value,M=100-(Math.max(n,Math.min(m,t))-n)/(m-n)*100;return Math.max(0,Math.min(100,Math.round(M)))}function ke(t){const{minFov:n=20,maxFov:m=120}=o.value;let P=m+t/100*(n-m);return Math.max(n,Math.min(m,P))}const b={modelPointToCameraPosition:ge,maskerRotateToCameraTarget:ye,fovToZoomLevel:Se,zoomLevelToFov:ke};return{getProps:o,getBindValue:w,maskerAction:{dataHelper:b,isMouseover:ve,isMousedown:W,setState:l,setVisible:he,setMousedown:Z,setMouseover:U,setMinFov:we,setMaxFov:Me,setMaskerStatus:Pe,zoom:Q,rotate:J,getState:u,getPosition:y,getZoomLevel:x,getCameraPosition:D,getCameraTarget:me,getCameraHFov:A,getCameraStatus:pe},handleMaskerEvents:E,handleUninstallEvents:T}}const ne={class:"vsleem-masker"},ae=e.defineComponent({__name:"Masker",props:{bimseeProps:{},bimseeStore:{}},emits:["ready","click","mousedown","zoom-updated","position-updated"],setup(s,{expose:p,emit:a}){const f=s,r=a,i=e.ref(),v=e.computed(()=>f.bimseeProps),o=e.computed(()=>f.bimseeStore),{getProps:w,getBindValue:k,maskerAction:u,handleMaskerEvents:l,handleUninstallEvents:E}=oe(v,o,i,r);e.watch(()=>e.unref(o)?.ready,T,{immediate:!0}),e.onBeforeUnmount(L);function T(C){C&&(F(),l())}function F(){r("ready",u?.getCameraStatus())}function L(){E()}return p(u),(C,h)=>(e.openBlock(),e.createElementBlock("div",ne,[e.withDirectives(e.createElementVNode("div",{ref_key:"maskerElRef",ref:i,class:"masker-container"},null,512),[[e.vShow,e.unref(w).visible]]),e.renderSlot(C.$slots,"default",e.normalizeProps(e.guardReactiveProps(e.unref(k))),void 0,!0)]))}}),q=(s,p)=>{const a=s.__vccOpts||s;for(const[f,r]of p)a[f]=r;return a},re=q(ae,[["__scopeId","data-v-605902cc"]]);var $=(s=>(s[s.StoreMissParams=11e3]="StoreMissParams",s[s.StoreNoCSTree=11001]="StoreNoCSTree",s[s.StoreSelectNoBIMModel=11002]="StoreSelectNoBIMModel",s))($||{});function se(s,{setReferPoint:p}){const a=e.ref(),f=e.ref(),r=e.ref(!1),i=e.ref(!1),v=e.ref(),o=e.ref(),w=e.computed(()=>a.value?.findCsById(v.value)),k=e.computed(()=>w.value?.findParentSpace());async function u(c){const{projectId:d,modelCsId:S}=c||{};try{if(!d)throw new g.AppError($.StoreMissParams,"缺少必要的查询参数");if(r.value=!0,d!=a.value?.projectId){const x=await g.DataSource.getCoordinateTree(d),D=await s.value.handleResponseFn?.(x)||x;if(!D)throw new g.AppError($.StoreNoCSTree,`未查询到项目ID为 ${d} 的坐标系树`);a.value=D}const y=a.value?.findCsById(S);f.value=y?.getMappedCsTree(),E({modelCsId:S}),s.value.fetchSuccess?.(a.value)}catch(y){console.error(y),s.value.fetchError?.(y)}finally{r.value=!1}}function l(c=!1){i.value=c}function E(c){const{modelCsId:d}=c;d&&T({id:d})}function T(c){const{id:d}=c;if(a.value?.findCsById(d)?.modelType===g.CoordinateModelType.BIMModel)v.value=d;else throw new g.AppError($.StoreSelectNoBIMModel,`未找到ID为 ${d} 的BIM模型坐标系`)}function F(c){o.value=c}function L(c){if(!w.value||!c)return;const d=a.value?.findCsById(c.coordinate?.id);if(!d)return;const S=d?.getDestRelativeMap(w.value);if(!S)return;const y=new g.Point(c.point).projection(S,d,w.value);if(y)return y.y=-y.y,{...c,coordinate:w.value,point:y,position:y}}function C(){return h.value}const h=e.computed(()=>({ready:i.value,coordinateTree:a.value,mappedCoordinateTree:f.value,currentPoint:o.value,currentSpace:k.value,currentModel:w.value,reload:u,selectModel:T,selectPoint:F,setReferPoint:p,normalizeToModelPoint:L}));return{storeRef:h,getStore:C,setReady:l}}const{cloneDeep:H,deepMergeProps:ie,getDiffProps:ce}=g.utils;function ue(s,p,a){const f=e.ref(H(j)),r=e.computed(()=>f.value);e.watch(()=>H(s),u,{immediate:!0,deep:!0}),e.watch(()=>r.value.searchInfo,()=>F(i.value.ready),{deep:!0});const{storeRef:i,getStore:v,setReady:o}=se(r,{setReferPoint:C});e.onMounted(w),e.onBeforeUnmount(k);async function w(){const{appSetting:h,immediate:c}=e.unref(r);h&&g.http.setRequestGlobalConfig(h),c&&(await F(!0),setTimeout(T,0))}function k(){a?.("destroy")}function u(h,c){const d=ce(h,c);E(d)}function l(){return e.unref(r)}function E(h){h&&ie(f.value,h)}function T(){o(!0),a?.("ready")}async function F(h){const{searchInfo:c}=r.value;h&&c&&(await i.value?.reload(c),a?.("reload"))}function L(){return p.value}async function C(h,c){const d=v();if(d){const S=d.normalizeToModelPoint(h);if(!S)return;d.selectPoint(S.point);const{yaw:y=0,pitch:x=0,zoomLevel:D=0}=c,A=S.point?.yaw+y;L()?.setMaskerStatus({yaw:A,pitch:x,zoomLevel:D})}}return{storeRef:i,getStore:v,getMasker:L,getState:l,setState:E}}function le(s,p,a){const f=e.computed(()=>s.value.ready&&!!s.value.currentModel),r=e.computed(()=>{const{coordinateTree:o,mappedCoordinateTree:w,currentSpace:k,currentModel:u,currentPoint:l}=s.value||{};return{coordinateTree:o,mappedCoordinateTree:w,currentSpace:k,currentModel:u,currentPoint:l}});e.watch(()=>r.value?.currentModel?.id,o=>{o&&i(r.value?.currentModel)},{immediate:!0}),e.watch(()=>r.value?.currentPoint,o=>{o&&v(r.value?.currentPoint)},{immediate:!0,deep:!0});function i(o){a("change-model",o)}function v(o){a("change-point",o)}return{getShow:f,getBindValue:r}}function de(s,p){const a=e.ref({yaw:0,pitch:0});function f(u){p("masker-ready",u)}function r(u){p("masker-click",u)}function i(u){p("masker-mousedown",u)}function v(u){p("masker-zoom-updated",u)}function o(u){p("masker-position-updated",u,w(u))}function w(u){const{yaw:l,pitch:E}=u.position,{yaw:T,pitch:F}=e.unref(a);return a.value={yaw:l,pitch:E},{yaw:l-T,pitch:E-F}}return{maskerEvents:{ready:f,click:r,mousedown:i,zoomUpdated:v,positionUpdated:o}}}const fe={class:"vsleem-bimsee"},K=q(e.defineComponent({name:"Bimsee",__name:"Bimsee",props:{appSetting:{},searchInfo:{},bimseeSetting:{},masker:{default:()=>V},immediate:{type:Boolean,default:!0},handleResponseFn:{},fetchSuccess:{},fetchError:{}},emits:["ready","reload","destroy","change-model","change-point","masker-ready","masker-click","masker-mousedown","masker-zoom-updated","masker-position-updated"],setup(s,{expose:p,emit:a}){const f=s,r=a,i=e.ref(),v=ue(f,i,r),{storeRef:o,getMasker:w}=v,{getBindValue:k}=le(o,w,r),{maskerEvents:u}=de(w,r);return p(v),(l,E)=>(e.openBlock(),e.createElementBlock("div",fe,[e.createVNode(re,e.mergeProps({ref_key:"maskerElRef",ref:i,bimseeProps:f,bimseeStore:e.unref(o)},e.toHandlers(e.unref(u))),{default:e.withCtx(T=>[e.renderSlot(l.$slots,"masker",e.normalizeProps(e.guardReactiveProps(T)),void 0,!0)]),_:3},16,["bimseeStore"]),e.renderSlot(l.$slots,"default",e.normalizeProps(e.guardReactiveProps(e.unref(k))),void 0,!0)]))}}),[["__scopeId","data-v-348a21e7"]]);_.BIMSEE_CONFIG=j,_.Bimsee=K,_.BimseePlugin=K,_.MASKER_CONFIG=V,Object.defineProperty(_,Symbol.toStringTag,{value:"Module"})}));
@@ -1,25 +1,28 @@
1
- export declare const BIMSEE_SETTING: {};
1
+ /** bim设置 */
2
+ export declare const BIMSEE_SETTING: {}; /** bim设置(暂为空对象) */
3
+ /** BIM蒙层配置 */
2
4
  export declare const MASKER_CONFIG: {
3
- visible: boolean;
4
- defaultYaw: number;
5
- defaultPitch: number;
6
- defaultZoomLvl: number;
7
- minFov: number;
8
- maxFov: number;
5
+ visible: boolean; /** 是否可见 */
6
+ defaultYaw: number; /** 默认偏航角 */
7
+ defaultPitch: number; /** 默认俯仰角 */
8
+ defaultZoomLvl: number; /** 默认缩放级别 */
9
+ minFov: number; /** 最小视野角度 */
10
+ maxFov: number; /** 最大视野角度 */
9
11
  };
12
+ /** BIM组件配置 */
10
13
  export declare const BIMSEE_CONFIG: {
11
14
  appSetting: {
12
15
  baseUrl: string;
13
16
  obsType: string;
14
17
  authorizeCode: string;
15
- };
18
+ }; /** 全局设置 */
16
19
  masker: {
17
- visible: boolean;
18
- defaultYaw: number;
19
- defaultPitch: number;
20
- defaultZoomLvl: number;
21
- minFov: number;
22
- maxFov: number;
20
+ visible: boolean; /** 是否可见 */
21
+ defaultYaw: number; /** 默认偏航角 */
22
+ defaultPitch: number; /** 默认俯仰角 */
23
+ defaultZoomLvl: number; /** 默认缩放级别 */
24
+ minFov: number; /** 最小视野角度 */
25
+ maxFov: number; /** 最大视野角度 */
23
26
  };
24
- immediate: boolean;
27
+ immediate: boolean; /** 是否立即生效 */
25
28
  };
@@ -3,21 +3,25 @@ import { AppSetting, Coordinate } from '@vsleem-realsee-viewer/shared';
3
3
  import { BimseeStore } from './store';
4
4
  import { MaskerProps, MaskerElement } from './masker';
5
5
  export type SearchInfo = {
6
- projectId: number;
7
- modelCsId: number;
6
+ projectId: number /** 项目id */;
7
+ modelCsId: number /** bim模型坐标系id */;
8
8
  };
9
+ /** bim设置 */
9
10
  export type BimseeSetting = {};
11
+ /** bim参数 */
10
12
  export type BimseeProps = {
11
- appSetting: AppSetting;
12
- searchInfo: SearchInfo;
13
- bimseeSetting?: BimseeSetting;
14
- masker?: MaskerProps;
15
- immediate?: boolean;
16
- handleResponseFn?: (res?: Coordinate) => Promise<Coordinate | undefined>;
17
- fetchSuccess?: (coordinate?: Coordinate) => void;
18
- fetchError?: (error: any) => void;
13
+ appSetting: AppSetting /** 全局设置 */;
14
+ searchInfo: SearchInfo /** 搜索条件请求参数 */;
15
+ bimseeSetting?: BimseeSetting /** 暂未使用 */;
16
+ masker?: MaskerProps /** 蒙层参数 */;
17
+ immediate?: boolean /** 立即请求接口 */;
18
+ handleResponseFn?: (res?: Coordinate) => Promise<Coordinate | undefined> /** 处理坐标系树响应 */;
19
+ fetchSuccess?: (coordinate?: Coordinate) => void /** 坐标系树请求成功 */;
20
+ fetchError?: (error: any) => void /** 坐标系树请求失败 */;
19
21
  };
22
+ /** 可更新Bimsee配置 */
20
23
  export type UpdatableBimseeProps = Partial<BimseeProps>;
24
+ /** Bimsee对象 */
21
25
  export type BimseeElement = {
22
26
  storeRef: ComputedRef<BimseeStore>;
23
27
  getStore: () => BimseeStore;
@@ -1,4 +1,5 @@
1
1
  import { Point, Coordinate } from '@vsleem-realsee-viewer/shared';
2
+ /** 轨迹点 */
2
3
  export type TrackPoint = {
3
4
  point: Point;
4
5
  coordinate: Coordinate;
@@ -1,28 +1,32 @@
1
1
  import { Position, Vector3, Point } from '@vsleem-realsee-viewer/shared';
2
2
  export type CameraStatus = {
3
- position?: Vector3;
4
- target?: Vector3;
5
- up?: Vector3;
6
- hFov?: number;
7
- minFov?: number;
8
- maxFov?: number;
3
+ position?: Vector3 /** 相机在世界坐标系中的位置 */;
4
+ target?: Vector3 /** 相机瞄准的目标点 */;
5
+ up?: Vector3 /** 相机的上方向向量 */;
6
+ hFov?: number /** 相机的水平视角 */;
7
+ minFov?: number /** 最小视野角度 */;
8
+ maxFov?: number /** 最大视野角度 */;
9
9
  };
10
+ /** 视图选项 */
10
11
  export type ViewerOptions = {
11
- yaw: number;
12
- pitch: number;
13
- zoomLevel: number;
12
+ yaw: number /** 默认偏航角(球面基准) */;
13
+ pitch: number /** 默认俯仰角(球面基准) */;
14
+ zoomLevel: number /** 默认缩放级别(球面基准) */;
14
15
  };
16
+ /** 蒙层参数 */
15
17
  export type MaskerProps = {
16
- visible?: boolean;
17
- defaultYaw?: number | string;
18
- defaultPitch?: number | string;
19
- defaultZoomLvl?: number;
20
- minFov?: number;
21
- maxFov?: number;
22
- mouseover?: boolean;
23
- mousedown?: boolean;
18
+ visible?: boolean /** 蒙层是否可见 */;
19
+ defaultYaw?: number | string /** 默认偏航角(球面基准) */;
20
+ defaultPitch?: number | string /** 默认俯仰角(球面基准) */;
21
+ defaultZoomLvl?: number /** 默认缩放级别(球面基准) */;
22
+ minFov?: number /** 最小视野角度 */;
23
+ maxFov?: number /** 最大视野角度 */;
24
+ mouseover?: boolean /** 鼠标在上面 */;
25
+ mousedown?: boolean /** 鼠标按下 */;
24
26
  };
27
+ /** 可更新蒙层配置 */
25
28
  export type UpdatableMaskerProps = Partial<MaskerProps>;
29
+ /** 用于蒙层的数据转换器集合 */
26
30
  export type DataHelper = {
27
31
  /**将当前模型的坐标转成三维相机位置坐标 */
28
32
  modelPointToCameraPosition: (point: Point) => Vector3;
@@ -33,23 +37,25 @@ export type DataHelper = {
33
37
  /**将缩放级别转换为视野 */
34
38
  zoomLevelToFov: (level: number) => number;
35
39
  };
40
+ /** Bimsee蒙层操作方法集合 */
36
41
  export type MaskerElement = {
37
- dataHelper: DataHelper;
38
- isMouseover: () => boolean;
39
- isMousedown: () => boolean;
40
- setState: (options?: Partial<MaskerProps>) => void;
41
- setMousedown: (mousedown: boolean) => void;
42
- setMouseover: (mouseover: boolean) => void;
43
- setMinFov: (minFov: number) => void;
44
- setMaxFov: (maxFov: number) => void;
45
- setMaskerStatus: (options: ViewerOptions) => void;
46
- zoom: (level: number) => void;
47
- rotate: (position: Position) => void;
48
- getState: () => MaskerProps;
49
- getPosition: () => Position;
50
- getZoomLevel: () => number;
51
- getCameraPosition: () => Vector3 | undefined;
52
- getCameraTarget: () => Vector3 | undefined;
53
- getCameraHFov: () => number | undefined;
54
- getCameraStatus: () => CameraStatus | undefined;
42
+ dataHelper: DataHelper /** 用于蒙层的数据转换器集合 */;
43
+ isMouseover: () => boolean /** 检查鼠标是否悬停 */;
44
+ isMousedown: () => boolean /** 检查鼠标是否按下 */;
45
+ setState: (options?: Partial<MaskerProps>) => void /** 更新蒙层配置选项 */;
46
+ setVisible: (visible: boolean) => void /** 设置蒙层是否显示 */;
47
+ setMousedown: (mousedown: boolean) => void /** 设置鼠标按下状态 */;
48
+ setMouseover: (mouseover: boolean) => void /** 设置鼠标悬停状态 */;
49
+ setMinFov: (minFov: number) => void /** 设置最小视野 */;
50
+ setMaxFov: (maxFov: number) => void /** 设置最大视野 */;
51
+ setMaskerStatus: (options: ViewerOptions) => void /** 更新蒙层状态 */;
52
+ zoom: (level: number) => void /** 缩放到指定级别 */;
53
+ rotate: (position: Position) => void /** 旋转视图到指定位置 */;
54
+ getState: () => MaskerProps /** 获取当前蒙层状态 */;
55
+ getPosition: () => Position /** 获取当前位置(yaw/pitch) */;
56
+ getZoomLevel: () => number /** 获取当前缩放级别 */;
57
+ getCameraPosition: () => Vector3 | undefined /** 获取当前相机位置 */;
58
+ getCameraTarget: () => Vector3 | undefined /** 获取当前相机视角 */;
59
+ getCameraHFov: () => number | undefined /** 获取当前相机瞄准的目标点 */;
60
+ getCameraStatus: () => CameraStatus | undefined /** 获取相机状态 */;
55
61
  };
@@ -1,5 +1,6 @@
1
1
  import { Coordinate, Point } from '@vsleem-realsee-viewer/shared';
2
2
  import { SearchInfo, TrackPoint, ViewerOptions } from '../types';
3
+ /** Bimsee 状态管理元素类型 */
3
4
  export type BimseeStore = {
4
5
  /** 是否加载完成 */
5
6
  ready: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vsleem-realsee-viewer/bimsee-plugin",
3
- "version": "2.0.12",
3
+ "version": "2.0.13",
4
4
  "description": "Bimsee plugin for VSLeem RealSee Viewer",
5
5
  "main": "./dist/index.umd.js",
6
6
  "module": "./dist/index.mjs",
@@ -13,11 +13,11 @@
13
13
  "dist"
14
14
  ],
15
15
  "dependencies": {
16
- "@vsleem-realsee-viewer/shared": "2.0.12"
16
+ "@vsleem-realsee-viewer/shared": "2.0.13"
17
17
  },
18
18
  "peerDependencies": {
19
19
  "vue": "^3.0.0",
20
- "@vsleem-realsee-viewer/shared": "2.0.12"
20
+ "@vsleem-realsee-viewer/shared": "2.0.13"
21
21
  },
22
22
  "peerDependenciesMeta": {
23
23
  "vue": {