| | |
| | | } |
| | | |
| | | export const beInsight = (sprite, setCurSprite) => { |
| | | if (!sprite?.data?.type) { return } |
| | | |
| | | sprite.off('pointerup'); |
| | | sprite.off('pointermove'); |
| | | sprite.off('pointerdown'); |
| | |
| | | sprite.on('pointerover', onSpriteMouseOver); |
| | | sprite.on('pointermove', onSpriteMouseMove); |
| | | sprite.on('pointerout', onSpriteMouseOut); |
| | | |
| | | } |
| | | |
| | | export const beMovable = (sprite) => { |
| | |
| | | } |
| | | |
| | | export const beSettings = (sprite, setSpriteSettings) => { |
| | | if (!sprite?.data?.type) { return } |
| | | |
| | | sprite.off('pointerup'); |
| | | sprite.off('pointermove'); |
| | | sprite.off('pointerdown'); |
| | |
| | | sprite.on('pointerover', onSpriteMouseOver); |
| | | sprite.on('pointermove', onSpriteMouseMove); |
| | | sprite.on('pointerout', onSpriteMouseOut); |
| | | |
| | | } |
| | | |
| | | const createSpriteTooltip = (sprite) => { |
| | | const style = new PIXI.TextStyle({ |
| | | fontFamily: 'Microsoft YaHei', |
| | | fontSize: 16, |
| | | fill: '#ffffff', |
| | | stroke: '#4a1850', |
| | | strokeThickness: 2, |
| | | dropShadow: true, |
| | | dropShadowColor: '#000000', |
| | | dropShadowBlur: 4, |
| | | dropShadowAngle: Math.PI / 6, |
| | | dropShadowDistance: 6, |
| | | fontFamily: 'Roboto', |
| | | fontSize: 12, |
| | | fill: '#000000', |
| | | }); |
| | | |
| | | const text = new PIXI.Text(`编号: ${sprite.data.no}`, style); |
| | | |
| | | const text = new PIXI.Text(`${sprite.data?.type} ${sprite.data?.no}`, style); |
| | | const background = new PIXI.Graphics(); |
| | | background.beginFill(0x000000, 0.7); |
| | | background.drawRoundedRect(0, 0, text.width + 20, text.height + 20, 10); |
| | | // shadow |
| | | background.beginFill(0x000000, 0.1); |
| | | background.drawRoundedRect(4, 4, text.width + 6, text.height + 6, 4); |
| | | background.endFill(); |
| | | // background |
| | | background.beginFill(0xffffff, 1); |
| | | background.drawRoundedRect(0, 0, text.width + 8, text.height + 8, 4); |
| | | background.endFill(); |
| | | |
| | | text.x = 10; |
| | | text.y = 10; |
| | | text.x = 5; |
| | | text.y = 3; |
| | | background.addChild(text); |
| | | |
| | | tooltip = new PIXI.Container(); |
| | | tooltip.addChild(background); |
| | | return tooltip; |