| | |
| | | |
| | | export const MapEvent = Object.freeze({ |
| | | SELECTION_BOX: Symbol.for(0), |
| | | PAN: Symbol.for(1), |
| | | }) |
| | | |
| | | export const getRealPosition = (x, y, mapContainer) => { |
| | |
| | | sprite.anchor.set(0.5); |
| | | sprite.cursor = 'pointer'; |
| | | sprite.eventMode = 'static'; |
| | | sprite.data = {}; |
| | | } |
| | | |
| | | export const beMovable = (sprite, setDidClickSprite) => { |
| | |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | export const isSpriteInSelectionBox = (sprite, selectionBox) => { |
| | | const spriteBounds = sprite.getBounds(); |
| | | const boxBounds = selectionBox.getBounds(); |
| | | |
| | | return spriteBounds.x + spriteBounds.width > boxBounds.x |
| | | && spriteBounds.x < boxBounds.x + boxBounds.width |
| | | && spriteBounds.y + spriteBounds.height > boxBounds.y |
| | | && spriteBounds.y < boxBounds.y + boxBounds.height; |
| | | } |
| | | |
| | | export const markSprite = (sprite) => { |
| | | sprite.alpha = 0.5; |
| | | } |
| | | |
| | | export const unMarkSprite = (sprite) => { |
| | | sprite.alpha = 1; |
| | | } |