huweili-cesium 1.0.2 → 1.0.4
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/basis.js +18 -3
- package/customToolbarButtons.js +3 -0
- 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
|
-
|
|
105
|
-
|
|
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/customToolbarButtons.js
CHANGED
|
@@ -12,6 +12,7 @@ import { createBasemapSwitcher } from './toolbar/basemapSwitcher'
|
|
|
12
12
|
import { createZoomController } from './toolbar/zoomController'
|
|
13
13
|
import { createFullscreenController } from './toolbar/fullscreenController'
|
|
14
14
|
import { useEventBus } from './utils/useEventBus.js'
|
|
15
|
+
import { useMapStore } from './stores/mapStore'
|
|
15
16
|
|
|
16
17
|
/**
|
|
17
18
|
* 创建自定义工具栏按钮
|
|
@@ -23,6 +24,7 @@ export function createCustomToolbarButtons() {
|
|
|
23
24
|
const { toggleBasemapPickerPanel } = createBasemapSwitcher() // 地图切换器
|
|
24
25
|
const { toggleMapFullscreen } = createFullscreenController() // 全屏控制器
|
|
25
26
|
const { emit } = useEventBus() // 事件总线
|
|
27
|
+
const mapStore = useMapStore() // 地图状态管理器
|
|
26
28
|
|
|
27
29
|
/**
|
|
28
30
|
* 添加单个自定义工具栏按钮
|
|
@@ -126,6 +128,7 @@ export function createCustomToolbarButtons() {
|
|
|
126
128
|
onClick: (v, btn) => {
|
|
127
129
|
const result = toggleViewToRtk(mapId)
|
|
128
130
|
if (result.success && btn) btn.innerText = result.currentMode
|
|
131
|
+
mapStore.setSceneMode(result.currentMode, mapId)
|
|
129
132
|
}
|
|
130
133
|
},
|
|
131
134
|
{
|