|  |  |  | 
|---|
|  |  |  | return num * (Math.PI / 180); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const animateRotation = (sprite, targetRotation, rotationOffset = 0) => { | 
|---|
|  |  |  | if (!mapContainer || !sprite) { | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | // origin | 
|---|
|  |  |  | let currentRotation = sprite.rotation + rotationOffset; | 
|---|
|  |  |  | // target | 
|---|
|  |  |  | targetRotation += rotationOffset; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // diff | 
|---|
|  |  |  | let rotationDifference = targetRotation - currentRotation; | 
|---|
|  |  |  | rotationDifference = ((rotationDifference + Math.PI) % (2 * Math.PI)) - Math.PI; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // destination | 
|---|
|  |  |  | const endRotation = sprite.rotation + rotationDifference; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | new TWEEDLE.Tween(sprite) | 
|---|
|  |  |  | .to({ rotation: endRotation }, 1000) | 
|---|
|  |  |  | .easing(TWEEDLE.Easing.Linear.None) | 
|---|
|  |  |  | .onUpdate(() => { | 
|---|
|  |  |  | // agv | 
|---|
|  |  |  | if (sprite.updateTextRotation) { | 
|---|
|  |  |  | sprite.updateTextRotation(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | .start(); | 
|---|
|  |  |  | }; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | export const incrementSpriteNo = (str, incrementValue) => { | 
|---|
|  |  |  | const match = str.match(/(\D*)(\d+)/); | 
|---|
|  |  |  | if (match) { | 
|---|
|  |  |  | 
|---|
|  |  |  | if (!code) { return; } | 
|---|
|  |  |  | const codeSprite = querySprite(DEVICE_TYPE.POINT, code); | 
|---|
|  |  |  | if (!codeSprite) { return; } | 
|---|
|  |  |  | let agvSprite = querySprite(DEVICE_TYPE.AGV, agvNo); | 
|---|
|  |  |  | const targetRotation = rotationParseNum(direction); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const targetRotation = rotationParseNum(direction); | 
|---|
|  |  |  | const backpackCount = backpack?.filter(item => item.loaded === true).length || 0; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | let agvSprite = querySprite(DEVICE_TYPE.AGV, agvNo); | 
|---|
|  |  |  | if (!agvSprite) { | 
|---|
|  |  |  | const agvStatusMode = getAgvStatusMode(backpackCount, battery); | 
|---|
|  |  |  | const agvTexture = generateAgvSpriteTexture(agvStatusMode); | 
|---|
|  |  |  | 
|---|
|  |  |  | agvText.anchor.set(0.5, 0.5); | 
|---|
|  |  |  | agvText.position.set(0, 0); | 
|---|
|  |  |  | agvSprite.addChild(agvText); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | agvSprite.updateTextRotation = () => { | 
|---|
|  |  |  | if (agvText && agvSprite) { | 
|---|
|  |  |  | agvText.rotation = -agvSprite.rotation; | 
|---|
|  |  |  | 
|---|
|  |  |  | .easing(TWEEDLE.Easing.Linear.None) | 
|---|
|  |  |  | .start(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const animateRotation = (sprite, targetRotation, agvRotationOffset) => { | 
|---|
|  |  |  | let currentRotation = sprite.rotation + agvRotationOffset; | 
|---|
|  |  |  | targetRotation += agvRotationOffset; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | let rotationDifference = targetRotation - currentRotation; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | rotationDifference = ((rotationDifference + Math.PI) % (2 * Math.PI)) - Math.PI; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const endRotation = sprite.rotation + rotationDifference; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | new TWEEDLE.Tween(sprite) | 
|---|
|  |  |  | .to({ rotation: endRotation }, 1000) | 
|---|
|  |  |  | .easing(TWEEDLE.Easing.Linear.None) | 
|---|
|  |  |  | .onUpdate(() => { | 
|---|
|  |  |  | if (sprite.updateTextRotation) { | 
|---|
|  |  |  | sprite.updateTextRotation(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | .start(); | 
|---|
|  |  |  | }; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const drawerAgvPath = (curZone, agvVo) => { | 
|---|
|  |  |  | if (!mapContainer) { | 
|---|