| | |
| | | } |
| | | } |
| | | |
| | | export const findSpriteByUuid = (uuid) => { |
| | | return mapContainer?.children?.find(child => child?.data?.uuid === uuid); |
| | | } |
| | | |
| | | export const markSprite = (sprite) => { |
| | | sprite.alpha = 0.5; |
| | | } |
| | |
| | | function onClick(event) { |
| | | setSpriteSettings(sprite); |
| | | } |
| | | } |
| | | |
| | | export const focusSprite = (sprite) => { |
| | | if (!sprite || !app || !mapContainer) { |
| | | return; |
| | | } |
| | | |
| | | mapContainer.scale.set(1); |
| | | mapContainer.position.set(0, 0); |
| | | |
| | | let bounds = sprite.getBounds(); |
| | | let focusPoint = { |
| | | x: bounds.x + bounds.width / 2, |
| | | y: bounds.y + bounds.height / 2 |
| | | }; |
| | | |
| | | let targetPos = { |
| | | x: app.renderer.width / 3 - focusPoint.x * mapContainer.scale.x, |
| | | y: app.renderer.height / 3 - focusPoint.y * mapContainer.scale.y |
| | | }; |
| | | |
| | | new TWEEDLE.Tween(mapContainer.position).easing(TWEEDLE.Easing.Quadratic.Out) |
| | | .to(targetPos, 500).start(); |
| | | } |
| | | |
| | | export const clearMapData = () => { |
| | |
| | | // dynamic graphic ---------------- |
| | | |
| | | export const generateDynamicGraphic = (curZone, data) => { |
| | | console.log("ws", curZone, data); |
| | | // console.log("ws", curZone, data); |
| | | |
| | | for (const agvVo of data.agvVos) { |
| | | showAgvSprite(curZone, agvVo) |