Browse Source

修正背景图地址为空时错误

develop
徐振升 4 years ago
parent
commit
7ae82c2090
  1. 14
      src/app/working-area/working-area.component.ts

14
src/app/working-area/working-area.component.ts

@ -506,6 +506,10 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
this.setPaintMode(PaintMode.endPaint);
this.resetCanvas();
this.destroyBackgroundImage();
if (this.canvasData.selectStorey.imageUrl === null) {
return;
}
console.log(this.canvasData.selectStorey.imageUrl);
await this.createBackgroundImage(this.canvasData.selectStorey.imageUrl);
this.createFloorShape();
if (this.canvasData.gameMode === GameMode.Assignment) {
@ -644,7 +648,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
this.backgroundImage.y = this.app.view.height / 2;
this.backgroundImage.interactive = true;
this.backgroundImage.name = 'background';
this.backgroundImage.angle = this.canvasData.selectStorey.imageAngle;
// const left = this.init.element.nativeElement.querySelector('.functionalDomainLeft').clientWidth;
// const right = this.init.element.nativeElement.querySelector('.functionalDomainRight').clientWidth;
const imageWidth = this.backgroundImage.texture.width;
@ -924,9 +928,10 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
if (!this.canvasData.selectStorey.imageUrl) {
this.backgroundImage.visible = false;
} else {
this.backgroundImage.texture = PIXI.Texture.from(this.canvasData.selectStorey.imageUrl);
this.backgroundImage.angle = this.canvasData.selectStorey.imageAngle;
this.backgroundImage.visible = true;
// this.backgroundImage.texture = PIXI.Texture.from(this.canvasData.selectStorey.imageUrl);
// this.backgroundImage.angle = this.canvasData.selectStorey.imageAngle;
// this.backgroundImage.visible = true;
this.refresh();
}
}
/**
@ -1158,7 +1163,6 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
case PaintMode.Pipeline:
if (this.canvasData.selectTemplateData.name !== '水带') {
this.emit('createIcon', this.paintingShape);
this.paintingShape = null;
}
break;
}

Loading…
Cancel
Save