From 66ab394f977a2fcf4b4fc9334829fc5bb171296f Mon Sep 17 00:00:00 2001 From: luxiaotao1123 <t1341870251@163.com> Date: 星期三, 09 十月 2024 16:45:28 +0800 Subject: [PATCH] # --- zy-acs-flow/src/map/tool.js | 28 +++++++++++++++++++++++++--- 1 files changed, 25 insertions(+), 3 deletions(-) diff --git a/zy-acs-flow/src/map/tool.js b/zy-acs-flow/src/map/tool.js index d8ea096..2a9ced4 100644 --- a/zy-acs-flow/src/map/tool.js +++ b/zy-acs-flow/src/map/tool.js @@ -117,7 +117,7 @@ } -export const spriteListBeMovable = (selectedSprites, resetFn) => { +export const spriteListBeMovable = (selectedSprites, endFn) => { if (selectedSprites && selectedSprites.length > 0) { let batchMove = false; let batchMoveStartPos = null; @@ -148,8 +148,8 @@ mapContainer.parent.off('mousemove'); mapContainer.parent.off('mouseup'); - if (resetFn) { - resetFn(); + if (endFn) { + endFn(); } } @@ -182,6 +182,28 @@ && spriteBounds.y < boxBounds.y + boxBounds.height; } +export const clearMapData = () => { + if (!mapContainer) { + return; + } + let childList = []; + mapContainer.children.forEach(child => { + if (child.data?.uuid) { + childList.push(child); + } + }) + if (childList.length > 0) { + childList.forEach(child => { + mapContainer.removeChild(child); + child.destroy({ children: true, texture: false, baseTexture: false }); + }) + childList.forEach((child, index) => { + childList[index] = null; + }); + childList = []; + } +} + export const generateID = () => { return Date.now().toString(36) + Math.random().toString(36).substring(2); -- Gitblit v1.9.1