|
|
|
@ -277,7 +277,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
|
|
|
|
|
this.previewImage.position = this.backgroundImage.toLocal(this.mousePosition); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (this.backgroundImage !== null) { |
|
|
|
|
if (this.circleShadow !== null && this.backgroundImage !== null) { |
|
|
|
|
this.circleShadow.position = this.backgroundImage.toLocal(this.mousePosition); |
|
|
|
|
this.refreshPreviewLineSegment(this.currentClickPoint.position, this.circleShadow.position); |
|
|
|
|
} |
|
|
|
@ -401,8 +401,17 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
|
|
|
|
|
this.canvasData.selectPanelPoint.Data = new FloorNodeData(); |
|
|
|
|
} |
|
|
|
|
this.canvasData.selectPanelPoint.Data.Stock[obj.assetData.Id] = obj.assetData; |
|
|
|
|
} else if (obj.assetData.GameMode === GameMode.Examinee) { // 考生考试
|
|
|
|
|
// this.canvasData.examOriginaleveryStoreyData.data[obj.assetData.Id] = obj.assetData;
|
|
|
|
|
} else if (obj.assetData.GameMode === GameMode.Examinee) { // 考生考试
|
|
|
|
|
console.log(obj.assetData.Tag) |
|
|
|
|
if (obj.assetData.Tag === 1) { |
|
|
|
|
this.canvasData.examOriginaleveryStoreyData.data[obj.assetData.Id] = obj.assetData; |
|
|
|
|
} else { |
|
|
|
|
if (this.canvasData.selectPanelPoint.Data === undefined |
|
|
|
|
|| this.canvasData.selectPanelPoint.Data === null) {
|
|
|
|
|
this.canvasData.selectPanelPoint.Data = new FloorNodeData(); |
|
|
|
|
} |
|
|
|
|
this.canvasData.selectPanelPoint.Data.Stock[obj.assetData.Id] = obj.assetData; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
this.canvasData.isChange = true; |
|
|
|
|
}); |
|
|
|
@ -479,30 +488,53 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
|
|
|
|
|
// * 刷新工作区
|
|
|
|
|
// */
|
|
|
|
|
public async refresh() { |
|
|
|
|
this.setPaintMode(PaintMode.endPaint); |
|
|
|
|
this.resetCanvas(); |
|
|
|
|
this.destroyBackgroundImage(); |
|
|
|
|
if (!this.canvasData.selectStorey.imageUrl) { |
|
|
|
|
this.loadExamineeData(); |
|
|
|
|
// this.setPaintMode(PaintMode.endPaint);
|
|
|
|
|
// this.resetCanvas();
|
|
|
|
|
// this.destroyBackgroundImage();
|
|
|
|
|
// if (!this.canvasData.selectStorey.imageUrl) {
|
|
|
|
|
|
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
// return;
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
await this.createBackgroundImage(this.canvasData.selectStorey.imageUrl); |
|
|
|
|
this.createFloorShape(this.canvasData.originaleveryStoreyData.data); |
|
|
|
|
if (this.canvasData.gameMode === GameMode.Assignment) { |
|
|
|
|
this.createNodeShape(this.canvasData.selectPanelPoint.Data); |
|
|
|
|
// await this.createBackgroundImage(this.canvasData.selectStorey.imageUrl);
|
|
|
|
|
// this.createFloorShape(this.canvasData.originaleveryStoreyData.data);
|
|
|
|
|
// if (this.canvasData.gameMode === GameMode.Assignment) {
|
|
|
|
|
// this.createNodeShape(this.canvasData.selectPanelPoint.Data);
|
|
|
|
|
// }
|
|
|
|
|
} |
|
|
|
|
/** |
|
|
|
|
* 加载考生数据 |
|
|
|
|
*/ |
|
|
|
|
public loadExamineeData() { |
|
|
|
|
this.createBackground();// 创建背景图
|
|
|
|
|
this.refreshBackgroundImage();// 刷新背景图
|
|
|
|
|
this.processinghiddenData();// 处理数据
|
|
|
|
|
this.createFloorShape(this.canvasData.originaleveryStoreyData.data);// 基本信息
|
|
|
|
|
this.createFloorShape(this.canvasData.examOriginaleveryStoreyData.data);// 考生信息
|
|
|
|
|
this.createNodeShape(this.canvasData.selectPanelPoint.Data);// 处置节点
|
|
|
|
|
} |
|
|
|
|
/** |
|
|
|
|
* 处理隐藏数据 |
|
|
|
|
*/ |
|
|
|
|
public processinghiddenData() { |
|
|
|
|
for (let key1 in this.canvasData.originaleveryStoreyData.data){ |
|
|
|
|
for (let key2 in this.canvasData.hiddenBasicInfoFacilities){ |
|
|
|
|
if (this.canvasData.originaleveryStoreyData.data[key1].Id==this.canvasData.hiddenBasicInfoFacilities[key2].Id) { |
|
|
|
|
delete this.canvasData.originaleveryStoreyData.data[key1]; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
// await this.createBackground(this.canvasData.selectStorey.imageUrl);
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
/** |
|
|
|
|
* 异步创建背景图 |
|
|
|
|
*/ |
|
|
|
|
public async createBackground(imageUrl:string) { |
|
|
|
|
public createBackground() { |
|
|
|
|
if (this.backgroundImage !== null) { |
|
|
|
|
this.destroyBackgroundImage(); |
|
|
|
|
this.backgroundImage.destroy(); |
|
|
|
|
this.backgroundImage = null; |
|
|
|
|
}
|
|
|
|
|
await this.createBackgroundImage(imageUrl) |
|
|
|
|
this.createBackgroundImage() |
|
|
|
|
} |
|
|
|
|
/** |
|
|
|
|
* 创建楼层图形 |
|
|
|
@ -630,19 +662,16 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
|
|
|
|
|
/** |
|
|
|
|
* 创建背景图 |
|
|
|
|
*/ |
|
|
|
|
public async createBackgroundImage(imageUrl: string): Promise<void> { |
|
|
|
|
const image = await PIXI.Texture.fromURL(imageUrl); |
|
|
|
|
this.backgroundImage = new PIXI.Sprite(image); |
|
|
|
|
public createBackgroundImage(){ |
|
|
|
|
this.backgroundImage = PIXI.Sprite.from('assets/images/noImg.png') |
|
|
|
|
this.backgroundImage.anchor.set(0.5); |
|
|
|
|
this.backgroundImage.x = this.app.view.width / 2; |
|
|
|
|
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; |
|
|
|
|
const imageHeight = this.backgroundImage.texture.height; |
|
|
|
|
const imageWidth = 665; |
|
|
|
|
const imageHeight = 530; |
|
|
|
|
const appWidth = this.app.view.width - 470; |
|
|
|
|
const appHeight = this.app.view.height; |
|
|
|
|
|
|
|
|
@ -698,7 +727,8 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
|
|
|
|
|
DrawMode : this.canvasData.selectTemplateData.drawMode, |
|
|
|
|
Thickness : this.canvasData.selectTemplateData.thickness, |
|
|
|
|
IsFromBuilding : this.canvasData.selectTemplateData.isFromBuilding, |
|
|
|
|
GameMode : this.canvasData.gameMode |
|
|
|
|
GameMode: this.canvasData.gameMode, |
|
|
|
|
Tag: this.canvasData.selectTemplateData.tag |
|
|
|
|
}; |
|
|
|
|
const singleIcon = new AxImageShape(assetData, this); |
|
|
|
|
this.emit('createIcon', singleIcon); |
|
|
|
@ -745,7 +775,8 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
|
|
|
|
|
DrawMode: this.canvasData.selectTemplateData.drawMode, |
|
|
|
|
Thickness: this.canvasData.selectTemplateData.thickness, |
|
|
|
|
IsFromBuilding: this.canvasData.selectTemplateData.isFromBuilding, |
|
|
|
|
GameMode: this.canvasData.gameMode |
|
|
|
|
GameMode: this.canvasData.gameMode, |
|
|
|
|
Tag: this.canvasData.selectTemplateData.tag |
|
|
|
|
}; |
|
|
|
|
// const assetData1 = {
|
|
|
|
|
// ImageUrl: this.canvasData.selectTemplateData.imageUrl,
|
|
|
|
@ -830,7 +861,8 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
|
|
|
|
|
DrawMode: this.canvasData.selectTemplateData.drawMode, |
|
|
|
|
Thickness: this.canvasData.selectTemplateData.thickness, |
|
|
|
|
IsFromBuilding: this.canvasData.selectTemplateData.isFromBuilding, |
|
|
|
|
GameMode: this.canvasData.gameMode |
|
|
|
|
GameMode: this.canvasData.gameMode, |
|
|
|
|
Tag: this.canvasData.selectTemplateData.tag |
|
|
|
|
}; |
|
|
|
|
if (this.canvasData.selectTemplateData.name === '距离') { |
|
|
|
|
this.paintingShape = new AxArrowConnector(assetData2, this,true,true);
|
|
|
|
@ -934,14 +966,23 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
|
|
|
|
|
/** |
|
|
|
|
* 刷新背景图 |
|
|
|
|
*/ |
|
|
|
|
public refreshBackgroundImage(): void { |
|
|
|
|
public async refreshBackgroundImage(): Promise<void> { |
|
|
|
|
if (!this.canvasData.selectStorey.imageUrl) { |
|
|
|
|
this.backgroundImage.visible = false; |
|
|
|
|
} else { |
|
|
|
|
this.backgroundImage.texture = PIXI.Texture.from(this.canvasData.selectStorey.imageUrl); |
|
|
|
|
this.backgroundImage.texture = await PIXI.Texture.fromURL(this.canvasData.selectStorey.imageUrl); |
|
|
|
|
const imageWidth = this.backgroundImage.texture.width; |
|
|
|
|
const imageHeight = this.backgroundImage.texture.height; |
|
|
|
|
const appWidth = this.app.view.width - 470; |
|
|
|
|
const appHeight = this.app.view.height; |
|
|
|
|
|
|
|
|
|
const wScale = appWidth / imageWidth; |
|
|
|
|
const hScale = appHeight / imageHeight; |
|
|
|
|
|
|
|
|
|
const scale = wScale < hScale? wScale: hScale; |
|
|
|
|
this.backgroundImage.scale.set(scale); |
|
|
|
|
this.backgroundImage.angle = this.canvasData.selectStorey.imageAngle; |
|
|
|
|
this.backgroundImage.visible = true; |
|
|
|
|
// this.refresh();
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
/** |
|
|
|
|