From fd078d358418fdb35550506fdfd69800060011f0 Mon Sep 17 00:00:00 2001 From: "DESKTOP-474NEJQ\\xzsjob" <359059686@qq.com> Date: Tue, 8 Sep 2020 10:11:23 +0800 Subject: [PATCH] =?UTF-8?q?[=E4=BF=AE=E6=AD=A3]=20=E5=8D=95=E7=82=B9?= =?UTF-8?q?=E5=9B=BE=E6=A0=87=E7=BC=A9=E6=94=BE=E5=9B=BA=E5=AE=9A=E5=A4=A7?= =?UTF-8?q?=E5=B0=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/working-area/working-area.component.ts | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/app/working-area/working-area.component.ts b/src/app/working-area/working-area.component.ts index 9891df1..4d9e2f7 100644 --- a/src/app/working-area/working-area.component.ts +++ b/src/app/working-area/working-area.component.ts @@ -140,6 +140,8 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV if (delta > 0) { if (this.backgroundImage.scale.x >= 32) { this.backgroundImage.scale.x = 32; + this.backgroundImage.scale.y = 32; + this.emit('mouseWheel', this.backgroundImage.scale.x); return; } this.backgroundImage.pivot.set(pivot.x, pivot.y); @@ -151,7 +153,9 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV this.backgroundImage.position.y += delY; } else if (delta < 0) { if (this.backgroundImage.scale.x <= 0.1) { + this.backgroundImage.scale.x = 0.1; this.backgroundImage.scale.y = 0.1; + this.emit('mouseWheel', this.backgroundImage.scale.x); return; } this.backgroundImage.pivot.set(pivot.x, pivot.y); @@ -162,6 +166,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV this.backgroundImage.position.x += delX; this.backgroundImage.position.y += delY; } + this.emit('mouseWheel', this.backgroundImage.scale.x); } /** * 创建画布 @@ -845,8 +850,8 @@ export class SinglePointIcon extends PIXI.Container { this.y = this.assetData.Point.y; this.name = this.assetData.Id; const singlePointIcon = PIXI.Sprite.from(this.assetData.ImageUrl); - singlePointIcon.x = 0; // this.assetData.Point.x; - singlePointIcon.y = 0; // this.assetData.Point.y; + singlePointIcon.x = 0; + singlePointIcon.y = 0; singlePointIcon.width = this.assetData.Width; singlePointIcon.height = this.assetData.Height; @@ -892,6 +897,14 @@ export class SinglePointIcon extends PIXI.Container { }); + this.workingArea.on('mouseWheel', data => { + if (this.assetData.FixedSize) { + const scale = 1 / data; + console.log(scale); + this.scale.set(scale); + } + }); + this.text.x = singlePointIcon.x; this.text.y = singlePointIcon.y - singlePointIcon.height / 2; this.text.anchor.set(0.5, 1);