@vsleem-realsee-viewer/bimsee-plugin 2.1.0 → 2.1.2
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.
- package/dist/index.mjs +11 -11
- package/dist/index.umd.js +1 -1
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -314,8 +314,8 @@ function Oe(r, { setReferPoint: v }) {
|
|
|
314
314
|
setReady: c
|
|
315
315
|
};
|
|
316
316
|
}
|
|
317
|
-
const { cloneDeep: re, deepMergeProps: Xe, getDiffProps: Ge } = le;
|
|
318
|
-
function
|
|
317
|
+
const { cloneDeep: re, deepMergeProps: Xe, getDiffProps: Ge, delay: je } = le;
|
|
318
|
+
function He(r, v, n) {
|
|
319
319
|
const d = g(re(De)), a = F(() => d.value);
|
|
320
320
|
$(() => re(r), u, { immediate: !0, deep: !0 }), $(
|
|
321
321
|
() => a.value.searchInfo,
|
|
@@ -326,7 +326,7 @@ function je(r, v, n) {
|
|
|
326
326
|
Ce(h), ie(y);
|
|
327
327
|
async function h() {
|
|
328
328
|
const { appSetting: p, immediate: s } = C(a);
|
|
329
|
-
p && Ne.setRequestGlobalConfig(p), s && (await I(!0),
|
|
329
|
+
p && Ne.setRequestGlobalConfig(p), s && (await I(!0), await je(0), k());
|
|
330
330
|
}
|
|
331
331
|
function y() {
|
|
332
332
|
n?.("destroy");
|
|
@@ -371,7 +371,7 @@ function je(r, v, n) {
|
|
|
371
371
|
setState: S
|
|
372
372
|
};
|
|
373
373
|
}
|
|
374
|
-
function
|
|
374
|
+
function qe(r, v, n) {
|
|
375
375
|
const d = F(() => r.value.ready && !!r.value.currentModel), a = F(() => {
|
|
376
376
|
const { coordinateTree: t, mappedCoordinateTree: h, currentSpace: y, currentModel: u, currentPoint: c } = r.value || {};
|
|
377
377
|
return {
|
|
@@ -411,7 +411,7 @@ function He(r, v, n) {
|
|
|
411
411
|
getBindValue: a
|
|
412
412
|
};
|
|
413
413
|
}
|
|
414
|
-
function
|
|
414
|
+
function Ke(r, v) {
|
|
415
415
|
const n = g({ yaw: 0, pitch: 0 });
|
|
416
416
|
function d(u) {
|
|
417
417
|
v("masker-ready", u);
|
|
@@ -440,7 +440,7 @@ function qe(r, v) {
|
|
|
440
440
|
positionUpdated: t
|
|
441
441
|
} };
|
|
442
442
|
}
|
|
443
|
-
const
|
|
443
|
+
const We = { class: "vsleem-bimsee" }, Je = /* @__PURE__ */ se({
|
|
444
444
|
name: "Bimsee",
|
|
445
445
|
__name: "Bimsee",
|
|
446
446
|
props: {
|
|
@@ -466,8 +466,8 @@ const Ke = { class: "vsleem-bimsee" }, We = /* @__PURE__ */ se({
|
|
|
466
466
|
"masker-position-updated"
|
|
467
467
|
],
|
|
468
468
|
setup(r, { expose: v, emit: n }) {
|
|
469
|
-
const d = r, a = n, i = g(), f =
|
|
470
|
-
return v(f), (c, S) => (ce(), ue("div",
|
|
469
|
+
const d = r, a = n, i = g(), f = He(d, i, a), { storeRef: t, getMasker: h } = f, { getBindValue: y } = qe(t, h, a), { maskerEvents: u } = Ke(h, a);
|
|
470
|
+
return v(f), (c, S) => (ce(), ue("div", We, [
|
|
471
471
|
_e(Ue, Ie({
|
|
472
472
|
ref_key: "maskerElRef",
|
|
473
473
|
ref: i,
|
|
@@ -482,10 +482,10 @@ const Ke = { class: "vsleem-bimsee" }, We = /* @__PURE__ */ se({
|
|
|
482
482
|
q(c.$slots, "default", K(W(C(y))), void 0, !0)
|
|
483
483
|
]));
|
|
484
484
|
}
|
|
485
|
-
}),
|
|
485
|
+
}), ot = /* @__PURE__ */ de(Je, [["__scopeId", "data-v-348a21e7"]]);
|
|
486
486
|
export {
|
|
487
487
|
De as BIMSEE_CONFIG,
|
|
488
|
-
|
|
489
|
-
|
|
488
|
+
ot as Bimsee,
|
|
489
|
+
ot as BimseePlugin,
|
|
490
490
|
J as MASKER_CONFIG
|
|
491
491
|
};
|
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,y){"use strict";const V={visible:!0,defaultYaw:0,defaultPitch:0,defaultZoomLvl:30,minFov:20,maxFov:120},X={appSetting:y.APP_SETTING,masker:V,immediate:!0},{cloneDeep:q,deepMergeProps:oe,getDiffProps:ne}=y.utils;function ae(s,p,a,f){const r=e.ref(q(V)),c=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:c.value,state:o.value}});e.watch(()=>q(s.value.masker),S,{immediate:!0,deep:!0});function S(t,n){const m=ne(t,n);l(m)}function u(){return e.unref(o)}function l(t){t&&oe(r.value,t)}function k(){const t=e.unref(a);t&&(t.addEventListener("mousedown",I),t.addEventListener("touchstart",I),t.addEventListener("click",F),window.addEventListener("mousemove",E),window.addEventListener("touchmove",E),window.addEventListener("mouseup",h),window.addEventListener("touchend",h),t.addEventListener("mouseover",i),t.addEventListener("mouseout",d),t.addEventListener("wheel",C))}function T(){const t=e.unref(a);t&&(t.removeEventListener("mousedown",I),t.removeEventListener("touchstart",I),window.removeEventListener("mousemove",E),window.removeEventListener("touchmove",E),window.removeEventListener("mouseup",h),window.removeEventListener("touchend",h),t.removeEventListener("mouseover",i),t.removeEventListener("mouseout",d),t.removeEventListener("wheel",C))}function F(t){f("click",t)}function I(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},G(!0),f("mousedown",t)}function E(t){if(!v.value||!Q())return;const n=t instanceof TouchEvent?t.touches[0]:t,{pageX:m,pageY:P}=n,{pageX:M,pageY:L}=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-L)*z)%(2*Math.PI);R=Math.max(-Math.PI/2,Math.min(Math.PI/2,R));const j=new y.Position({yaw:N,pitch:R});ee(j)}function h(){G(!1),v.value=void 0}function i(){Z(!0)}function d(){Z(!1)}function C(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}=c.value||{},L=Math.min(Math.max(M+n,m),P);L!==M&&te(b.fovToZoomLevel(L))}function g(){const{defaultYaw:t,defaultPitch:n}=o.value;return{yaw:t,pitch:n}}function x(){return o.value.defaultZoomLvl}function D(){return c.value?.position}function A(){return c.value?.hFov}function J(){return c.value?.target}function O(){return c.value}function ve(){return o.value?.mouseover??!1}function Q(){return o.value?.mousedown??!1}function U(t){c.value={...c.value,...t}}function he(t){l({visible:t})}function Z(t){l({mouseover:t})}function G(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,{zoom:M=0}=t,{yaw:L=0,pitch:B=0}=t.position||{},Y=new y.Position({yaw:L,pitch:B}),z=b.modelPointToCameraPosition(n),N=b.maskerRotateToCameraTarget(Y,z),R=b.zoomLevelToFov(M);l({defaultYaw:L,defaultPitch:B,defaultZoomLvl:M}),U({position:z,target:N,hFov:R,minFov:m,maxFov:P})}}function ee(t){const n=c.value?.position;if(!n)return;const{yaw:m,pitch:P}=t,M=Number(p.value.currentPoint?.yaw||0)+m,L=new y.Position({yaw:Number(M),pitch:Number(P)}),B=b.maskerRotateToCameraTarget(L,n);l({defaultYaw:M,defaultPitch:P}),U({target:B}),f("position-updated",{position:t,target:B})}function te(t){const n=b.zoomLevelToFov(t);l({defaultZoomLvl:t}),U({hFov:n}),f("zoom-updated",{zoomLevel:t,hFov:n})}function ge(t){return new y.Vector3(t)}function ye(t,n){const{x:m=0,y:P=0,z:M=0}=n,{yaw:L,pitch:B}=t,Y=-L,z=B,N=100,R=0,j=N*Math.cos(R+Y)+m,Te=N*Math.sin(R+Y)+P,Ee=N*Math.tan(z)+M;return new y.Vector3({x:j,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:Q,setState:l,setVisible:he,setMousedown:G,setMouseover:Z,setMinFov:we,setMaxFov:Me,setMaskerStatus:Pe,zoom:te,rotate:ee,getState:u,getPosition:g,getZoomLevel:x,getCameraPosition:D,getCameraTarget:J,getCameraHFov:A,getCameraStatus:O},handleMaskerEvents:k,handleUninstallEvents:T}}const re={class:"vsleem-masker"},se=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,c=e.ref(),v=e.computed(()=>f.bimseeProps),o=e.computed(()=>f.bimseeStore),{getProps:w,getBindValue:S,maskerAction:u,handleMaskerEvents:l,handleUninstallEvents:k}=ae(v,o,c,r);e.watch(()=>e.unref(o)?.ready,T,{immediate:!0}),e.onBeforeUnmount(I);function T(E){E&&(F(),l())}function F(){r("ready",u?.getCameraStatus())}function I(){k()}return p(u),(E,h)=>(e.openBlock(),e.createElementBlock("div",re,[e.withDirectives(e.createElementVNode("div",{ref_key:"maskerElRef",ref:c,class:"masker-container"},null,512),[[e.vShow,e.unref(w).visible]]),e.renderSlot(E.$slots,"default",e.normalizeProps(e.guardReactiveProps(e.unref(S))),void 0,!0)]))}}),H=(s,p)=>{const a=s.__vccOpts||s;for(const[f,r]of p)a[f]=r;return a},ie=H(se,[["__scopeId","data-v-605902cc"]]);var $=(s=>(s[s.StoreMissParams=11e3]="StoreMissParams",s[s.StoreNoCSTree=11001]="StoreNoCSTree",s[s.StoreSelectNoBIMModel=11002]="StoreSelectNoBIMModel",s))($||{});function ce(s,{setReferPoint:p}){const a=e.ref(),f=e.ref(),r=e.ref(!1),c=e.ref(!1),v=e.ref(),o=e.ref(),w=e.computed(()=>a.value?.findCsById(v.value)),S=e.computed(()=>w.value?.findParentSpace());async function u(i){const{projectId:d,modelCsId:C}=i||{};try{if(!d)throw new y.AppError($.StoreMissParams,"缺少必要的查询参数");if(r.value=!0,d!=a.value?.projectId){const x=await y.DataSource.getCoordinateTree(d),D=await s.value.handleResponseFn?.(x)||x;if(!D)throw new y.AppError($.StoreNoCSTree,`未查询到项目ID为 ${d} 的坐标系树`);a.value=D}const g=a.value?.findCsById(C);f.value=g?.getMappedCsTree(),k({modelCsId:C}),s.value.fetchSuccess?.(a.value)}catch(g){console.error(g),s.value.fetchError?.(g)}finally{r.value=!1}}function l(i=!1){c.value=i}function k(i){const{modelCsId:d}=i;d&&T({id:d})}function T(i){const{id:d}=i;if(a.value?.findCsById(d)?.modelType===y.CoordinateModelType.BIMModel)v.value=d;else throw new y.AppError($.StoreSelectNoBIMModel,`未找到ID为 ${d} 的BIM模型坐标系`)}function F(i){o.value=i}function I(i){if(!w.value||!i)return;const d=a.value?.findCsById(i.coordinate?.id);if(!d)return;const C=d?.getDestRelativeMap(w.value);if(!C)return;const g=new y.Point(i.point).projection(C,d,w.value);if(g)return g.y=-g.y,{...i,coordinate:w.value,point:g,position:g}}function E(){return h.value}const h=e.computed(()=>({ready:c.value,coordinateTree:a.value,mappedCoordinateTree:f.value,currentPoint:o.value,currentSpace:S.value,currentModel:w.value,reload:u,selectModel:T,selectPoint:F,setReferPoint:p,normalizeToModelPoint:I}));return{storeRef:h,getStore:E,setReady:l}}const{cloneDeep:K,deepMergeProps:ue,getDiffProps:le}=y.utils;function de(s,p,a){const f=e.ref(K(X)),r=e.computed(()=>f.value);e.watch(()=>K(s),u,{immediate:!0,deep:!0}),e.watch(()=>r.value.searchInfo,()=>F(c.value.ready),{deep:!0});const{storeRef:c,getStore:v,setReady:o}=ce(r,{setReferPoint:E});e.onMounted(w),e.onBeforeUnmount(S);async function w(){const{appSetting:h,immediate:i}=e.unref(r);h&&y.http.setRequestGlobalConfig(h),i&&(await F(!0),setTimeout(T,0))}function S(){a?.("destroy")}function u(h,i){const d=le(h,i);k(d)}function l(){return e.unref(r)}function k(h){h&&ue(f.value,h)}function T(){o(!0),a?.("ready")}async function F(h){const{searchInfo:i}=r.value;h&&i&&(await c.value?.reload(i),a?.("reload"))}function I(){return p.value}async function E(h,i){const d=v();if(d){const C=I();if(!C)return;const g=d.normalizeToModelPoint(h);if(!g)return;d.selectPoint(g.point),await e.nextTick();const{zoom:x=0}=i,{yaw:D=0,pitch:A=0}=i.position||{},O={yaw:g.point?.yaw+D,pitch:A};C.setMaskerStatus({position:O,zoom:x})}}return{storeRef:c,getStore:v,getMasker:I,getState:l,setState:k}}function fe(s,p,a){const f=e.computed(()=>s.value.ready&&!!s.value.currentModel),r=e.computed(()=>{const{coordinateTree:o,mappedCoordinateTree:w,currentSpace:S,currentModel:u,currentPoint:l}=s.value||{};return{coordinateTree:o,mappedCoordinateTree:w,currentSpace:S,currentModel:u,currentPoint:l}});e.watch(()=>r.value?.currentModel?.id,o=>{o&&c(r.value?.currentModel)},{immediate:!0}),e.watch(()=>r.value?.currentPoint,o=>{o&&v(r.value?.currentPoint)},{immediate:!0,deep:!0});function c(o){a("change-model",o)}function v(o){a("change-point",o)}return{getShow:f,getBindValue:r}}function me(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 c(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:k}=u.position,{yaw:T,pitch:F}=e.unref(a);return a.value={yaw:l,pitch:k},{yaw:l-T,pitch:k-F}}return{maskerEvents:{ready:f,click:r,mousedown:c,zoomUpdated:v,positionUpdated:o}}}const pe={class:"vsleem-bimsee"},W=H(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,c=e.ref(),v=de(f,c,r),{storeRef:o,getMasker:w}=v,{getBindValue:S}=fe(o,w,r),{maskerEvents:u}=me(w,r);return p(v),(l,k)=>(e.openBlock(),e.createElementBlock("div",pe,[e.createVNode(ie,e.mergeProps({ref_key:"maskerElRef",ref:c,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(S))),void 0,!0)]))}}),[["__scopeId","data-v-348a21e7"]]);_.BIMSEE_CONFIG=X,_.Bimsee=W,_.BimseePlugin=W,_.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},X={appSetting:g.APP_SETTING,masker:V,immediate:!0},{cloneDeep:q,deepMergeProps:oe,getDiffProps:ne}=g.utils;function ae(s,p,a,f){const r=e.ref(q(V)),c=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:c.value,state:o.value}});e.watch(()=>q(s.value.masker),S,{immediate:!0,deep:!0});function S(t,n){const m=ne(t,n);l(m)}function u(){return e.unref(o)}function l(t){t&&oe(r.value,t)}function k(){const t=e.unref(a);t&&(t.addEventListener("mousedown",I),t.addEventListener("touchstart",I),t.addEventListener("click",F),window.addEventListener("mousemove",T),window.addEventListener("touchmove",T),window.addEventListener("mouseup",h),window.addEventListener("touchend",h),t.addEventListener("mouseover",i),t.addEventListener("mouseout",d),t.addEventListener("wheel",C))}function E(){const t=e.unref(a);t&&(t.removeEventListener("mousedown",I),t.removeEventListener("touchstart",I),window.removeEventListener("mousemove",T),window.removeEventListener("touchmove",T),window.removeEventListener("mouseup",h),window.removeEventListener("touchend",h),t.removeEventListener("mouseover",i),t.removeEventListener("mouseout",d),t.removeEventListener("wheel",C))}function F(t){f("click",t)}function I(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},G(!0),f("mousedown",t)}function T(t){if(!v.value||!Q())return;const n=t instanceof TouchEvent?t.touches[0]:t,{pageX:m,pageY:P}=n,{pageX:M,pageY:L}=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-L)*z)%(2*Math.PI);R=Math.max(-Math.PI/2,Math.min(Math.PI/2,R));const j=new g.Position({yaw:N,pitch:R});ee(j)}function h(){G(!1),v.value=void 0}function i(){Z(!0)}function d(){Z(!1)}function C(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}=c.value||{},L=Math.min(Math.max(M+n,m),P);L!==M&&te(b.fovToZoomLevel(L))}function y(){const{defaultYaw:t,defaultPitch:n}=o.value;return{yaw:t,pitch:n}}function x(){return o.value.defaultZoomLvl}function D(){return c.value?.position}function A(){return c.value?.hFov}function J(){return c.value?.target}function O(){return c.value}function he(){return o.value?.mouseover??!1}function Q(){return o.value?.mousedown??!1}function U(t){c.value={...c.value,...t}}function we(t){l({visible:t})}function Z(t){l({mouseover:t})}function G(t){l({mousedown:t})}function Me(t){l({minFov:t})}function Pe(t){l({maxFov:t})}function ye(t){const{currentPoint:n}=p.value;if(n){const{minFov:m,maxFov:P}=o.value,{zoom:M=0}=t,{yaw:L=0,pitch:B=0}=t.position||{},Y=new g.Position({yaw:L,pitch:B}),z=b.modelPointToCameraPosition(n),N=b.maskerRotateToCameraTarget(Y,z),R=b.zoomLevelToFov(M);l({defaultYaw:L,defaultPitch:B,defaultZoomLvl:M}),U({position:z,target:N,hFov:R,minFov:m,maxFov:P})}}function ee(t){const n=c.value?.position;if(!n)return;const{yaw:m,pitch:P}=t,M=Number(p.value.currentPoint?.yaw||0)+m,L=new g.Position({yaw:Number(M),pitch:Number(P)}),B=b.maskerRotateToCameraTarget(L,n);l({defaultYaw:M,defaultPitch:P}),U({target:B}),f("position-updated",{position:t,target:B})}function te(t){const n=b.zoomLevelToFov(t);l({defaultZoomLvl:t}),U({hFov:n}),f("zoom-updated",{zoomLevel:t,hFov:n})}function ge(t){return new g.Vector3(t)}function Se(t,n){const{x:m=0,y:P=0,z:M=0}=n,{yaw:L,pitch:B}=t,Y=-L,z=B,N=100,R=0,j=N*Math.cos(R+Y)+m,Te=N*Math.sin(R+Y)+P,Ce=N*Math.tan(z)+M;return new g.Vector3({x:j,y:Te,z:Ce})}function ke(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 Ee(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:Se,fovToZoomLevel:ke,zoomLevelToFov:Ee};return{getProps:o,getBindValue:w,maskerAction:{dataHelper:b,isMouseover:he,isMousedown:Q,setState:l,setVisible:we,setMousedown:G,setMouseover:Z,setMinFov:Me,setMaxFov:Pe,setMaskerStatus:ye,zoom:te,rotate:ee,getState:u,getPosition:y,getZoomLevel:x,getCameraPosition:D,getCameraTarget:J,getCameraHFov:A,getCameraStatus:O},handleMaskerEvents:k,handleUninstallEvents:E}}const re={class:"vsleem-masker"},se=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,c=e.ref(),v=e.computed(()=>f.bimseeProps),o=e.computed(()=>f.bimseeStore),{getProps:w,getBindValue:S,maskerAction:u,handleMaskerEvents:l,handleUninstallEvents:k}=ae(v,o,c,r);e.watch(()=>e.unref(o)?.ready,E,{immediate:!0}),e.onBeforeUnmount(I);function E(T){T&&(F(),l())}function F(){r("ready",u?.getCameraStatus())}function I(){k()}return p(u),(T,h)=>(e.openBlock(),e.createElementBlock("div",re,[e.withDirectives(e.createElementVNode("div",{ref_key:"maskerElRef",ref:c,class:"masker-container"},null,512),[[e.vShow,e.unref(w).visible]]),e.renderSlot(T.$slots,"default",e.normalizeProps(e.guardReactiveProps(e.unref(S))),void 0,!0)]))}}),H=(s,p)=>{const a=s.__vccOpts||s;for(const[f,r]of p)a[f]=r;return a},ie=H(se,[["__scopeId","data-v-605902cc"]]);var $=(s=>(s[s.StoreMissParams=11e3]="StoreMissParams",s[s.StoreNoCSTree=11001]="StoreNoCSTree",s[s.StoreSelectNoBIMModel=11002]="StoreSelectNoBIMModel",s))($||{});function ce(s,{setReferPoint:p}){const a=e.ref(),f=e.ref(),r=e.ref(!1),c=e.ref(!1),v=e.ref(),o=e.ref(),w=e.computed(()=>a.value?.findCsById(v.value)),S=e.computed(()=>w.value?.findParentSpace());async function u(i){const{projectId:d,modelCsId:C}=i||{};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(C);f.value=y?.getMappedCsTree(),k({modelCsId:C}),s.value.fetchSuccess?.(a.value)}catch(y){console.error(y),s.value.fetchError?.(y)}finally{r.value=!1}}function l(i=!1){c.value=i}function k(i){const{modelCsId:d}=i;d&&E({id:d})}function E(i){const{id:d}=i;if(a.value?.findCsById(d)?.modelType===g.CoordinateModelType.BIMModel)v.value=d;else throw new g.AppError($.StoreSelectNoBIMModel,`未找到ID为 ${d} 的BIM模型坐标系`)}function F(i){o.value=i}function I(i){if(!w.value||!i)return;const d=a.value?.findCsById(i.coordinate?.id);if(!d)return;const C=d?.getDestRelativeMap(w.value);if(!C)return;const y=new g.Point(i.point).projection(C,d,w.value);if(y)return y.y=-y.y,{...i,coordinate:w.value,point:y,position:y}}function T(){return h.value}const h=e.computed(()=>({ready:c.value,coordinateTree:a.value,mappedCoordinateTree:f.value,currentPoint:o.value,currentSpace:S.value,currentModel:w.value,reload:u,selectModel:E,selectPoint:F,setReferPoint:p,normalizeToModelPoint:I}));return{storeRef:h,getStore:T,setReady:l}}const{cloneDeep:K,deepMergeProps:ue,getDiffProps:le,delay:de}=g.utils;function fe(s,p,a){const f=e.ref(K(X)),r=e.computed(()=>f.value);e.watch(()=>K(s),u,{immediate:!0,deep:!0}),e.watch(()=>r.value.searchInfo,()=>F(c.value.ready),{deep:!0});const{storeRef:c,getStore:v,setReady:o}=ce(r,{setReferPoint:T});e.onMounted(w),e.onBeforeUnmount(S);async function w(){const{appSetting:h,immediate:i}=e.unref(r);h&&g.http.setRequestGlobalConfig(h),i&&(await F(!0),await de(0),E())}function S(){a?.("destroy")}function u(h,i){const d=le(h,i);k(d)}function l(){return e.unref(r)}function k(h){h&&ue(f.value,h)}function E(){o(!0),a?.("ready")}async function F(h){const{searchInfo:i}=r.value;h&&i&&(await c.value?.reload(i),a?.("reload"))}function I(){return p.value}async function T(h,i){const d=v();if(d){const C=I();if(!C)return;const y=d.normalizeToModelPoint(h);if(!y)return;d.selectPoint(y.point),await e.nextTick();const{zoom:x=0}=i,{yaw:D=0,pitch:A=0}=i.position||{},O={yaw:y.point?.yaw+D,pitch:A};C.setMaskerStatus({position:O,zoom:x})}}return{storeRef:c,getStore:v,getMasker:I,getState:l,setState:k}}function me(s,p,a){const f=e.computed(()=>s.value.ready&&!!s.value.currentModel),r=e.computed(()=>{const{coordinateTree:o,mappedCoordinateTree:w,currentSpace:S,currentModel:u,currentPoint:l}=s.value||{};return{coordinateTree:o,mappedCoordinateTree:w,currentSpace:S,currentModel:u,currentPoint:l}});e.watch(()=>r.value?.currentModel?.id,o=>{o&&c(r.value?.currentModel)},{immediate:!0}),e.watch(()=>r.value?.currentPoint,o=>{o&&v(r.value?.currentPoint)},{immediate:!0,deep:!0});function c(o){a("change-model",o)}function v(o){a("change-point",o)}return{getShow:f,getBindValue:r}}function pe(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 c(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:k}=u.position,{yaw:E,pitch:F}=e.unref(a);return a.value={yaw:l,pitch:k},{yaw:l-E,pitch:k-F}}return{maskerEvents:{ready:f,click:r,mousedown:c,zoomUpdated:v,positionUpdated:o}}}const ve={class:"vsleem-bimsee"},W=H(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,c=e.ref(),v=fe(f,c,r),{storeRef:o,getMasker:w}=v,{getBindValue:S}=me(o,w,r),{maskerEvents:u}=pe(w,r);return p(v),(l,k)=>(e.openBlock(),e.createElementBlock("div",ve,[e.createVNode(ie,e.mergeProps({ref_key:"maskerElRef",ref:c,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(S))),void 0,!0)]))}}),[["__scopeId","data-v-348a21e7"]]);_.BIMSEE_CONFIG=X,_.Bimsee=W,_.BimseePlugin=W,_.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.1.
|
|
3
|
+
"version": "2.1.2",
|
|
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.1.
|
|
16
|
+
"@vsleem-realsee-viewer/shared": "2.1.2"
|
|
17
17
|
},
|
|
18
18
|
"peerDependencies": {
|
|
19
19
|
"vue": "^3.0.0",
|
|
20
|
-
"@vsleem-realsee-viewer/shared": "2.1.
|
|
20
|
+
"@vsleem-realsee-viewer/shared": "2.1.2"
|
|
21
21
|
},
|
|
22
22
|
"peerDependenciesMeta": {
|
|
23
23
|
"vue": {
|