| | |
| | | |
| | | } |
| | | |
| | | export const spriteListBeMovable = (selectedSprites, resetFn) => { |
| | | export const spriteListBeMovable = (selectedSprites, endFn) => { |
| | | if (selectedSprites && selectedSprites.length > 0) { |
| | | let batchMove = false; |
| | | let batchMoveStartPos = null; |
| | |
| | | mapContainer.parent.off('mousemove'); |
| | | mapContainer.parent.off('mouseup'); |
| | | |
| | | if (resetFn) { |
| | | resetFn(); |
| | | if (endFn) { |
| | | endFn(); |
| | | } |
| | | } |
| | | |
| | |
| | | && 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); |