| | |
| | | |
| | | |
| | | 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) => { |