From 7c14a1e6c03d1ab8ee651ffd16bc80bac2c26875 Mon Sep 17 00:00:00 2001
From: husq <931347610@qq.com>
Date: Sun, 08 Oct 2023 16:59:41 +0800
Subject: [PATCH] 不销毁地图

---
 src/hooks/use-cesium-tsa.ts         |    7 +++----
 src/pages/page-web/projects/tsa.vue |    2 +-
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/src/hooks/use-cesium-tsa.ts b/src/hooks/use-cesium-tsa.ts
index 4ed342b..c802aa8 100644
--- a/src/hooks/use-cesium-tsa.ts
+++ b/src/hooks/use-cesium-tsa.ts
@@ -34,7 +34,6 @@
   let handler: Cesium.ScreenSpaceEventHandler
   const dimension = ref(3)
   const _init = () => {
-    if (viewer) return
     // Cesium Token
     const cesiumToken = import.meta.env.VITE_CESIUM_TOKEN
     Cesium.Ion.defaultAccessToken = cesiumToken
@@ -169,9 +168,9 @@
   })
 
   // 销毁地图模型
-  onUnmounted(() => {
-    viewer = null
-  })
+  // onUnmounted(() => {
+  //   // viewer = null
+  // })
   return {
     addPoint,
     removeAllPoint,
diff --git a/src/pages/page-web/projects/tsa.vue b/src/pages/page-web/projects/tsa.vue
index 6815794..f31fdc0 100644
--- a/src/pages/page-web/projects/tsa.vue
+++ b/src/pages/page-web/projects/tsa.vue
@@ -322,9 +322,9 @@
 }
 // 获取ws连接过来的sn设备号
 const snCode = ref<string[]>([])
+const cesium = cesiumOperation()
 // 添加机场标注
 watch(() => store.state.deviceState, data => {
-  const cesium = cesiumOperation(global.$viewer)
   if (snCode.value.includes(data.currentSn)) return
   snCode.value.push(data.currentSn)
   // cesium.removeAllPoint()

--
Gitblit v1.9.3