Browse Source

[新增] 多边形颜色

develop
徐振升 4 years ago
parent
commit
0ce27f140e
  1. 13
      src/app/working-area/working-area.component.ts

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

@ -1079,12 +1079,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 +1095,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 +1130,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