Browse Source

[修正] 调整底图大小后会对计算适应缩放产生错误的计算

master
徐振升 4 years ago
parent
commit
7fecb604a2
  1. 37
      src/app/working-area/working-area.component.ts

37
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.18.20210205_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;
@ -974,26 +974,43 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
/**
*
*/
public async refreshBackgroundImage(imageUrl: string = this.canvasData.selectStorey.imageUrl, imageAngle: number = this.canvasData.selectStorey.imageAngle): Promise<void> {
public async refreshBackgroundImage(
imageUrl: string = this.canvasData.selectStorey.imageUrl,
imageAngle: number = this.canvasData.selectStorey.imageAngle,
imageWidth: number = this.canvasData.selectStorey.imageWidth,
imageHeight: number = this.canvasData.selectStorey.imageHeight,
): Promise<void> {
if (imageAngle === undefined || imageAngle === null) {
imageAngle = 0;
}
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.angle = imageAngle;
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.backgroundImage.angle = imageAngle;
this.resetCamera2D();
// this.backgroundImage.children.forEach((item) => {
// if (item instanceof AxShape) {
// item.refresh();
// }
// });
}
/**
*

Loading…
Cancel
Save