| | |
| | | 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); |
| | | |
| | |
| | | this.scale = newScale; |
| | | |
| | | this.mapContainer.scale.set(this.scale); |
| | | console.log(this.scale); |
| | | |
| | | this.mapContainer.children.forEach(child => { |
| | | // child.scale.set(1 / this.scale); // 防止图标变小 |
| | |
| | | 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) { |