| | |
| | | this.scale = 1; |
| | | this.app.view.addEventListener('wheel', (event) => { |
| | | event.preventDefault(); |
| | | if (this.scale !== this.mapContainer.scale.x) { |
| | | this.scale = this.mapContainer.scale.x; |
| | | } |
| | | |
| | | const delta = Math.sign(event.deltaY); |
| | | |
| | |
| | | } |
| | | |
| | | showGridlines = () => { |
| | | this.hideGridlines(); |
| | | if (!this.gridLineContainer) { |
| | | this.gridLineContainer = generatePixiContainer('gridLineContainer'); |
| | | this.app.stage.addChild(this.gridLineContainer); |
| | | } |
| | | |
| | | const inte = 30; |
| | | const lineDefaultAlpha = .5;; |
| | | const lineDefaultAlpha = .1;; |
| | | const lineDefaultColor = 0x000000; |
| | | for (let i = 0; i < this.app.view.width / inte; i++) { |
| | | const graphics = new PIXI.Graphics(); |
| | | graphics.lineStyle(.3, lineDefaultColor, lineDefaultAlpha); |
| | | graphics.lineStyle(1, lineDefaultColor, lineDefaultAlpha); |
| | | graphics.beginFill(lineDefaultColor); |
| | | graphics.moveTo(i * inte, 0); |
| | | graphics.lineTo(i * inte, this.app.view.height); |
| | |
| | | |
| | | for (let i = 0; i < this.app.view.height / inte; i++) { |
| | | const graphics = new PIXI.Graphics(); |
| | | graphics.lineStyle(.3, lineDefaultColor, lineDefaultAlpha); |
| | | graphics.lineStyle(1, lineDefaultColor, lineDefaultAlpha); |
| | | graphics.beginFill(lineDefaultColor); |
| | | graphics.moveTo(0, i * inte); |
| | | graphics.lineTo(this.app.view.width, i * inte); |
| | |
| | | if (!this.mapContainer || !this.app) { |
| | | return; |
| | | } |
| | | |
| | | this.mapContainer.scale.set(1); |
| | | this.mapContainer.position.set(0, 0); |
| | | if (this.mapContainer.children.length === 0) { |
| | | return; |
| | | } |
| | | this.mapContainer.scale.set(1); |
| | | this.mapContainer.position.set(0, 0); |
| | | |
| | | let minX, maxX, minY, maxY; |
| | | for (let sprite of this.mapContainer.children) { |