| | |
| | | |
| | | |
| | | export const getRealPosition = (x, y) => { |
| | | const rect = app.view.getBoundingClientRect(); |
| | | return { |
| | | mapX: (x - rect.left) / mapContainer.scale.x - mapContainer.x / mapContainer.scale.x, |
| | | mapY: (y - rect.top) / mapContainer.scale.y - mapContainer.y / mapContainer.scale.y |
| | | } |
| | | const globalPoint = new PIXI.Point(); |
| | | app.renderer.plugins.interaction.mapPositionToPoint(globalPoint, x, y); |
| | | const mapPoint = mapContainer.toLocal(globalPoint); |
| | | return { mapX: mapPoint.x, mapY: mapPoint.y }; |
| | | } |
| | | |
| | | export const generateSprite = (deviceType, texture) => { |
| | |
| | | const agvRotationOffset = rotationParseNum(agvRotationOffsetDegrees); |
| | | |
| | | const showAgvSprite = (curZone, agvVo, setCurSprite) => { |
| | | const { agvNo, code, direction, battery, backpack } = agvVo; |
| | | const { agvNo, code, direction, battery, backpack, error } = agvVo; |
| | | if (!code) { return; } |
| | | const codeSprite = querySprite(DEVICE_TYPE.POINT, code); |
| | | if (!codeSprite) { return; } |
| | |
| | | agvSprite.position.set(codeSprite.position.x, codeSprite.position.y); |
| | | agvSprite.rotation = targetRotation + agvRotationOffset; |
| | | mapContainer.addChild(agvSprite); |
| | | beInsight(agvSprite, setCurSprite); |
| | | |
| | | // agvNo sprite |
| | | const agvText = new PIXI.Text(agvNo.toString(), { |
| | |
| | | animateRotation(agvSprite, targetRotation + agvRotationOffset, agvRotationOffset); |
| | | } |
| | | |
| | | if (error) { |
| | | agvSprite.tint = 0xff3f34; |
| | | } else { |
| | | agvSprite.tint = 0xffffff; |
| | | } |
| | | |
| | | beInsight(agvSprite, setCurSprite); |
| | | |
| | | new TWEEDLE.Tween(agvSprite.position) |
| | | .to({ |
| | | x: codeSprite.position.x, |