From b461ba63849e174f9c102c4e343f355bdcaa09f6 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期四, 21 三月 2024 14:33:55 +0800
Subject: [PATCH] #

---
 zy-asrs-flow/src/pages/map/index.jsx |   24 +++++++++++++++++++++++-
 1 files changed, 23 insertions(+), 1 deletions(-)

diff --git a/zy-asrs-flow/src/pages/map/index.jsx b/zy-asrs-flow/src/pages/map/index.jsx
index 668981a..b7b37ad 100644
--- a/zy-asrs-flow/src/pages/map/index.jsx
+++ b/zy-asrs-flow/src/pages/map/index.jsx
@@ -219,9 +219,31 @@
     }, [curSprite]);
     const prevCurSprite = prevCurSpriteRef.current;
 
+    const swichFloor = async (floor) => {
+        await Utils.fetchMapData(floor);
+
+        player.hideGridlines();
+        player.hideStarryBackground();
+
+        player.activateMapEvent(null);
+
+        Utils.removeSelectedEffect();
+        setCurSPrite(null);
+        setDeviceVisible(false);
+        setSettingsVisible(false);
+        setDrawerVisible(false);
+
+        mapContainer.children.forEach(child => {
+            Utils.viewFeature(child, setCurSPrite);
+        })
+    }
+
     // watch curFloor
     React.useEffect(() => {
-        Utils.fetchMapData(curFloor);
+        if (!mapContainer && !dataFetched) {
+            return;
+        }
+        swichFloor(curFloor);
     }, [curFloor]);
 
     // didClickSprite, stop triggers both sprite click and play's selection boxs

--
Gitblit v1.9.1