From 9dff81608258d1b24a1ed6ba36194875ce4bb72c Mon Sep 17 00:00:00 2001
From: vincentlu <t1341870251@gmail.com>
Date: 星期二, 09 十二月 2025 14:13:55 +0800
Subject: [PATCH] #

---
 zy-acs-flow/src/map/tool.js     |   22 ++++++++++++++++++++++
 zy-acs-flow/src/map/MapPage.jsx |    3 +++
 2 files changed, 25 insertions(+), 0 deletions(-)

diff --git a/zy-acs-flow/src/map/MapPage.jsx b/zy-acs-flow/src/map/MapPage.jsx
index 52144cc..39bcbe4 100644
--- a/zy-acs-flow/src/map/MapPage.jsx
+++ b/zy-acs-flow/src/map/MapPage.jsx
@@ -168,6 +168,9 @@
                     Tool.beSettings(child, setCurSprite);
                 })
                 break
+            case MAP_MODE.ZONING_MODE:
+                Tool.removeAgvGraphics();
+                break
             default:
                 break
         }
diff --git a/zy-acs-flow/src/map/tool.js b/zy-acs-flow/src/map/tool.js
index a22da46..23cb195 100644
--- a/zy-acs-flow/src/map/tool.js
+++ b/zy-acs-flow/src/map/tool.js
@@ -854,3 +854,25 @@
 
     mapContainer.addChild(agvPath);
 }
+
+export const removeAgvGraphics = () => {
+    if (!mapContainer) {
+        return;
+    }
+    for (let i = mapContainer.children.length - 1; i >= 0; i--) {
+        const child = mapContainer.children[i];
+        if (child?.data?.type === DEVICE_TYPE.AGV) {
+            if (child.data.jobEffect) {
+                app?.ticker.remove(child.data.jobEffect._onTick);
+                child.removeChild(child.data.jobEffect);
+                child.data.jobEffect.destroy(true);
+                child.data.jobEffect = null;
+            }
+            mapContainer.removeChild(child);
+            child.destroy({ children: true, texture: false, baseTexture: false });
+        } else if (child?.name?.startsWith('agvPath-')) {
+            mapContainer.removeChild(child);
+            child.destroy({ children: true, texture: false, baseTexture: false });
+        }
+    }
+}

--
Gitblit v1.9.1