From ab886689e2c4ef8db2b0767717d69ebbaf10326c Mon Sep 17 00:00:00 2001 From: luxiaotao1123 <t1341870251@163.com> Date: 星期五, 29 十一月 2024 16:37:20 +0800 Subject: [PATCH] # --- zy-acs-flow/src/map/MapPage.jsx | 14 ++++++++++---- 1 files changed, 10 insertions(+), 4 deletions(-) diff --git a/zy-acs-flow/src/map/MapPage.jsx b/zy-acs-flow/src/map/MapPage.jsx index ba9ebb1..3fa87d0 100644 --- a/zy-acs-flow/src/map/MapPage.jsx +++ b/zy-acs-flow/src/map/MapPage.jsx @@ -41,6 +41,7 @@ const [mapContainer, setMapContainer] = useState(null); const [mode, setMode] = useState(MAP_MODE.OBSERVER_MODE); + const modeRef = useRef(mode); const [dataFetched, setDataFetched] = useState(false); const [insightVisible, setInsightVisible] = useState(false); const [deviceVisible, setDeviceVisible] = useState(false); @@ -80,7 +81,9 @@ await Http.fetchMapData(curZone, setRcsStatus, setCurSprite); websocket.connect(); websocket.onMessage = (wsMsg) => { - Tool.generateDynamicGraphic(curZone, JSON.parse(wsMsg), setCurSprite); + if (modeRef.current === MAP_MODE.OBSERVER_MODE) { + Tool.generateDynamicGraphic(curZone, JSON.parse(wsMsg), setCurSprite); + } } player.rotateMap(localStorage.getItem('mapRotation')); @@ -104,7 +107,6 @@ player.destroy(); window.removeEventListener('resize', handleResize); Tool.patchRaLayout(''); - Tool.isF }; }, []) @@ -118,6 +120,8 @@ }, [themeMode]) const switchMode = (mode) => { + modeRef.current = mode; + Tool.removeSelectedEffect(); player.hideGridLines(); @@ -178,6 +182,9 @@ const { mapX, mapY } = Tool.getRealPosition(x, y); sprite.x = mapX; sprite.y = mapY; + + // sprite.scale.set(mapContainer.scale.x); + sprite.rotation = -mapContainer.rotation; Tool.initSprite(sprite, type); mapContainer.addChild(sprite); @@ -412,8 +419,7 @@ > <AltRoute /> </Fab> - <FakeFab - /> + <FakeFab /> </> )} <Fab -- Gitblit v1.9.1