| | |
| | | import charge from '/map/charge.svg'; |
| | | import station from '/map/station.svg'; |
| | | import direction from '/map/direction.svg'; |
| | | import point from '/map/point.svg'; |
| | | |
| | | let app, mapContainer, themeMode; |
| | | let selectedSprite, effectTick, effectHalfCircle, effectRectangle; |
| | |
| | | // sprite.height = 63; |
| | | sprite.zIndex = DEVICE_Z_INDEX.DIRECTION; |
| | | break; |
| | | |
| | | case DEVICE_TYPE.POINT: |
| | | sprite = new PIXI.Sprite(PIXI.Texture.from(point, { resourceOptions: { scale: 1 } })); |
| | | // sprite.width = 112; |
| | | // sprite.height = 63; |
| | | sprite.zIndex = DEVICE_Z_INDEX.POINT; |
| | | break |
| | | default: |
| | | break; |
| | | } |
| | | if (sprite) { |
| | | sprite.blendMode = PIXI.BLEND_MODES.MULTIPLY; |
| | | } |
| | | return sprite; |
| | | } |
| | | |
| | | export const initSprite = (sprite, type) => { |
| | | sprite.anchor.set(0.5); |
| | | // sprite.alpha = 1; |
| | | sprite.cursor = 'pointer'; |
| | | sprite.eventMode = 'static'; |
| | | sprite.data = { |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | export const showSelectedEffect = (sprite) => { |
| | | if (!sprite?.texture || !sprite?.texture?.valid) { |
| | | return; |
| | |
| | | effectHalfCircle.position.set(sprite.x, sprite.y); |
| | | } |
| | | |
| | | export const rotationToNum = (rotation) => { |
| | | let res = rotation * 180 / Math.PI; |
| | | if (res < 0) { |
| | | res += 360; |
| | | } else if (res > 360) { |
| | | res -= 360; |
| | | } |
| | | return res; |
| | | } |
| | | |
| | | export const rotationParseNum = (num) => { |
| | | return num * Math.PI / 180; |
| | | } |
| | | |
| | | export const incrementSpriteNo = (str, incrementValue) => { |
| | | const match = str.match(/(\D*)(\d+)/); |
| | | if (match) { |