huweili-cesium 1.0.2 → 1.0.3

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.
Files changed (2) hide show
  1. package/basis.js +18 -3
  2. package/package.json +1 -1
package/basis.js CHANGED
@@ -101,8 +101,23 @@ export function basicConfig() {
101
101
  }
102
102
 
103
103
  const centerInfo = mapStore.getMapInfo('center', mapId) || {}
104
- // 优先级:传入的 altitude > 配置文件中的 centerInfo.alt > 默认值 10000
105
- const finalAltitude = altitude !== undefined ? altitude : (centerInfo.alt || 10000)
104
+ const sceneMode = mapStore.getSceneMode(mapId)
105
+
106
+ // 优先级:传入的 altitude > 根据场景模式确定默认值
107
+ let finalAltitude
108
+ if (altitude !== undefined) {
109
+ finalAltitude = altitude
110
+ } else {
111
+ // 根据场景模式确定默认高度
112
+ if (sceneMode === '2D') {
113
+ // 2D 模式:使用 centerInfo.alt,没有则使用默认值 22000
114
+ finalAltitude = centerInfo.alt || 22000
115
+ } else {
116
+ // 3D 模式:使用默认值 10000
117
+ finalAltitude = 10000
118
+ }
119
+ }
120
+
106
121
  // targetAlt 是看向目标点的高度,例如飞机高度;不要和视角高度 alt 混用
107
122
  const finalTargetAlt = targetAlt !== undefined ? targetAlt : (centerInfo.targetAlt || 0)
108
123
 
@@ -332,4 +347,4 @@ export function basicConfig() {
332
347
  applyOrthographicFrustum,
333
348
  restorePerspectiveFrustum
334
349
  }
335
- }
350
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "huweili-cesium",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "基于 Cesium 的地图工具库(无人机态势、轨迹、围栏、工具栏等)",
5
5
  "type": "module",
6
6
  "main": "./index.js",