邵佳豪 4 years ago
parent
commit
dc5b95ea36
  1. 35
      src/app/working-area/working-area.component.ts

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

@ -113,7 +113,6 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
const delY = this.mousePosition.y - this.backgroundImage.position.y;
const pivot = this.backgroundImage.toLocal(this.mousePosition);
const delta = Math.max(-1, Math.min(1, (event.wheelDelta || -event.detail)));
if (delta > 0) {
if (this.backgroundImage.scale.x >= 32) {
this.backgroundImage.scale.x = 32;
@ -165,7 +164,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
// obj.assetData.Name = '这是我修改了的名字';
// console.log(this.canvasData.originaleveryStoreyData.data[obj.assetData.Id]);
// console.log(this.canvasData.originalcompanyBuildingData.data[obj.assetData.Id]);
if (obj instanceof MultipointIcon) {
if (obj instanceof MultipointIcon) {
obj.setPointVisiable(true);
} else if (obj instanceof PolygonIcon) {
obj.setPointVisiable(true);
@ -210,6 +209,21 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
}
});
}
/**
*
* @param value
*/
public setIconScale(value: number): void {
this.backgroundImage.children.forEach(item => {
if (item instanceof SinglePointIcon) {
item.scale.set(value);
} else if (item instanceof MultipointIcon) {
} else if (item instanceof PolygonIcon) {
}
});
}
/**
*
*/
@ -280,8 +294,8 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
*
*/
public versionChecking(): void {
let floorData = this.canvasData.originaleveryStoreyData;
let buildingData = this.canvasData.originalcompanyBuildingData;
const floorData = this.canvasData.originaleveryStoreyData;
const buildingData = this.canvasData.originalcompanyBuildingData;
if (floorData.version && floorData.version === '1.0') {
floorData.version = '2.0';
Object.keys(floorData.data).forEach(item => {
@ -1079,12 +1093,15 @@ export class PolygonIcon extends PIXI.Container {
this.addChild(iconPoint);
});
// 填充多边形
this.polygonGraphics.beginFill(0xDC143C, 1);
const color: number = this.assetData.Color.substring(0, 7).replace('#', '0x');
const angle: number = parseInt(this.assetData.Color.substring(7), 16) / 255;
this.polygonGraphics.beginFill(color, angle);
this.polygonGraphics.drawPolygon(this.getPoints());
this.polygonGraphics.endFill();
this.addChild(this.polygonGraphics);
// 画多边形
this.polygonLineGraphics.lineStyle(1, 0xFFBD01, 1);
this.polygonLineGraphics.lineStyle(5, 0xFFBD01, 1);
this.polygonLineGraphics.drawPolygon(this.getPoints());
this.polygonLineGraphics.closePath();
this.addChild(this.polygonLineGraphics);
@ -1092,7 +1109,7 @@ export class PolygonIcon extends PIXI.Container {
this.text.anchor.set(0.5);
this.text.position = this.calculatePolygonGravityCenter(this.pointsData);
// console.log(this.calculatePolygonGravityCenter(this.pointsData));
this.polygonLineGraphics.addChild(this.text);
this.polygonGraphics.addChild(this.text);
// 添加圆点事件
this.pointsGraphics.forEach((item, index, array) => {
item.interactive = true;
@ -1127,12 +1144,12 @@ export class PolygonIcon extends PIXI.Container {
this.workingArea.canvasData.isChange = true;
// 填充多边形
this.polygonGraphics.clear();
this.polygonGraphics.beginFill(0xDC143C, 1);
this.polygonGraphics.beginFill(color, angle);
this.polygonGraphics.drawPolygon(this.getPoints());
this.polygonGraphics.endFill();
// 画多边形
this.polygonLineGraphics.clear();
this.polygonLineGraphics.lineStyle(1, 0xFFBD01, 1);
this.polygonLineGraphics.lineStyle(5, 0xFFBD01, 1);
this.polygonLineGraphics.drawPolygon(this.getPoints());
this.polygonLineGraphics.closePath();

Loading…
Cancel
Save