diff --git a/.gitignore b/.gitignore index 95aa5fe..494ac70 100644 --- a/.gitignore +++ b/.gitignore @@ -13,6 +13,7 @@ dist dist-ssr *.local public/Cesium +public/landmarkImg # Editor directories and files .vscode/* diff --git a/src/components/Earth.vue b/src/components/Earth.vue index a68f62d..85d271a 100644 --- a/src/components/Earth.vue +++ b/src/components/Earth.vue @@ -35,6 +35,7 @@ import Compass from '/@/components/Compass.vue' import { usePointStore } from "/@/stores/point"; import { usePositionStore } from "/@/stores/position"; +import { useFlytoStore } from "/@/stores/flyto"; import { VcViewer, VcStatusBar, @@ -91,13 +92,6 @@ const cartesian2Lonlat = (cartesian) => { const position = usePositionStore(); position.$subscribe((_, state) => { - // import { MutationType } from 'pinia' 改变触发的类型 - // mutation.type // 'direct' | 'patch object' | 'patch function' - // same as cartStore.$id - // mutation.storeId // 'cart' - // only available with mutation.type === 'patch object' - // mutation.payload // patch object passed to cartStore.$patch() - // 侦听到state变化时,把state存在localStorage中 // localStorage.setItem('cart', JSON.stringify(state)) if (!isLnglat(state)) return; @@ -107,6 +101,15 @@ position.$subscribe((_, state) => { }); }); +const flyto = useFlytoStore(); +flyto.$subscribe((_, state) => { + if (!isLnglat(state)) return; + + viewer.camera.flyTo({ + destination: Cesium.Cartesian3.fromDegrees(state.lng, state.lat, 2000.0), + }); +}); + // 默认值 天安门广场经纬度 116.39140105, 39.90452844 高度 2000.0 const pointTo = () => { let initialPosition = Cesium.Cartesian3.fromDegrees(position.lng?position.lng:116.39140105, position.lat?position.lat:39.90452844, 2000.0); diff --git a/src/components/HotLandmark.vue b/src/components/HotLandmark.vue index e36fe4e..a7533e0 100644 --- a/src/components/HotLandmark.vue +++ b/src/components/HotLandmark.vue @@ -6,7 +6,7 @@ style="position: absolute; top: -40px; right: 0; z-index: 99; cursor: pointer" @click="showLandmark" > - +
- +
@@ -43,7 +43,7 @@