@vsleem-realsee-viewer/bimsee-plugin 2.0.5 → 2.0.6

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/README.md CHANGED
@@ -1,131 +1,151 @@
1
- #
2
-
3
1
  # Bimsee BIM容器组件
4
2
 
5
3
  ## 介绍
6
4
 
7
- 用于将BIM模型展示在页面上的组件,组件包含查看器容器组件和相关交互等功能
5
+ 用于将BIM模型展示在页面上的组件,组件包含蒙层容器组件和相关交互等功能
8
6
 
9
7
  ### BimseeProps 参数说明
10
8
 
11
- | 参数名 | 类型 | 必填 | 说明 |
12
- | ------------------ | -------------------------------------------------------- | ---- | ------------------------------------- |
13
- | `viewer` | `ViewerProps?` | | 全景相关属性配置 |
14
- | `immediate` | `boolean?` | | 是否立即发起数据请求(默认:`false`) |
15
- | `delay` | `number?` | | 请求延迟时间(单位:毫秒) |
16
- | `appSetting` | `AppSetting?` | | 应用全局配置 |
17
- | `bimseeSetting` | `BimseeSetting?` | | 暂未使用 |
18
- | `searchInfo` | `SearchInfo?` | | 数据查询条件参数 |
19
- | `fetchParams` | `Record<string, any>?` | | 自定义请求参数(排除坐标系相关接口) |
20
- | `handleCheckedFn` | `(res?: Coordinate) => Promise<boolean>?` | | 处理检查模型状态 |
21
- | `handleResponseFn` | `(res?: Coordinate) => Promise<Coordinate \ undefined>?` | | 处理坐标系树响应 |
22
- | `fetchSuccess` | `(res?: Coordinate) => void?` | | 坐标系树请求成功 |
23
- | `fetchError` | `(error: any) => void?` | 否 | 请求失败回调 |
9
+ | 参数名 | 类型 | 默认值 | 说明 |
10
+ | -------------------- | ------------------------------------------------------- | --------------------------- | -------------------------- |
11
+ | `appSetting` | `AppSetting` | 请查看AppSetting类型默认值 | 应用全局配置 |
12
+ | `searchInfo` | `SearchInfo` | - | 数据查询条件参数 |
13
+ | `bimseeSetting?` | `BimseeSetting` | - | 暂未使用 |
14
+ | `masker?` | `MaskerProps` | 请查看MaskerProps类型默认值 | 蒙层相关属性配置 |
15
+ | `immediate?` | `boolean` | true | 是否立即发起数据请求 |
16
+ | `delay?` | `number` | 0 | 请求延迟时间(单位:毫秒) |
17
+ | `handleCheckModelFn` | `(res?: Coordinate) => Promise<boolean>` | - | 处理检查模型状态 |
18
+ | `handleResponseFn?` | `(res?: Coordinate) => Promise<Coordinate \ undefined>` | - | 处理坐标系树响应 |
19
+ | `fetchSuccess?` | `(res?: Coordinate) => void` | - | 坐标系树请求成功 |
20
+ | `fetchError?` | `(error: any) => void` | - | 请求失败回调 |
24
21
 
25
22
  ### SearchInfo 类型说明
26
23
 
27
- | 参数名 | 类型 | 必填 | 说明 |
28
- | ------------ | -------- | ---- | ----------------- |
29
- | `projectId` | `number` | | 项目唯一标识 |
30
- | `modelCsId?` | `number` | | bim模型坐标系标识 |
24
+ | 参数名 | 类型 | 默认值 | 说明 |
25
+ | ----------- | -------- | ------ | ----------------- |
26
+ | `projectId` | `number` | - | 项目唯一标识 |
27
+ | `modelCsId` | `number` | - | bim模型坐标系标识 |
31
28
 
32
29
  ### BimseeStore 类型说明
33
30
 
34
- | 名称 | 类型/签名 | 说明 |
35
- | ----------------------- | ---------------------------------------------------------- | ------------------------------------ |
36
- | `ready?` | `boolean` | (可选)是否加载完成 |
37
- | `coordinateTree?` | `Coordinate` | (可选)坐标系树数据 |
38
- | `mappedCoordinateTree?` | `Coordinate` | (可选)映射坐标系树数据 |
39
- | `currentModel?` | `Coordinate` | (可选)当前选中的模型坐标系 |
40
- | `currentSpace?` | `Coordinate` | (可选)当前模型所属的空间坐标系 |
41
- | `currentPoint?` | `TrackPoint` | (可选)当前选中的轨迹点 |
42
- | `reload` | `(searchInfo: SearchInfo) => Promise<void>` | 重新加载坐标系树数据 |
43
- | `selectModel` | `(coordinate: Partial<Coordinate>) => void` | 选择模型(找不到对应模型时抛出错误) |
44
- | `setPoint` | ` (point: Point, coordinate: Partial<Coordinate>) => void` | 设置参考点 |
31
+ | 属性/方法 | 类型/签名 | 说明 |
32
+ | ----------------------- | ------------------------------------------- | ------------------------------------ |
33
+ | `ready` | `boolean` | 是否加载完成 |
34
+ | `coordinateTree?` | `Coordinate` | 坐标树结构 |
35
+ | `mappedCoordinateTree?` | `Coordinate` | 映射后的坐标树结构 |
36
+ | `currentModel?` | `Coordinate` | 当前模型坐标系 |
37
+ | `currentSpace?` | `Coordinate` | 当前空间坐标系 |
38
+ | `currentPoint?` | `Point` | 当前模型的点 |
39
+ | `reload` | `(searchInfo: SearchInfo) => Promise<void>` | 重新加载数据 |
40
+ | `selectModel` | `(coordinate: Partial<Coordinate>) => void` | 选择模型(找不到对应模型时抛出错误) |
41
+ | `setModelPoint` | ` (point: Point) => void` | 设置模型的坐标点 |
45
42
 
46
43
  ### BimseeElement 实例对象
47
44
 
48
- | 方法/属性 | 类型签名 | 说明 |
45
+ | 属性/方法 | 类型签名 | 说明 |
49
46
  | ------------- | -------------------------------------------------- | -------------------------------------------------- |
50
47
  | `storeRef` | `ComputedRef<BimseeStore>` | 响应式存储对象引用 |
51
48
  | `getStore()` | `() => BimseeStore` | 获取状态管理库实例 |
52
- | `getViewer()` | `() => ViewerElement \ undefined` | 获取视图容器控制器 |
49
+ | `getMasker()` | `() => MaskerElement \ undefined` | 获取蒙层容器控制器 |
53
50
  | `getState()` | `() => BimseeProps` | 获取初始化配置(返回原始配置参数) |
54
51
  | `setState()` | `(options: Partial<UpdatableBimseeProps>) => void` | 动态更新可修改配置(注意:部分配置初始化后不可更改 |
55
52
 
56
53
  ### BimseeEvents 事件说明
57
54
 
58
- | 事件名称 | 描述 | 参数类型 |
59
- | ----------------------- | ---------------------- | ---------------------------- |
60
- | `ready` | 触发基本准备就绪事件 | () => void |
61
- | `changeModel` | 处理模型变化事件 | (model?: Coordinate) => void |
62
- | `viewerReady` | 触发查看器准备就绪事件 | () => void |
63
- | `viewerClick` | 触发查看器点击事件 | (e: any) => void |
64
- | `viewerMousedown` | 处理查看器鼠标按下事件 | (e: any) => void |
65
- | `viewerZoomUpdated` | 缩放到指定级别事件 | (e: any) => void |
66
- | `viewerPositionUpdated` | 旋转视图到指定位置事件 | (e: any) => void |
67
- | `viewerPointUpdated` | 全景图的坐标点触发事件 | (point: TrackPoint) => void |
55
+ | 事件名称 | 参数类型 | 说明 |
56
+ | ----------------------- | ------------------------------ | ---------------------- |
57
+ | `ready` | `() => void` | 基本准备就绪事件 |
58
+ | `changeModel` | `(model?: Coordinate) => void` | 模型变化事件 |
59
+ | `maskerReady` | `() => void` | 蒙层准备就绪事件 |
60
+ | `maskerClick` | `(e: any) => void` | 蒙层点击事件 |
61
+ | `maskerMousedown` | `(e: any) => void` | 蒙层鼠标按下事件 |
62
+ | `maskerZoomUpdated` | `(e: any) => void` | 蒙层缩放到指定级别事件 |
63
+ | `maskerPositionUpdated` | `(e: any) => void` | 蒙层旋转到指定位置事件 |
64
+ | `maskerPointLoaded` | `(point: TrackPoint) => void` | 蒙层的坐标点触发事件 |
68
65
 
69
66
  ### Bimsee Slot 插槽说明
70
67
 
71
- | 插槽名称 | 描述 | 参数类型 |
72
- | -------- | -------- | -------------- |
73
- | default | 默认插槽 | (slot) => void |
68
+ | 插槽名称 | 参数类型 | 说明 |
69
+ | --------- | ---------------------- | -------- |
70
+ | `default` | `(slot) => void` | 默认插槽 |
71
+ | `masker` | `(maskerSlot) => void` | 蒙层插槽 |
74
72
 
75
- #
73
+ ```
74
+ type slot = {
75
+ coordinateTree: Coordinate | undefined;
76
+ mappedCoordinateTree: Coordinate | undefined;
77
+ currentSpace: Coordinate | undefined;
78
+ currentModel: Coordinate | undefined;
79
+ currentPoint: Point | undefined;
80
+ }
81
+ type maskerSlot =slot & {
82
+ cameraStatus: CameraStatus | undefined;
83
+ state: Required<Partial<MaskerProps>>;
84
+ }
85
+ ```
76
86
 
77
- # Viewer 查看器组件
87
+ # Masker 蒙层组件
78
88
 
79
89
  ## 介绍
80
90
 
81
- ### ViewerProps 类型说明
82
-
83
- | 参数名 | 类型 | 必填 | 说明 |
84
- | ---------------- | --------- | ---- | ---------------------- |
85
- | `defaultYaw` | `number` | | 默认偏航角(球面基准) |
86
- | `defaultPitch` | `number` | | 默认俯仰角(球面基准) |
87
- | `defaultZoomLvl` | `number` | | 默认缩放级别(球面基准) |
88
- | `minFov` | `number` | | 最小视野角度 |
89
- | `maxFov` | `number` | | 最大视野角度 |
90
- | `mouseover` | `boolean` | | 鼠标hover |
91
- | `mousedown` | `boolean` | | 鼠标按下 |
92
-
93
- ### ViewerElement 实例对象
94
-
95
- | 方法/属性 | 类型签名 | 说明 |
96
- | ------------------- | ----------------------------------------------------------------- | ----------------------- |
97
- | `isMouseover` | `() => boolean` | 检查鼠标是否悬停 |
98
- | `isMousedown` | `() => boolean` | 检查鼠标是否按下 |
99
- | `setState` | `(options?: Partial<ViewerProps>) => void` | 更新查看器配置选项 |
100
- | `setMousedown` | `(mousedown: boolean) => void` | 设置鼠标按下状态 |
101
- | `setMouseover` | `(mouseover: boolean) => void` | 设置鼠标悬停状态 |
102
- | `setMinFov` | `(minFov: number) => void` | 设置最小视野 |
103
- | `setMaxFov` | `(maxFov: number) => void` | 设置最大视野 |
104
- | `zoom` | `(level: number) => void` | 缩放到指定级别 |
105
- | `rotate` | `(position: Position) => void` | 旋转视图到指定位置 |
106
- | `getState` | `() => () => ViewerProps` | 获取当前查看器状态 |
107
- | `getPosition` | `() => () => Position` | 获取当前位置(yaw/pitch) |
108
- | `getZoomLevel` | `() => () => number` | 获取当前缩放级别 |
109
- | `getCameraPosition` | `() => () => Vector3 \| undefined` | 获取当前相机位置 |
110
- | `getCameraTarget` | `() => () => Vector3 \| undefined` | 获取当前相机视角 |
111
- | `getCameraFov` | `() => () => number \| undefined` | 获取当前相机视野角度 |
112
- | `getCameraStatus` | `() => () => CameraStatus \| undefined` | 获取相机状态 |
113
- | `rotateToTarget` | `(rotate?: Position, position?: Vector3) => Vector3 \| undefined` | 球面坐标转目标点坐标 |
114
- | `fovToZoomLevel` | `(fov: number) => number` | 视野转缩放级别 |
115
- | `zoomLevelToFov` | `(level: number) => number` | 缩放级别转视野角度 |
116
-
117
- ### ViewerEvents 事件说明
118
-
119
- | 事件名称 | 描述 | 参数类型 |
120
- | ----------------- | -------------------------------- | --------------------------- |
121
- | `ready` | 触发查看器准备就绪事件 | () => void |
122
- | `click` | 处理查看器点击事件 | (e: any) => void |
123
- | `mousedown` | 处理查看器鼠标按下事件并折叠地图 | (e: any) => void |
124
- | `zoomUpdated` | 缩放到指定级别事件 | (e: any) => void |
125
- | `positionUpdated` | 旋转视图到指定位置事件 | (e: any) => void |
126
- | `pointUpdated` | 设置全景图的坐标点事件 | (point: TrackPoint) => void |
127
-
128
- #
91
+ ### MaskerProps 类型说明
92
+
93
+ | 参数名 | 类型 | 默认值 | 说明 |
94
+ | ------------------ | --------------------- | ------ | ---------------------- |
95
+ | `visible?` | `boolean` | true | 是否可见 |
96
+ | `defaultYaw?` | `number` | 0 | 默认偏航角(球面基准) |
97
+ | `defaultPitch?` | `number` | 0 | 默认俯仰角(球面基准) |
98
+ | `defaultZoomLvl?` | `number` | 30 | 默认缩放级别(球面基准) |
99
+ | `referPoint?` | `Point` | - | 参考点 |
100
+ | `referCoordinate?` | `Partial<Coordinate>` | - | 参考点坐标系 |
101
+ | `minFov?` | `number` | 20 | 最小视野角度 |
102
+ | `maxFov?` | `number` | 120 | 最大视野角度 |
103
+ | `mouseover?` | `boolean` | - | 鼠标悬浮 |
104
+ | `mousedown?` | `boolean` | - | 鼠标按下 |
105
+
106
+ ### MaskerElement 实例对象
107
+
108
+ | 方法/属性 | 类型签名 | 说明 |
109
+ | ------------------- | --------------------------------------------------------- | ------------------------ |
110
+ | `dataHelper` | `DataHelper` | 用于蒙层的数据转换器集合 |
111
+ | `isMouseover` | `() => boolean` | 检查鼠标是否悬停 |
112
+ | `isMousedown` | `() => boolean` | 检查鼠标是否按下 |
113
+ | `setState` | `(options?: Partial<MaskerProps>) => void` | 更新蒙层配置选项 |
114
+ | `setMousedown` | `(mousedown: boolean) => void` | 设置鼠标按下状态 |
115
+ | `setMouseover` | `(mouseover: boolean) => void` | 设置鼠标悬停状态 |
116
+ | `setMinFov` | `(minFov: number) => void` | 设置最小视野 |
117
+ | `setMaxFov` | `(maxFov: number) => void` | 设置最大视野 |
118
+ | `setReferPoint` | `(point: Point, coordinate: Partial<Coordinate>) => void` | 设置参考点 |
119
+ | `zoom` | `(level: number) => void` | 缩放到指定级别 |
120
+ | `rotate` | `(position: Position) => void` | 旋转蒙层到指定位置 |
121
+ | `getState` | ` () => MaskerProps` | 获取当前蒙层状态 |
122
+ | `getPosition` | `() => Position` | 获取当前位置(yaw/pitch) |
123
+ | `getZoomLevel` | ` () => number` | 获取当前缩放级别 |
124
+ | `getCameraPosition` | `() => Vector3 \ undefined` | 获取当前相机位置 |
125
+ | `getCameraTarget` | `() => Vector3 \ undefined` | 获取当前相机视角 |
126
+ | `getCameraFov` | `() => number \ undefined` | 获取当前相机视野角度 |
127
+ | `getCameraStatus` | `() => CameraStatus \ undefined` | 获取相机状态 |
128
+
129
+ ### DataHelper 数据转换对象
130
+
131
+ | 属性 | 类型 | 描述 |
132
+ | ---------------------------- | ------------------------------------------------------------- | ------------------------------------ |
133
+ | `referPointToModelPoint` | `(point: Point, coordinate: Coordinate) => Point \ undefined` | 将参考点坐标转当前模型的坐标 |
134
+ | `modelPointToCameraPosition` | `(point: Point) => Vector3` | 将当前模型的坐标转成三维相机位置坐标 |
135
+ | `maskerRotateToCameraTarget` | `(rotate: Position, position: Vector3) => Vector3` | 将球面坐标转换为三维目标点坐标 |
136
+ | `fovToZoomLevel` | `(fov: number) => number` | 将视野转换为缩放级别 |
137
+ | `zoomLevelToFov` | `(level: number) => number` | 将缩放级别转换为视野 |
138
+
139
+ ### MaskerEvents 事件说明
140
+
141
+ | 事件名称 | 描述 | 参数类型 |
142
+ | ----------------- | ---------------------- | --------------------------- |
143
+ | `ready` | 蒙层准备就绪事件 | () => void |
144
+ | `click` | 蒙层点击事件 | (e: any) => void |
145
+ | `mousedown` | 蒙层鼠标按下事件 | (e: any) => void |
146
+ | `zoomUpdated` | 蒙层缩放到指定级别事件 | (e: any) => void |
147
+ | `positionUpdated` | 蒙层旋转到指定位置事件 | (e: any) => void |
148
+ | `pointLoaded` | 蒙层坐标点触发事件 | (point: TrackPoint) => void |
129
149
 
130
150
  # 导出的类型声明对象
131
151
 
@@ -145,24 +165,31 @@ export type {
145
165
  BimseeElement, // Bimsee 元素类型
146
166
  BimseeStore, // Bimsee 状态管理元素类型
147
167
 
148
- //查看器相关
149
- UpdatableViewerProps, // 可更新的查看器属性
150
- ViewerProps, // 查看器属性
151
- ViewerElement, // 查看器元素类型
168
+ //蒙层相关
169
+ UpdatableMaskerProps, // 可更新的蒙层属性
170
+ MaskerProps, // 蒙层属性
171
+ MaskerElement, // 蒙层元素类型
152
172
  } from '@vsleem-realsee-viewer/bimsee-plugin';
153
173
 
154
174
  export {
155
175
  BIMSEE_CONFIG, // Realsee 默认设置
156
- VIEWER_CONFIG, // 查看器默认配置
176
+ MASKER_CONFIG, // 蒙层默认配置
157
177
  } from '@vsleem-realsee-viewer/bimsee-plugin';
158
178
 
159
179
  ```
160
180
 
161
- #
181
+ # 示例
162
182
 
163
- ## 示例
183
+ 通过以下方式来注册组件
164
184
 
165
- ```
185
+ ### 安装
166
186
 
167
- 通过以下方式来注册组件
168
- ```
187
+ `npm install @vsleem-realsee-viewer/bimsee-plugin @vsleem-realsee-viewer/shared`
188
+
189
+ `pnpm add @vsleem-realsee-viewer/bimsee-plugin @vsleem-realsee-viewer/shared`
190
+
191
+ ### 例子
192
+
193
+ `vsleem-realsee-demo仓库下的DualseePlugin.vue`
194
+
195
+ 仓库地址:https://gitee.com/yangleistudio/vsleem-realsee-demo
@@ -189,7 +189,6 @@ declare const __VLS_component: import('vue').DefineComponent<BimseeProps, {
189
189
  "onChange-model"?: ((...args: any[]) => any) | undefined;
190
190
  }>, {
191
191
  immediate: boolean;
192
- appSetting: import('@vsleem-realsee-viewer/shared').AppSetting;
193
192
  masker: import('..').MaskerProps;
194
193
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
195
194
  maskerElRef: ({
package/dist/index.css CHANGED
@@ -1 +1 @@
1
- .vsleem-bimsee-masker[data-v-ab1804ce]{position:relative;width:100%;height:100%}.bimsee-masker-full[data-v-ab1804ce]{position:absolute;top:0;left:0;width:100%;height:100%;z-index:200;cursor:all-scroll}.vsleem-bimsee[data-v-cf5278c3]{position:relative;width:100%;height:100%}
1
+ .vsleem-bimsee-masker[data-v-ab1804ce]{position:relative;width:100%;height:100%}.bimsee-masker-full[data-v-ab1804ce]{position:absolute;top:0;left:0;width:100%;height:100%;z-index:200;cursor:all-scroll}.vsleem-bimsee[data-v-03ae1278]{position:relative;width:100%;height:100%}
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { ref as g, computed as I, watch as te, unref as T, defineComponent as oe, onMounted as ne, onBeforeUnmount as Te, createElementBlock as ae, openBlock as U, withDirectives as Ce, renderSlot as X, createElementVNode as Ee, vShow as Le, normalizeProps as G, guardReactiveProps as j, createBlock as _e, createCommentVNode as Ie, mergeProps as be, toHandlers as Fe, withCtx as Be } from "vue";
2
- import { APP_SETTING as re, utils as se, Position as A, Vector3 as Q, Point as ee, CoordinateModelType as Ne, AppError as O, DataSource as Re, http as xe } from "@vsleem-realsee-viewer/shared";
1
+ import { ref as g, computed as I, watch as te, unref as T, defineComponent as oe, onMounted as ne, onBeforeUnmount as ke, createElementBlock as ae, openBlock as U, withDirectives as Te, renderSlot as X, createElementVNode as Ce, vShow as Ee, normalizeProps as G, guardReactiveProps as j, createBlock as Le, createCommentVNode as _e, mergeProps as Ie, toHandlers as be, withCtx as Fe } from "vue";
2
+ import { APP_SETTING as Be, utils as re, Position as A, Vector3 as Q, Point as ee, CoordinateModelType as Ne, AppError as O, DataSource as Re, http as xe } from "@vsleem-realsee-viewer/shared";
3
3
  const H = {
4
4
  visible: !0,
5
5
  //是否可见
@@ -14,12 +14,12 @@ const H = {
14
14
  maxFov: 120
15
15
  // 最大视野角度
16
16
  }, ze = {
17
- appSetting: re,
17
+ appSetting: Be,
18
18
  //全局设置
19
19
  masker: H,
20
20
  immediate: !0
21
21
  // 是否立即生效
22
- }, { cloneDeep: Ye, deepMergeProps: De } = se;
22
+ }, { cloneDeep: Ye, deepMergeProps: De } = re;
23
23
  function $e(o, n, v, s) {
24
24
  const d = g(Ye(H)), r = g(), m = g(), a = I(() => d.value), w = I(() => {
25
25
  const { coordinateTree: e, mappedCoordinateTree: t, currentSpace: i, currentModel: c, currentPoint: l } = n.value || {};
@@ -97,26 +97,26 @@ function $e(o, n, v, s) {
97
97
  function z() {
98
98
  return a.value;
99
99
  }
100
- function ie() {
100
+ function ue() {
101
101
  const { defaultYaw: e, defaultPitch: t } = a.value;
102
102
  return { yaw: e, pitch: t };
103
103
  }
104
- function ce() {
104
+ function ie() {
105
105
  return a.value.defaultZoomLvl;
106
106
  }
107
- function de() {
107
+ function ce() {
108
108
  return r.value?.position;
109
109
  }
110
- function le() {
110
+ function de() {
111
111
  return r.value?.fov;
112
112
  }
113
- function me() {
113
+ function le() {
114
114
  return r.value?.target;
115
115
  }
116
116
  function q() {
117
117
  return r.value;
118
118
  }
119
- function ve() {
119
+ function me() {
120
120
  return a.value?.mouseover ?? !1;
121
121
  }
122
122
  function K() {
@@ -134,13 +134,13 @@ function $e(o, n, v, s) {
134
134
  function V(e) {
135
135
  _({ mousedown: e });
136
136
  }
137
- function fe(e) {
137
+ function ve(e) {
138
138
  _({ minFov: e });
139
139
  }
140
- function pe(e) {
140
+ function fe(e) {
141
141
  _({ maxFov: e });
142
142
  }
143
- function he(e, t) {
143
+ function pe(e, t) {
144
144
  _({ referPoint: e, referCoordinate: t }), y();
145
145
  }
146
146
  function W(e) {
@@ -153,7 +153,7 @@ function $e(o, n, v, s) {
153
153
  const t = b.zoomLevelToFov(e);
154
154
  _({ defaultZoomLvl: e }), D({ fov: t }), s("zoom-updated", { zoomLevel: e, fov: t });
155
155
  }
156
- function we(e, t) {
156
+ function he(e, t) {
157
157
  const { coordinateTree: i, currentModel: c } = n.value;
158
158
  if (c) {
159
159
  const l = i?.findCsById(t?.id), p = l?.getDestRelativeMap(c);
@@ -166,50 +166,50 @@ function $e(o, n, v, s) {
166
166
  return new ee({ ...L, y: -F });
167
167
  }
168
168
  }
169
- function Me(e) {
169
+ function we(e) {
170
170
  return new Q(e);
171
171
  }
172
- function Pe(e, t) {
173
- const { x: i = 0, y: c = 0, z: l = 0 } = t, { yaw: p, pitch: L } = e, F = -p, R = L, x = 100, B = 0, Z = x * Math.cos(B + F) + i, Se = x * Math.sin(B + F) + c, ke = x * Math.tan(R) + l;
174
- return new Q({ x: Z, y: Se, z: ke });
172
+ function Me(e, t) {
173
+ const { x: i = 0, y: c = 0, z: l = 0 } = t, { yaw: p, pitch: L } = e, F = -p, R = L, x = 100, B = 0, Z = x * Math.cos(B + F) + i, ge = x * Math.sin(B + F) + c, Se = x * Math.tan(R) + l;
174
+ return new Q({ x: Z, y: ge, z: Se });
175
175
  }
176
- function ye(e) {
176
+ function Pe(e) {
177
177
  const { minFov: t = 20, maxFov: i = 120 } = a.value, l = 100 - (Math.max(t, Math.min(i, e)) - t) / (i - t) * 100;
178
178
  return Math.max(0, Math.min(100, Math.round(l)));
179
179
  }
180
- function ge(e) {
180
+ function ye(e) {
181
181
  const { minFov: t = 20, maxFov: i = 120 } = a.value;
182
182
  let c = i + e / 100 * (t - i);
183
183
  return Math.max(t, Math.min(i, c));
184
184
  }
185
185
  const b = {
186
- referPointToModelPoint: we,
187
- modelPointToCameraPosition: Me,
188
- maskerRotateToCameraTarget: Pe,
189
- fovToZoomLevel: ye,
190
- zoomLevelToFov: ge
186
+ referPointToModelPoint: he,
187
+ modelPointToCameraPosition: we,
188
+ maskerRotateToCameraTarget: Me,
189
+ fovToZoomLevel: Pe,
190
+ zoomLevelToFov: ye
191
191
  };
192
192
  return {
193
193
  getProps: a,
194
194
  getBindValue: w,
195
195
  maskerAction: {
196
196
  dataHelper: b,
197
- isMouseover: ve,
197
+ isMouseover: me,
198
198
  isMousedown: K,
199
199
  setState: _,
200
200
  setMousedown: V,
201
201
  setMouseover: $,
202
- setMinFov: fe,
203
- setMaxFov: pe,
204
- setReferPoint: he,
202
+ setMinFov: ve,
203
+ setMaxFov: fe,
204
+ setReferPoint: pe,
205
205
  zoom: J,
206
206
  rotate: W,
207
207
  getState: z,
208
- getPosition: ie,
209
- getZoomLevel: ce,
210
- getCameraPosition: de,
211
- getCameraTarget: me,
212
- getCameraFov: le,
208
+ getPosition: ue,
209
+ getZoomLevel: ie,
210
+ getCameraPosition: ce,
211
+ getCameraTarget: le,
212
+ getCameraFov: de,
213
213
  getCameraStatus: q
214
214
  },
215
215
  handleReady: M,
@@ -237,23 +237,23 @@ const Ve = { class: "vsleem-bimsee-masker" }, Ze = /* @__PURE__ */ oe({
237
237
  r,
238
238
  d
239
239
  );
240
- return ne(u), Te(f), n(C), (h, P) => (U(), ae("div", Ve, [
241
- Ce(Ee("div", {
240
+ return ne(u), ke(f), n(C), (h, P) => (U(), ae("div", Ve, [
241
+ Te(Ce("div", {
242
242
  ref_key: "maskerElRef",
243
243
  ref: r,
244
244
  class: "bimsee-masker-full"
245
245
  }, null, 512), [
246
- [Le, T(w).visible]
246
+ [Ee, T(w).visible]
247
247
  ]),
248
248
  X(h.$slots, "default", G(j(T(M))), void 0, !0)
249
249
  ]));
250
250
  }
251
- }), ue = (o, n) => {
251
+ }), se = (o, n) => {
252
252
  const v = o.__vccOpts || o;
253
253
  for (const [s, d] of n)
254
254
  v[s] = d;
255
255
  return v;
256
- }, Ae = /* @__PURE__ */ ue(Ze, [["__scopeId", "data-v-ab1804ce"]]);
256
+ }, Ae = /* @__PURE__ */ se(Ze, [["__scopeId", "data-v-ab1804ce"]]);
257
257
  var Y = /* @__PURE__ */ ((o) => (o[o.StoreMissParams = 11e3] = "StoreMissParams", o[o.StoreNoCSTree = 11001] = "StoreNoCSTree", o[o.StoreSelectNoBIMModel = 11002] = "StoreSelectNoBIMModel", o))(Y || {});
258
258
  function Oe(o) {
259
259
  const n = g(), v = g(), s = g(!1), d = g(!1), r = g(), m = g(), a = I(() => n.value?.findCsById(r.value)), w = I(() => a.value?.findParentSpace());
@@ -319,7 +319,7 @@ function Oe(o) {
319
319
  setReady: C
320
320
  };
321
321
  }
322
- const { cloneDeep: Ue, deepMergeProps: Xe } = se;
322
+ const { cloneDeep: Ue, deepMergeProps: Xe } = re;
323
323
  function Ge(o, n, v) {
324
324
  const s = g(Ue(ze)), d = I(() => s.value);
325
325
  te(() => o, C, { immediate: !0, deep: !0 });
@@ -401,13 +401,13 @@ const qe = { class: "vsleem-bimsee" }, Ke = /* @__PURE__ */ oe({
401
401
  name: "Bimsee",
402
402
  __name: "Bimsee",
403
403
  props: {
404
- appSetting: { default: () => re },
405
- bimseeSetting: {},
404
+ appSetting: {},
406
405
  searchInfo: {},
406
+ bimseeSetting: {},
407
407
  masker: { default: () => H },
408
408
  immediate: { type: Boolean, default: !0 },
409
409
  delay: {},
410
- handleCheckedFn: {},
410
+ handleCheckModelFn: {},
411
411
  handleResponseFn: {},
412
412
  fetchSuccess: {},
413
413
  fetchError: {}
@@ -425,22 +425,22 @@ const qe = { class: "vsleem-bimsee" }, Ke = /* @__PURE__ */ oe({
425
425
  setup(o, { expose: n, emit: v }) {
426
426
  const s = o, d = v, r = g(), m = Ge(s, r, d), { storeRef: a, getMasker: w } = m, { getShow: M, getBindValue: C } = je(a), { maskerEvents: u } = He(w, d);
427
427
  return n(m), (f, h) => (U(), ae("div", qe, [
428
- T(M) ? (U(), _e(Ae, be({
428
+ T(M) ? (U(), Le(Ae, Ie({
429
429
  key: 0,
430
430
  ref_key: "maskerElRef",
431
431
  ref: r,
432
432
  bimseeProps: s,
433
433
  bimseeStore: T(a)
434
- }, Fe(T(u))), {
435
- default: Be((P) => [
434
+ }, be(T(u))), {
435
+ default: Fe((P) => [
436
436
  X(f.$slots, "masker", G(j(P)), void 0, !0)
437
437
  ]),
438
438
  _: 3
439
- }, 16, ["bimseeStore"])) : Ie("", !0),
439
+ }, 16, ["bimseeStore"])) : _e("", !0),
440
440
  X(f.$slots, "default", G(j(T(C))), void 0, !0)
441
441
  ]));
442
442
  }
443
- }), et = /* @__PURE__ */ ue(Ke, [["__scopeId", "data-v-cf5278c3"]]);
443
+ }), et = /* @__PURE__ */ se(Ke, [["__scopeId", "data-v-03ae1278"]]);
444
444
  export {
445
445
  ze as BIMSEE_CONFIG,
446
446
  et as Bimsee,
package/dist/index.umd.js CHANGED
@@ -1 +1 @@
1
- (function(E,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):(E=typeof globalThis<"u"?globalThis:E||self,e(E.BimseePlugin={},E.Vue,E.VSLeemShared))})(this,(function(E,e,h){"use strict";const x={visible:!0,defaultYaw:0,defaultPitch:0,defaultZoomLvl:30,minFov:20,maxFov:120},G={appSetting:h.APP_SETTING,masker:x,immediate:!0},{cloneDeep:K,deepMergeProps:W}=h.utils;function J(n,a,p,i){const l=e.ref(K(x)),s=e.ref(),f=e.ref(),r=e.computed(()=>l.value),P=e.computed(()=>{const{coordinateTree:t,mappedCoordinateTree:o,currentSpace:u,currentModel:d,currentPoint:m}=a.value||{};return{coordinateTree:t,mappedCoordinateTree:o,currentSpace:u,currentModel:d,currentPoint:m,cameraStatus:s.value,state:r.value}});e.watch(()=>e.unref(n)?.masker,L,{immediate:!0});function S(){c(),g(),i("ready",X(),D())}function C(){v()}function c(){const t=e.unref(p);t&&(t.addEventListener("mousedown",M),t.addEventListener("touchstart",M),window.addEventListener("mousemove",y),window.addEventListener("touchmove",y),window.addEventListener("mouseup",_),window.addEventListener("touchend",_),t.addEventListener("mouseover",k),t.addEventListener("mouseout",T),t.addEventListener("wheel",N))}function v(){const t=e.unref(p);t&&(t.removeEventListener("mousedown",M),t.removeEventListener("touchstart",M),window.removeEventListener("mousemove",y),window.removeEventListener("touchmove",y),window.removeEventListener("mouseup",_),window.removeEventListener("touchend",_),t.removeEventListener("mouseover",k),t.removeEventListener("mouseout",T),t.removeEventListener("wheel",N))}function M(t){const o=t instanceof TouchEvent?t.touches[0]:t,{defaultYaw:u=0,defaultPitch:d=0}=r.value,m=Number(u)-Number(a.value.currentPoint?.yaw||0);f.value={pageX:o.pageX,pageY:o.pageY,defaultYaw:m,defaultPitch:d},$(!0),i("mousedown",t)}function y(t){if(!f.value||!j())return;const o=t instanceof TouchEvent?t.touches[0]:t,{pageX:u,pageY:d}=o,{pageX:m,pageY:w}=f.value,{defaultYaw:I=0,defaultPitch:B=0}=f.value,R=Math.PI*.15/180;let z=(Number(I)-(u-m)*R)%(2*Math.PI),F=(Number(B)+(d-w)*R)%(2*Math.PI);F=Math.max(-Math.PI/2,Math.min(Math.PI/2,F));const O=new h.Position({yaw:z,pitch:F});q(O)}function _(){$(!1),f.value=void 0}function k(){V(!0)}function T(){V(!1)}function N(t){t.preventDefault(),t.stopPropagation();const o=Math.sign(t.deltaY)*5;if(o===0)return;const{minFov:u=0,maxFov:d=0}=r.value,{fov:m=0}=s.value||{},w=Math.min(Math.max(m+o,u),d);w!==m&&H(b.fovToZoomLevel(w))}function g(){const{defaultYaw:t=0,defaultPitch:o=0,defaultZoomLvl:u=0,referPoint:d,referCoordinate:m}=r.value,w=b.referPointToModelPoint(d,m);if(w){const I=Number(t)+(w?.yaw||0),B=new h.Position({yaw:Number(I),pitch:Number(o)}),R=b.modelPointToCameraPosition(w),z=b.maskerRotateToCameraTarget(B,R),F=b.zoomLevelToFov(u);a.value.setModelPoint(w),A({position:R,target:z,fov:F}),L({defaultYaw:t}),i("point-loaded",w)}}function D(){return r.value}function ue(){const{defaultYaw:t,defaultPitch:o}=r.value;return{yaw:t,pitch:o}}function de(){return r.value.defaultZoomLvl}function le(){return s.value?.position}function me(){return s.value?.fov}function fe(){return s.value?.target}function X(){return s.value}function pe(){return r.value?.mouseover??!1}function j(){return r.value?.mousedown??!1}function L(t){t&&W(l.value,t)}function A(t){s.value={...s.value,...t}}function V(t){L({mouseover:t})}function $(t){L({mousedown:t})}function ve(t){L({minFov:t})}function he(t){L({maxFov:t})}function we(t,o){L({referPoint:t,referCoordinate:o}),g()}function q(t){const o=s.value?.position;if(!o)return;const{yaw:u,pitch:d}=t,m=Number(a.value.currentPoint?.yaw||0)+u,w=new h.Position({yaw:Number(m),pitch:Number(d)}),I=b.maskerRotateToCameraTarget(w,o);L({defaultYaw:m,defaultPitch:d}),A({target:I}),i("position-updated",{position:t,target:I})}function H(t){const o=b.zoomLevelToFov(t);L({defaultZoomLvl:t}),A({fov:o}),i("zoom-updated",{zoomLevel:t,fov:o})}function Me(t,o){const{coordinateTree:u,currentModel:d}=a.value;if(d){const m=u?.findCsById(o?.id),w=m?.getDestRelativeMap(d);if(!w)return;const I=new h.Point(t).projection(w,m,d),{y:B=0}=I||{};return new h.Point({...I,y:-B})}}function Pe(t){return new h.Vector3(t)}function Se(t,o){const{x:u=0,y:d=0,z:m=0}=o,{yaw:w,pitch:I}=t,B=-w,R=I,z=100,F=0,O=z*Math.cos(F+B)+u,ke=z*Math.sin(F+B)+d,Te=z*Math.tan(R)+m;return new h.Vector3({x:O,y:ke,z:Te})}function ye(t){const{minFov:o=20,maxFov:u=120}=r.value,m=100-(Math.max(o,Math.min(u,t))-o)/(u-o)*100;return Math.max(0,Math.min(100,Math.round(m)))}function ge(t){const{minFov:o=20,maxFov:u=120}=r.value;let d=u+t/100*(o-u);return Math.max(o,Math.min(u,d))}const b={referPointToModelPoint:Me,modelPointToCameraPosition:Pe,maskerRotateToCameraTarget:Se,fovToZoomLevel:ye,zoomLevelToFov:ge};return{getProps:r,getBindValue:P,maskerAction:{dataHelper:b,isMouseover:pe,isMousedown:j,setState:L,setMousedown:$,setMouseover:V,setMinFov:ve,setMaxFov:he,setReferPoint:we,zoom:H,rotate:q,getState:D,getPosition:ue,getZoomLevel:de,getCameraPosition:le,getCameraTarget:fe,getCameraFov:me,getCameraStatus:X},handleReady:S,handleDestroy:C}}const Q={class:"vsleem-bimsee-masker"},ee=e.defineComponent({__name:"Masker",props:{bimseeProps:{},bimseeStore:{}},emits:["ready","click","mousedown","zoom-updated","position-updated","point-loaded"],setup(n,{expose:a,emit:p}){const i=n,l=p,s=e.ref(),f=e.computed(()=>i.bimseeProps),r=e.computed(()=>i.bimseeStore),{getProps:P,getBindValue:S,maskerAction:C,handleReady:c,handleDestroy:v}=J(f,r,s,l);return e.onMounted(c),e.onBeforeUnmount(v),a(C),(M,y)=>(e.openBlock(),e.createElementBlock("div",Q,[e.withDirectives(e.createElementVNode("div",{ref_key:"maskerElRef",ref:s,class:"bimsee-masker-full"},null,512),[[e.vShow,e.unref(P).visible]]),e.renderSlot(M.$slots,"default",e.normalizeProps(e.guardReactiveProps(e.unref(S))),void 0,!0)]))}}),Z=(n,a)=>{const p=n.__vccOpts||n;for(const[i,l]of a)p[i]=l;return p},te=Z(ee,[["__scopeId","data-v-ab1804ce"]]);var Y=(n=>(n[n.StoreMissParams=11e3]="StoreMissParams",n[n.StoreNoCSTree=11001]="StoreNoCSTree",n[n.StoreSelectNoBIMModel=11002]="StoreSelectNoBIMModel",n))(Y||{});function oe(n){const a=e.ref(),p=e.ref(),i=e.ref(!1),l=e.ref(!1),s=e.ref(),f=e.ref(),r=e.computed(()=>a.value?.findCsById(s.value)),P=e.computed(()=>r.value?.findParentSpace());async function S(k){const{projectId:T,modelCsId:N}=k||{};try{if(!T)throw new h.AppError(Y.StoreMissParams,"缺少必要的查询参数");i.value=!0;let g=await h.DataSource.getCoordinateTree(T);if(g=await n.value.handleResponseFn?.(g)||g,!g)throw new h.AppError(Y.StoreNoCSTree,`未查询到坐标系ID为 ${N} 的坐标系树`);const D=g.findCsById(N);a.value=g,p.value=D?.getMappedCsTree(),c({modelCsId:N}),n.value.fetchSuccess?.(g)}catch(g){console.error(g),n.value.fetchError?.(g)}finally{i.value=!1}}function C(k=!1){l.value=k}function c(k){const{modelCsId:T}=k;T&&v({id:T})}function v(k){const{id:T}=k;if(a.value?.findCsById(T)?.modelType===h.CoordinateModelType.BIMModel)s.value=T;else throw new h.AppError(Y.StoreSelectNoBIMModel,`未找到ID为 ${T} 的BIM模型坐标系`)}function M(k){f.value=k}function y(){return _.value}const _=e.computed(()=>({ready:l.value,coordinateTree:a.value,mappedCoordinateTree:p.value,currentPoint:f.value,currentSpace:P.value,currentModel:r.value,reload:S,selectModel:v,setModelPoint:M}));return{storeRef:_,getStore:y,setReady:C}}const{cloneDeep:ne,deepMergeProps:ae}=h.utils;function re(n,a,p){const i=e.ref(ne(G)),l=e.computed(()=>i.value);e.watch(()=>n,C,{immediate:!0,deep:!0});const{storeRef:s,getStore:f,setReady:r}=oe(l);e.onMounted(P);async function P(){const{appSetting:v,searchInfo:M,immediate:y,delay:_=0}=e.unref(l);v&&h.http.setRequestGlobalConfig(v),y&&M&&(await s.value?.reload(M),setTimeout(()=>{r(!0),p?.("ready")},_))}function S(){return e.unref(l)}function C(v){v&&ae(i.value,v)}function c(){return a.value}return{storeRef:s,getStore:f,getMasker:c,getState:S,setState:C}}function se(n,a,p){const i=e.computed(()=>n.value.ready&&!!n.value.currentModel),l=e.computed(()=>{const{coordinateTree:s,mappedCoordinateTree:f,currentSpace:r,currentModel:P,currentPoint:S}=n.value||{};return{coordinateTree:s,mappedCoordinateTree:f,currentSpace:r,currentModel:P,currentPoint:S}});return{getShow:i,getBindValue:l}}function ie(n,a){const p=e.ref({yaw:0,pitch:0});function i(){a("masker-ready")}function l(c){a("masker-click",c)}function s(c){a("masker-mousedown",c)}function f(c){a("masker-zoom-updated",c)}function r(c){a("masker-position-updated",c,S(c))}function P(c){a("masker-point-loaded",c)}function S(c){const{yaw:v,pitch:M}=c.position,{yaw:y,pitch:_}=e.unref(p);return p.value={yaw:v,pitch:M},{yaw:v-y,pitch:M-_}}return{maskerEvents:{ready:i,click:l,mousedown:s,zoomUpdated:f,positionUpdated:r,pointLoaded:P}}}const ce={class:"vsleem-bimsee"},U=Z(e.defineComponent({name:"Bimsee",__name:"Bimsee",props:{appSetting:{default:()=>h.APP_SETTING},bimseeSetting:{},searchInfo:{},masker:{default:()=>x},immediate:{type:Boolean,default:!0},delay:{},handleCheckedFn:{},handleResponseFn:{},fetchSuccess:{},fetchError:{}},emits:["ready","change-model","masker-ready","masker-click","masker-mousedown","masker-zoom-updated","masker-position-updated","masker-point-loaded"],setup(n,{expose:a,emit:p}){const i=n,l=p,s=e.ref(),f=re(i,s,l),{storeRef:r,getMasker:P}=f,{getShow:S,getBindValue:C}=se(r),{maskerEvents:c}=ie(P,l);return a(f),(v,M)=>(e.openBlock(),e.createElementBlock("div",ce,[e.unref(S)?(e.openBlock(),e.createBlock(te,e.mergeProps({key:0,ref_key:"maskerElRef",ref:s,bimseeProps:i,bimseeStore:e.unref(r)},e.toHandlers(e.unref(c))),{default:e.withCtx(y=>[e.renderSlot(v.$slots,"masker",e.normalizeProps(e.guardReactiveProps(y)),void 0,!0)]),_:3},16,["bimseeStore"])):e.createCommentVNode("",!0),e.renderSlot(v.$slots,"default",e.normalizeProps(e.guardReactiveProps(e.unref(C))),void 0,!0)]))}}),[["__scopeId","data-v-cf5278c3"]]);E.BIMSEE_CONFIG=G,E.Bimsee=U,E.BimseePlugin=U,E.MASKER_CONFIG=x,Object.defineProperty(E,Symbol.toStringTag,{value:"Module"})}));
1
+ (function(E,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):(E=typeof globalThis<"u"?globalThis:E||self,e(E.BimseePlugin={},E.Vue,E.VSLeemShared))})(this,(function(E,e,w){"use strict";const x={visible:!0,defaultYaw:0,defaultPitch:0,defaultZoomLvl:30,minFov:20,maxFov:120},Z={appSetting:w.APP_SETTING,masker:x,immediate:!0},{cloneDeep:K,deepMergeProps:W}=w.utils;function J(n,a,p,i){const l=e.ref(K(x)),s=e.ref(),f=e.ref(),r=e.computed(()=>l.value),P=e.computed(()=>{const{coordinateTree:t,mappedCoordinateTree:o,currentSpace:u,currentModel:d,currentPoint:m}=a.value||{};return{coordinateTree:t,mappedCoordinateTree:o,currentSpace:u,currentModel:d,currentPoint:m,cameraStatus:s.value,state:r.value}});e.watch(()=>e.unref(n)?.masker,I,{immediate:!0});function S(){c(),g(),i("ready",X(),D())}function C(){v()}function c(){const t=e.unref(p);t&&(t.addEventListener("mousedown",M),t.addEventListener("touchstart",M),window.addEventListener("mousemove",y),window.addEventListener("touchmove",y),window.addEventListener("mouseup",_),window.addEventListener("touchend",_),t.addEventListener("mouseover",k),t.addEventListener("mouseout",T),t.addEventListener("wheel",R))}function v(){const t=e.unref(p);t&&(t.removeEventListener("mousedown",M),t.removeEventListener("touchstart",M),window.removeEventListener("mousemove",y),window.removeEventListener("touchmove",y),window.removeEventListener("mouseup",_),window.removeEventListener("touchend",_),t.removeEventListener("mouseover",k),t.removeEventListener("mouseout",T),t.removeEventListener("wheel",R))}function M(t){const o=t instanceof TouchEvent?t.touches[0]:t,{defaultYaw:u=0,defaultPitch:d=0}=r.value,m=Number(u)-Number(a.value.currentPoint?.yaw||0);f.value={pageX:o.pageX,pageY:o.pageY,defaultYaw:m,defaultPitch:d},$(!0),i("mousedown",t)}function y(t){if(!f.value||!j())return;const o=t instanceof TouchEvent?t.touches[0]:t,{pageX:u,pageY:d}=o,{pageX:m,pageY:h}=f.value,{defaultYaw:L=0,defaultPitch:B=0}=f.value,N=Math.PI*.15/180;let z=(Number(L)-(u-m)*N)%(2*Math.PI),F=(Number(B)+(d-h)*N)%(2*Math.PI);F=Math.max(-Math.PI/2,Math.min(Math.PI/2,F));const O=new w.Position({yaw:z,pitch:F});q(O)}function _(){$(!1),f.value=void 0}function k(){A(!0)}function T(){A(!1)}function R(t){t.preventDefault(),t.stopPropagation();const o=Math.sign(t.deltaY)*5;if(o===0)return;const{minFov:u=0,maxFov:d=0}=r.value,{fov:m=0}=s.value||{},h=Math.min(Math.max(m+o,u),d);h!==m&&H(b.fovToZoomLevel(h))}function g(){const{defaultYaw:t=0,defaultPitch:o=0,defaultZoomLvl:u=0,referPoint:d,referCoordinate:m}=r.value,h=b.referPointToModelPoint(d,m);if(h){const L=Number(t)+(h?.yaw||0),B=new w.Position({yaw:Number(L),pitch:Number(o)}),N=b.modelPointToCameraPosition(h),z=b.maskerRotateToCameraTarget(B,N),F=b.zoomLevelToFov(u);a.value.setModelPoint(h),V({position:N,target:z,fov:F}),I({defaultYaw:t}),i("point-loaded",h)}}function D(){return r.value}function ue(){const{defaultYaw:t,defaultPitch:o}=r.value;return{yaw:t,pitch:o}}function de(){return r.value.defaultZoomLvl}function le(){return s.value?.position}function me(){return s.value?.fov}function fe(){return s.value?.target}function X(){return s.value}function pe(){return r.value?.mouseover??!1}function j(){return r.value?.mousedown??!1}function I(t){t&&W(l.value,t)}function V(t){s.value={...s.value,...t}}function A(t){I({mouseover:t})}function $(t){I({mousedown:t})}function ve(t){I({minFov:t})}function he(t){I({maxFov:t})}function we(t,o){I({referPoint:t,referCoordinate:o}),g()}function q(t){const o=s.value?.position;if(!o)return;const{yaw:u,pitch:d}=t,m=Number(a.value.currentPoint?.yaw||0)+u,h=new w.Position({yaw:Number(m),pitch:Number(d)}),L=b.maskerRotateToCameraTarget(h,o);I({defaultYaw:m,defaultPitch:d}),V({target:L}),i("position-updated",{position:t,target:L})}function H(t){const o=b.zoomLevelToFov(t);I({defaultZoomLvl:t}),V({fov:o}),i("zoom-updated",{zoomLevel:t,fov:o})}function Me(t,o){const{coordinateTree:u,currentModel:d}=a.value;if(d){const m=u?.findCsById(o?.id),h=m?.getDestRelativeMap(d);if(!h)return;const L=new w.Point(t).projection(h,m,d),{y:B=0}=L||{};return new w.Point({...L,y:-B})}}function Pe(t){return new w.Vector3(t)}function Se(t,o){const{x:u=0,y:d=0,z:m=0}=o,{yaw:h,pitch:L}=t,B=-h,N=L,z=100,F=0,O=z*Math.cos(F+B)+u,ke=z*Math.sin(F+B)+d,Te=z*Math.tan(N)+m;return new w.Vector3({x:O,y:ke,z:Te})}function ye(t){const{minFov:o=20,maxFov:u=120}=r.value,m=100-(Math.max(o,Math.min(u,t))-o)/(u-o)*100;return Math.max(0,Math.min(100,Math.round(m)))}function ge(t){const{minFov:o=20,maxFov:u=120}=r.value;let d=u+t/100*(o-u);return Math.max(o,Math.min(u,d))}const b={referPointToModelPoint:Me,modelPointToCameraPosition:Pe,maskerRotateToCameraTarget:Se,fovToZoomLevel:ye,zoomLevelToFov:ge};return{getProps:r,getBindValue:P,maskerAction:{dataHelper:b,isMouseover:pe,isMousedown:j,setState:I,setMousedown:$,setMouseover:A,setMinFov:ve,setMaxFov:he,setReferPoint:we,zoom:H,rotate:q,getState:D,getPosition:ue,getZoomLevel:de,getCameraPosition:le,getCameraTarget:fe,getCameraFov:me,getCameraStatus:X},handleReady:S,handleDestroy:C}}const Q={class:"vsleem-bimsee-masker"},ee=e.defineComponent({__name:"Masker",props:{bimseeProps:{},bimseeStore:{}},emits:["ready","click","mousedown","zoom-updated","position-updated","point-loaded"],setup(n,{expose:a,emit:p}){const i=n,l=p,s=e.ref(),f=e.computed(()=>i.bimseeProps),r=e.computed(()=>i.bimseeStore),{getProps:P,getBindValue:S,maskerAction:C,handleReady:c,handleDestroy:v}=J(f,r,s,l);return e.onMounted(c),e.onBeforeUnmount(v),a(C),(M,y)=>(e.openBlock(),e.createElementBlock("div",Q,[e.withDirectives(e.createElementVNode("div",{ref_key:"maskerElRef",ref:s,class:"bimsee-masker-full"},null,512),[[e.vShow,e.unref(P).visible]]),e.renderSlot(M.$slots,"default",e.normalizeProps(e.guardReactiveProps(e.unref(S))),void 0,!0)]))}}),G=(n,a)=>{const p=n.__vccOpts||n;for(const[i,l]of a)p[i]=l;return p},te=G(ee,[["__scopeId","data-v-ab1804ce"]]);var Y=(n=>(n[n.StoreMissParams=11e3]="StoreMissParams",n[n.StoreNoCSTree=11001]="StoreNoCSTree",n[n.StoreSelectNoBIMModel=11002]="StoreSelectNoBIMModel",n))(Y||{});function oe(n){const a=e.ref(),p=e.ref(),i=e.ref(!1),l=e.ref(!1),s=e.ref(),f=e.ref(),r=e.computed(()=>a.value?.findCsById(s.value)),P=e.computed(()=>r.value?.findParentSpace());async function S(k){const{projectId:T,modelCsId:R}=k||{};try{if(!T)throw new w.AppError(Y.StoreMissParams,"缺少必要的查询参数");i.value=!0;let g=await w.DataSource.getCoordinateTree(T);if(g=await n.value.handleResponseFn?.(g)||g,!g)throw new w.AppError(Y.StoreNoCSTree,`未查询到坐标系ID为 ${R} 的坐标系树`);const D=g.findCsById(R);a.value=g,p.value=D?.getMappedCsTree(),c({modelCsId:R}),n.value.fetchSuccess?.(g)}catch(g){console.error(g),n.value.fetchError?.(g)}finally{i.value=!1}}function C(k=!1){l.value=k}function c(k){const{modelCsId:T}=k;T&&v({id:T})}function v(k){const{id:T}=k;if(a.value?.findCsById(T)?.modelType===w.CoordinateModelType.BIMModel)s.value=T;else throw new w.AppError(Y.StoreSelectNoBIMModel,`未找到ID为 ${T} 的BIM模型坐标系`)}function M(k){f.value=k}function y(){return _.value}const _=e.computed(()=>({ready:l.value,coordinateTree:a.value,mappedCoordinateTree:p.value,currentPoint:f.value,currentSpace:P.value,currentModel:r.value,reload:S,selectModel:v,setModelPoint:M}));return{storeRef:_,getStore:y,setReady:C}}const{cloneDeep:ne,deepMergeProps:ae}=w.utils;function re(n,a,p){const i=e.ref(ne(Z)),l=e.computed(()=>i.value);e.watch(()=>n,C,{immediate:!0,deep:!0});const{storeRef:s,getStore:f,setReady:r}=oe(l);e.onMounted(P);async function P(){const{appSetting:v,searchInfo:M,immediate:y,delay:_=0}=e.unref(l);v&&w.http.setRequestGlobalConfig(v),y&&M&&(await s.value?.reload(M),setTimeout(()=>{r(!0),p?.("ready")},_))}function S(){return e.unref(l)}function C(v){v&&ae(i.value,v)}function c(){return a.value}return{storeRef:s,getStore:f,getMasker:c,getState:S,setState:C}}function se(n,a,p){const i=e.computed(()=>n.value.ready&&!!n.value.currentModel),l=e.computed(()=>{const{coordinateTree:s,mappedCoordinateTree:f,currentSpace:r,currentModel:P,currentPoint:S}=n.value||{};return{coordinateTree:s,mappedCoordinateTree:f,currentSpace:r,currentModel:P,currentPoint:S}});return{getShow:i,getBindValue:l}}function ie(n,a){const p=e.ref({yaw:0,pitch:0});function i(){a("masker-ready")}function l(c){a("masker-click",c)}function s(c){a("masker-mousedown",c)}function f(c){a("masker-zoom-updated",c)}function r(c){a("masker-position-updated",c,S(c))}function P(c){a("masker-point-loaded",c)}function S(c){const{yaw:v,pitch:M}=c.position,{yaw:y,pitch:_}=e.unref(p);return p.value={yaw:v,pitch:M},{yaw:v-y,pitch:M-_}}return{maskerEvents:{ready:i,click:l,mousedown:s,zoomUpdated:f,positionUpdated:r,pointLoaded:P}}}const ce={class:"vsleem-bimsee"},U=G(e.defineComponent({name:"Bimsee",__name:"Bimsee",props:{appSetting:{},searchInfo:{},bimseeSetting:{},masker:{default:()=>x},immediate:{type:Boolean,default:!0},delay:{},handleCheckModelFn:{},handleResponseFn:{},fetchSuccess:{},fetchError:{}},emits:["ready","change-model","masker-ready","masker-click","masker-mousedown","masker-zoom-updated","masker-position-updated","masker-point-loaded"],setup(n,{expose:a,emit:p}){const i=n,l=p,s=e.ref(),f=re(i,s,l),{storeRef:r,getMasker:P}=f,{getShow:S,getBindValue:C}=se(r),{maskerEvents:c}=ie(P,l);return a(f),(v,M)=>(e.openBlock(),e.createElementBlock("div",ce,[e.unref(S)?(e.openBlock(),e.createBlock(te,e.mergeProps({key:0,ref_key:"maskerElRef",ref:s,bimseeProps:i,bimseeStore:e.unref(r)},e.toHandlers(e.unref(c))),{default:e.withCtx(y=>[e.renderSlot(v.$slots,"masker",e.normalizeProps(e.guardReactiveProps(y)),void 0,!0)]),_:3},16,["bimseeStore"])):e.createCommentVNode("",!0),e.renderSlot(v.$slots,"default",e.normalizeProps(e.guardReactiveProps(e.unref(C))),void 0,!0)]))}}),[["__scopeId","data-v-03ae1278"]]);E.BIMSEE_CONFIG=Z,E.Bimsee=U,E.BimseePlugin=U,E.MASKER_CONFIG=x,Object.defineProperty(E,Symbol.toStringTag,{value:"Module"})}));
@@ -11,6 +11,7 @@ export declare const BIMSEE_CONFIG: {
11
11
  appSetting: {
12
12
  baseUrl: string;
13
13
  obsType: string;
14
+ authorizeCode: string;
14
15
  };
15
16
  masker: {
16
17
  visible: boolean;
@@ -8,13 +8,13 @@ export type SearchInfo = {
8
8
  };
9
9
  export type BimseeSetting = {};
10
10
  export type BimseeProps = {
11
- appSetting?: AppSetting;
11
+ appSetting: AppSetting;
12
+ searchInfo: SearchInfo;
12
13
  bimseeSetting?: BimseeSetting;
13
- searchInfo?: SearchInfo;
14
14
  masker?: MaskerProps;
15
15
  immediate?: boolean;
16
16
  delay?: number;
17
- handleCheckedFn?: (res?: Coordinate) => Promise<boolean>;
17
+ handleCheckModelFn: (res?: Coordinate) => Promise<boolean>;
18
18
  handleResponseFn?: (res?: Coordinate) => Promise<Coordinate | undefined>;
19
19
  fetchSuccess?: (coordinate?: Coordinate) => void;
20
20
  fetchError?: (error: any) => void;
@@ -32,8 +32,8 @@ export type DataHelper = {
32
32
  };
33
33
  export type MaskerElement = {
34
34
  dataHelper: DataHelper;
35
- isMouseover(): boolean;
36
- isMousedown(): boolean;
35
+ isMouseover: () => boolean;
36
+ isMousedown: () => boolean;
37
37
  setState: (options?: Partial<MaskerProps>) => void;
38
38
  setMousedown: (mousedown: boolean) => void;
39
39
  setMouseover: (mouseover: boolean) => void;
@@ -42,11 +42,11 @@ export type MaskerElement = {
42
42
  setReferPoint: (point: Point, coordinate: Partial<Coordinate>) => void;
43
43
  zoom: (level: number) => void;
44
44
  rotate: (position: Position) => void;
45
- getState(): () => MaskerProps;
46
- getPosition(): () => Position;
47
- getZoomLevel(): () => number;
45
+ getState: () => MaskerProps;
46
+ getPosition: () => Position;
47
+ getZoomLevel: () => number;
48
48
  getCameraPosition: () => Vector3 | undefined;
49
49
  getCameraTarget: () => Vector3 | undefined;
50
50
  getCameraFov: () => number | undefined;
51
- getCameraStatus(): () => CameraStatus | undefined;
51
+ getCameraStatus: () => CameraStatus | undefined;
52
52
  };
@@ -1,7 +1,7 @@
1
1
  import { Coordinate, Point } from '@vsleem-realsee-viewer/shared';
2
2
  import { SearchInfo } from './bimsee';
3
3
  export type BimseeStore = {
4
- /** 是否准备就绪 */
4
+ /** 是否加载完成 */
5
5
  ready: boolean;
6
6
  /** 坐标树结构 */
7
7
  coordinateTree?: Coordinate;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vsleem-realsee-viewer/bimsee-plugin",
3
- "version": "2.0.5",
3
+ "version": "2.0.6",
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.6"
16
+ "@vsleem-realsee-viewer/shared": "2.0.7"
17
17
  },
18
18
  "peerDependencies": {
19
19
  "vue": "^3.0.0",
20
- "@vsleem-realsee-viewer/shared": "2.0.6"
20
+ "@vsleem-realsee-viewer/shared": "2.0.7"
21
21
  },
22
22
  "peerDependenciesMeta": {
23
23
  "vue": {