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

Loading…
Cancel
Save