@vsleem-realsee-viewer/bimsee-plugin 2.0.14 → 2.0.16

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,5 +1,5 @@
1
1
  import { Ref } from 'vue';
2
- import { BimseeProps, UpdatableBimseeProps, MaskerElement } from '../types';
2
+ import { BimseeProps, MaskerElement, UpdatableBimseeProps } from '../types';
3
3
  export declare function useBimsee(props: BimseeProps, maskerElRef: Ref<MaskerElement | undefined>, emit?: EmitType): {
4
4
  storeRef: import('vue').ComputedRef<import('..').BimseeStore>;
5
5
  getStore: () => import('..').BimseeStore;
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
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";
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, nextTick as Le, createVNode as _e, mergeProps as Ie, toHandlers as Fe, withCtx as be } from "vue";
2
+ import { APP_SETTING as Re, utils as ue, Position as G, Vector3 as te, Point as xe, CoordinateModelType as ze, AppError as j, DataSource as Be, http as Ne } from "@vsleem-realsee-viewer/shared";
3
3
  const W = {
4
4
  visible: !0,
5
5
  defaultYaw: 0,
@@ -7,12 +7,12 @@ const W = {
7
7
  defaultZoomLvl: 30,
8
8
  minFov: 20,
9
9
  maxFov: 120
10
- }, Ne = {
11
- appSetting: be,
10
+ }, De = {
11
+ appSetting: Re,
12
12
  masker: W,
13
13
  immediate: !0
14
- }, { cloneDeep: oe, deepMergeProps: De, getDiffProps: Ye } = ue;
15
- function $e(r, m, n, d) {
14
+ }, { cloneDeep: oe, deepMergeProps: Ye, getDiffProps: $e } = ue;
15
+ function Ve(r, m, n, d) {
16
16
  const a = y(oe(W)), s = y(), f = y(), t = F(() => a.value), h = F(() => {
17
17
  const { coordinateTree: e, mappedCoordinateTree: o, currentSpace: v, currentModel: M, currentPoint: w } = m.value || {};
18
18
  return {
@@ -27,14 +27,14 @@ function $e(r, m, n, d) {
27
27
  });
28
28
  $(() => oe(r.value.masker), S, { immediate: !0, deep: !0 });
29
29
  function S(e, o) {
30
- const v = Ye(e, o);
30
+ const v = $e(e, o);
31
31
  c(v);
32
32
  }
33
33
  function u() {
34
34
  return C(t);
35
35
  }
36
36
  function c(e) {
37
- e && De(a.value, e);
37
+ e && Ye(a.value, e);
38
38
  }
39
39
  function k() {
40
40
  const e = C(n);
@@ -58,8 +58,8 @@ function $e(r, m, n, d) {
58
58
  }
59
59
  function E(e) {
60
60
  if (!f.value || !J()) return;
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);
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, z = Math.PI * 0.15 / 180;
62
+ let B = (Number(b) - (v - w) * z) % (2 * Math.PI), R = (Number(Y) + (M - _) * z) % (2 * Math.PI);
63
63
  R = Math.max(-Math.PI / 2, Math.min(Math.PI / 2, R));
64
64
  const X = new G({ yaw: B, pitch: R });
65
65
  Q(X);
@@ -78,7 +78,7 @@ function $e(r, m, n, d) {
78
78
  const o = Math.sign(e.deltaY) * 5;
79
79
  if (o === 0) return;
80
80
  const { minFov: v = 0, maxFov: M = 0 } = t.value, { hFov: w = 0 } = s.value || {}, _ = Math.min(Math.max(w + o, v), M);
81
- _ !== w && ee(z.fovToZoomLevel(_));
81
+ _ !== w && ee(x.fovToZoomLevel(_));
82
82
  }
83
83
  function P() {
84
84
  const { defaultYaw: e, defaultPitch: o } = t.value;
@@ -126,25 +126,25 @@ function $e(r, m, n, d) {
126
126
  function he(e) {
127
127
  const { currentPoint: o } = m.value;
128
128
  if (o) {
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 });
129
+ const { minFov: v, maxFov: M } = t.value, { yaw: w = 0, pitch: _ = 0, zoomLevel: b = 0 } = e, Y = new G({ yaw: w, pitch: _ }), z = x.modelPointToCameraPosition(o), B = x.maskerRotateToCameraTarget(Y, z), R = x.zoomLevelToFov(b);
130
+ c({ defaultYaw: w, defaultPitch: _, defaultZoomLvl: b }), A({ position: z, target: B, hFov: R, minFov: v, maxFov: M });
131
131
  }
132
132
  }
133
133
  function Q(e) {
134
134
  const o = s.value?.position;
135
135
  if (!o) return;
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);
136
+ const { yaw: v, pitch: M } = e, w = Number(m.value.currentPoint?.yaw || 0) + v, _ = new G({ yaw: Number(w), pitch: Number(M) }), b = x.maskerRotateToCameraTarget(_, o);
137
137
  c({ defaultYaw: w, defaultPitch: M }), A({ target: b }), d("position-updated", { position: e, target: b });
138
138
  }
139
139
  function ee(e) {
140
- const o = z.zoomLevelToFov(e);
140
+ const o = x.zoomLevelToFov(e);
141
141
  c({ defaultZoomLvl: e }), A({ hFov: o }), d("zoom-updated", { zoomLevel: e, hFov: o });
142
142
  }
143
143
  function we(e) {
144
144
  return new te(e);
145
145
  }
146
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;
147
+ const { x: v = 0, y: M = 0, z: w = 0 } = o, { yaw: _, pitch: b } = e, Y = -_, z = b, B = 100, R = 0, X = B * Math.cos(R + Y) + v, ye = B * Math.sin(R + Y) + M, Se = B * Math.tan(z) + w;
148
148
  return new te({ x: X, y: ye, z: Se });
149
149
  }
150
150
  function Pe(e) {
@@ -156,7 +156,7 @@ function $e(r, m, n, d) {
156
156
  let M = v + e / 100 * (o - v);
157
157
  return Math.max(o, Math.min(v, M));
158
158
  }
159
- const z = {
159
+ const x = {
160
160
  modelPointToCameraPosition: we,
161
161
  maskerRotateToCameraTarget: Me,
162
162
  fovToZoomLevel: Pe,
@@ -166,7 +166,7 @@ function $e(r, m, n, d) {
166
166
  getProps: t,
167
167
  getBindValue: h,
168
168
  maskerAction: {
169
- dataHelper: z,
169
+ dataHelper: x,
170
170
  isMouseover: ve,
171
171
  isMousedown: J,
172
172
  setState: c,
@@ -190,7 +190,7 @@ function $e(r, m, n, d) {
190
190
  handleUninstallEvents: T
191
191
  };
192
192
  }
193
- const Ve = { class: "vsleem-masker" }, Ze = /* @__PURE__ */ ae({
193
+ const Ze = { class: "vsleem-masker" }, Ae = /* @__PURE__ */ ae({
194
194
  __name: "Masker",
195
195
  props: {
196
196
  bimseeProps: {},
@@ -198,7 +198,7 @@ const Ve = { class: "vsleem-masker" }, Ze = /* @__PURE__ */ ae({
198
198
  },
199
199
  emits: ["ready", "click", "mousedown", "zoom-updated", "position-updated"],
200
200
  setup(r, { expose: m, emit: n }) {
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);
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 } = Ve(f, t, s, a);
202
202
  $(() => C(t)?.ready, T, { immediate: !0 }), re(L);
203
203
  function T(E) {
204
204
  E && (I(), c());
@@ -209,7 +209,7 @@ const Ve = { class: "vsleem-masker" }, Ze = /* @__PURE__ */ ae({
209
209
  function L() {
210
210
  k();
211
211
  }
212
- return m(u), (E, p) => (ie(), se("div", Ve, [
212
+ return m(u), (E, p) => (ie(), se("div", Ze, [
213
213
  ke(Te("div", {
214
214
  ref_key: "maskerElRef",
215
215
  ref: s,
@@ -225,9 +225,9 @@ const Ve = { class: "vsleem-masker" }, Ze = /* @__PURE__ */ ae({
225
225
  for (const [d, a] of m)
226
226
  n[d] = a;
227
227
  return n;
228
- }, Ae = /* @__PURE__ */ ce(Ze, [["__scopeId", "data-v-605902cc"]]);
228
+ }, Ue = /* @__PURE__ */ ce(Ae, [["__scopeId", "data-v-605902cc"]]);
229
229
  var V = /* @__PURE__ */ ((r) => (r[r.StoreMissParams = 11e3] = "StoreMissParams", r[r.StoreNoCSTree = 11001] = "StoreNoCSTree", r[r.StoreSelectNoBIMModel = 11002] = "StoreSelectNoBIMModel", r))(V || {});
230
- function Ue(r, { setReferPoint: m }) {
230
+ function Oe(r, { setReferPoint: m }) {
231
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());
232
232
  async function u(i) {
233
233
  const { projectId: l, modelCsId: g } = i || {};
@@ -235,7 +235,7 @@ function Ue(r, { setReferPoint: m }) {
235
235
  if (!l)
236
236
  throw new j(V.StoreMissParams, "缺少必要的查询参数");
237
237
  if (a.value = !0, l != n.value?.projectId) {
238
- const N = await xe.getCoordinateTree(l), D = await r.value.handleResponseFn?.(N) || N;
238
+ const N = await Be.getCoordinateTree(l), D = await r.value.handleResponseFn?.(N) || N;
239
239
  if (!D)
240
240
  throw new j(
241
241
  V.StoreNoCSTree,
@@ -274,7 +274,7 @@ function Ue(r, { setReferPoint: m }) {
274
274
  if (!l) return;
275
275
  const g = l?.getDestRelativeMap(h.value);
276
276
  if (!g) return;
277
- const P = new Re(i.point).projection(
277
+ const P = new xe(i.point).projection(
278
278
  g,
279
279
  l,
280
280
  h.value
@@ -314,32 +314,32 @@ function Ue(r, { setReferPoint: m }) {
314
314
  setReady: c
315
315
  };
316
316
  }
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);
317
+ const { cloneDeep: ne, deepMergeProps: Xe, getDiffProps: Ge } = ue;
318
+ function je(r, m, n) {
319
+ const d = y(ne(De)), a = F(() => d.value);
320
320
  $(() => ne(r), u, { immediate: !0, deep: !0 }), $(
321
321
  () => a.value.searchInfo,
322
322
  () => I(s.value.ready),
323
323
  { deep: !0 }
324
324
  );
325
- const { storeRef: s, getStore: f, setReady: t } = Ue(a, { setReferPoint: E });
325
+ const { storeRef: s, getStore: f, setReady: t } = Oe(a, { setReferPoint: E });
326
326
  Ce(h), re(S);
327
327
  async function h() {
328
328
  const { appSetting: p, immediate: i } = C(a);
329
- p && Be.setRequestGlobalConfig(p), i && (await I(!0), setTimeout(T, 0));
329
+ p && Ne.setRequestGlobalConfig(p), i && (await I(!0), setTimeout(T, 0));
330
330
  }
331
331
  function S() {
332
332
  n?.("destroy");
333
333
  }
334
334
  function u(p, i) {
335
- const l = Xe(p, i);
335
+ const l = Ge(p, i);
336
336
  k(l);
337
337
  }
338
338
  function c() {
339
339
  return C(a);
340
340
  }
341
341
  function k(p) {
342
- p && Oe(d.value, p);
342
+ p && Xe(d.value, p);
343
343
  }
344
344
  function T() {
345
345
  t(!0), n?.("ready");
@@ -356,7 +356,7 @@ function Ge(r, m, n) {
356
356
  if (l) {
357
357
  const g = l.normalizeToModelPoint(p);
358
358
  if (!g) return;
359
- l.selectPoint(g.point);
359
+ l.selectPoint(g.point), await Le();
360
360
  const { yaw: P = 0, pitch: N = 0, zoomLevel: D = 0 } = i, Z = g.point?.yaw + P;
361
361
  L()?.setMaskerStatus({ yaw: Z, pitch: N, zoomLevel: D });
362
362
  }
@@ -369,7 +369,7 @@ function Ge(r, m, n) {
369
369
  setState: k
370
370
  };
371
371
  }
372
- function je(r, m, n) {
372
+ function He(r, m, n) {
373
373
  const d = F(() => r.value.ready && !!r.value.currentModel), a = F(() => {
374
374
  const { coordinateTree: t, mappedCoordinateTree: h, currentSpace: S, currentModel: u, currentPoint: c } = r.value || {};
375
375
  return {
@@ -409,7 +409,7 @@ function je(r, m, n) {
409
409
  getBindValue: a
410
410
  };
411
411
  }
412
- function He(r, m) {
412
+ function qe(r, m) {
413
413
  const n = y({ yaw: 0, pitch: 0 });
414
414
  function d(u) {
415
415
  m("masker-ready", u);
@@ -438,7 +438,7 @@ function He(r, m) {
438
438
  positionUpdated: t
439
439
  } };
440
440
  }
441
- const qe = { class: "vsleem-bimsee" }, Ke = /* @__PURE__ */ ae({
441
+ const Ke = { class: "vsleem-bimsee" }, We = /* @__PURE__ */ ae({
442
442
  name: "Bimsee",
443
443
  __name: "Bimsee",
444
444
  props: {
@@ -464,15 +464,15 @@ const qe = { class: "vsleem-bimsee" }, Ke = /* @__PURE__ */ ae({
464
464
  "masker-position-updated"
465
465
  ],
466
466
  setup(r, { expose: m, emit: n }) {
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({
467
+ const d = r, a = n, s = y(), f = je(d, s, a), { storeRef: t, getMasker: h } = f, { getBindValue: S } = He(t, h, a), { maskerEvents: u } = qe(h, a);
468
+ return m(f), (c, k) => (ie(), se("div", Ke, [
469
+ _e(Ue, Ie({
470
470
  ref_key: "maskerElRef",
471
471
  ref: s,
472
472
  bimseeProps: d,
473
473
  bimseeStore: C(t)
474
- }, Ie(C(u))), {
475
- default: Fe((T) => [
474
+ }, Fe(C(u))), {
475
+ default: be((T) => [
476
476
  H(c.$slots, "masker", q(K(T)), void 0, !0)
477
477
  ]),
478
478
  _: 3
@@ -480,10 +480,10 @@ const qe = { class: "vsleem-bimsee" }, Ke = /* @__PURE__ */ ae({
480
480
  H(c.$slots, "default", q(K(C(S))), void 0, !0)
481
481
  ]));
482
482
  }
483
- }), et = /* @__PURE__ */ ce(Ke, [["__scopeId", "data-v-348a21e7"]]);
483
+ }), tt = /* @__PURE__ */ ce(We, [["__scopeId", "data-v-348a21e7"]]);
484
484
  export {
485
- Ne as BIMSEE_CONFIG,
486
- et as Bimsee,
487
- et as BimseePlugin,
485
+ De as BIMSEE_CONFIG,
486
+ tt as Bimsee,
487
+ tt as BimseePlugin,
488
488
  W as MASKER_CONFIG
489
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);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
+ (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 T(){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 E(){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,Te=N*Math.sin(R+Y)+P,Ee=N*Math.tan(z)+M;return new g.Vector3({x:G,y:Te,z:Ee})}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:T,handleUninstallEvents:E}}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:T}=oe(v,o,i,r);e.watch(()=>e.unref(o)?.ready,E,{immediate:!0}),e.onBeforeUnmount(L);function E(C){C&&(F(),l())}function F(){r("ready",u?.getCameraStatus())}function L(){T()}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(),T({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 T(c){const{modelCsId:d}=c;d&&E({id:d})}function E(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:E,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(E,0))}function k(){a?.("destroy")}function u(h,c){const d=ce(h,c);T(d)}function l(){return e.unref(r)}function T(h){h&&ie(f.value,h)}function E(){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),await e.nextTick();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:T}}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:T}=u.position,{yaw:E,pitch:F}=e.unref(a);return a.value={yaw:l,pitch:T},{yaw:l-E,pitch:T-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,T)=>(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(E=>[e.renderSlot(l.$slots,"masker",e.normalizeProps(e.guardReactiveProps(E)),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"})}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vsleem-realsee-viewer/bimsee-plugin",
3
- "version": "2.0.14",
3
+ "version": "2.0.16",
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.14"
16
+ "@vsleem-realsee-viewer/shared": "2.0.16"
17
17
  },
18
18
  "peerDependencies": {
19
19
  "vue": "^3.0.0",
20
- "@vsleem-realsee-viewer/shared": "2.0.14"
20
+ "@vsleem-realsee-viewer/shared": "2.0.16"
21
21
  },
22
22
  "peerDependenciesMeta": {
23
23
  "vue": {