From 368c920d8deb2862a255486ca84197b9df5b1aaa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=8C=AF=E5=8D=87?= <359059686@qq.com> Date: Sun, 7 Feb 2021 10:10:03 +0800 Subject: [PATCH] =?UTF-8?q?[=E4=BF=AE=E6=AD=A3]=20=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E5=BA=95=E5=9B=BE=E5=A4=A7=E5=B0=8F=E5=90=8E=E4=BC=9A=E5=AF=B9?= =?UTF-8?q?=E8=AE=A1=E7=AE=97=E9=80=82=E5=BA=94=E7=BC=A9=E6=94=BE=E4=BA=A7?= =?UTF-8?q?=E7=94=9F=E9=94=99=E8=AF=AF=E7=9A=84=E8=AE=A1=E7=AE=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../working-area/working-area.component.ts | 34 ++++++++++++------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/src/app/working-area/working-area.component.ts b/src/app/working-area/working-area.component.ts index f458f80..207aa14 100644 --- a/src/app/working-area/working-area.component.ts +++ b/src/app/working-area/working-area.component.ts @@ -158,7 +158,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV * RC版: 该版本已经相当成熟了,基本上不存在导致错误的BUG,与即将发行的正式版相差无几。 * Release版: 该版本意味“最终版本”,在前面版本的一系列测试版之后,终归会有一个正式版本,是最终交付用户使用的一个版本。该版本有时也称为标准版。一般情况下,Release不会以单词形式出现在软件封面上,取而代之的是符号®。 */ - public VERSION = '1.0.19.20210206_beta'; + public VERSION = '1.0.20.20210207_beta'; /** * 数据初始化 */ @@ -468,8 +468,8 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV * 缩放适应 */ public zoomFit() { - const imageWidth = this.backgroundImage.texture.width; - const imageHeight = this.backgroundImage.texture.height; + const imageWidth = this.backgroundImage.width; + const imageHeight = this.backgroundImage.height; const appWidth = this.app.view.width - 470; const appHeight = this.app.view.height; const wScale = appWidth / imageWidth; @@ -983,24 +983,32 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV if (imageAngle === undefined || imageAngle === null) { imageAngle = 0; } - if (imageWidth === undefined || imageWidth === null || imageWidth === 0) { - imageWidth = 1; - } - if (imageHeight === undefined || imageHeight === null || imageHeight === 0) { - imageHeight = 1; - } this.backgroundImage.scale.set(1); + // this.backgroundImage.pivot.set(0); if (imageUrl === undefined || imageUrl === null || imageUrl === '') { this.backgroundImage.texture = this.backgroundTexture; } else { this.backgroundImage.texture = await PIXI.Texture.fromURL(imageUrl); } - this.backgroundImage.x = this.backgroundImage.width / 2; - this.backgroundImage.y = this.backgroundImage.height / 2; + this.backgroundImage.angle = imageAngle; - this.backgroundImage.width = imageWidth; - this.backgroundImage.height = imageHeight; + if (imageWidth !== undefined + && imageWidth !== null + && imageWidth !== 0 + && imageHeight !== undefined + && imageHeight !== null + && imageHeight !== 0) { + console.log(imageWidth, imageHeight); + this.backgroundImage.width = imageWidth; + this.backgroundImage.height = imageHeight; + } else { + this.backgroundImage.width = this.backgroundImage.texture.width; + this.backgroundImage.height = this.backgroundImage.texture.height; + } + + this.backgroundImage.x = this.backgroundImage.width / 2; + this.backgroundImage.y = this.backgroundImage.height / 2; this.resetCamera2D(); }