Browse Source

[优化] 按产品要求修改 多点连线/多边形 确认绘制按钮的位置

develop
徐振升 4 years ago
parent
commit
c27282e3ab
  1. 51
      src/app/working-area/working-area.component.ts

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

@ -81,6 +81,8 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
*
*/
public copyData: any[] = [];
private enterPaintEndButton = PIXI.Sprite.from('assets/images/enterPaintButton.jpg');
// 根据ID 找到图标
// 根据ID 找到数据
@ -359,23 +361,30 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
*
*/
private createEnterPaintEndButton() {
const enterPaintEndButton = PIXI.Sprite.from('assets/images/enterPaintButton.jpg');
enterPaintEndButton.width = 60;
enterPaintEndButton.height = 60;
enterPaintEndButton.anchor.set(0.5);
enterPaintEndButton.position = this.circleShadow.position;
enterPaintEndButton.interactive = true;
enterPaintEndButton.buttonMode = true;
enterPaintEndButton
this.enterPaintEndButton.width = 60;
this.enterPaintEndButton.height = 60;
this.enterPaintEndButton.anchor.set(0.5);
this.enterPaintEndButton.position = new PIXI.Point(0, 0);
this.enterPaintEndButton.interactive = true;
this.enterPaintEndButton.buttonMode = true;
this.enterPaintEndButton
.on('mousedown', event => {
event.stopPropagation();
this.emit('createIcon');
this.backgroundImage.removeChild(event.currentTarget);
this.enterPaintEndButton.visible = false;
this.enterPaint();
});
this.backgroundImage.addChild(enterPaintEndButton);
enterPaintEndButton.zIndex = this.backgroundImage.children.length;
this.backgroundImage.addChild(this.enterPaintEndButton);
this.enterPaintEndButton.zIndex = this.backgroundImage.children.length;
this.enterPaintEndButton.visible = false;
}
// /**
// * 刷新确认按钮
// */
// private refreshEnterPaintEndButton() {
// this.enterPaintEndButton.position = this.circleShadow.position;
// this.enterPaintEndButton.visible = true;
// }
/**
*
*/
@ -451,8 +460,9 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
this.currentClickPoint.position = new PIXI.Point(this.circleShadow.x, this.circleShadow.y);
this.paintPoints.push(new PIXI.Point(this.circleShadow.x, this.circleShadow.y));
if (this.paintPoints.length === 2) {
this.createEnterPaintEndButton();
if (this.paintPoints.length >= 2) {
this.enterPaintEndButton.position = this.circleShadow.position;
this.enterPaintEndButton.visible = true;
}
if (this.paintingIcon !== null) {
@ -504,9 +514,10 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
this.previewLineSegment.visible = true;
this.currentClickPoint.position = new PIXI.Point(this.circleShadow.x, this.circleShadow.y);
this.paintPoints.push(new PIXI.Point(this.circleShadow.x, this.circleShadow.y));
if (this.paintPoints.length === 3) {
this.createEnterPaintEndButton();
if (this.paintPoints.length === 1) {
this.enterPaintEndButton.position = this.circleShadow.position;
} else if (this.paintPoints.length >= 3) {
this.enterPaintEndButton.visible = true;
}
this.paintPoints.forEach((value, index, array) => {
if (index === 0) {
@ -560,6 +571,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
this.createPreviewSinglePointIcon();
this.createPreviewLineSegment();
this.createCircleShadow();
this.createEnterPaintEndButton();
this.backgroundImage.addChild(this.paintingLine);
}
/**
@ -909,12 +921,14 @@ export class SinglePointIcon extends PIXI.Container {
})
.on('rightclick', event => {
})
.on('mouseover', event => {
});
this.workingArea.on('backgroundScale', data => {
if (this.assetData.FixedSize) {
const scale = 1 / data;
console.log(scale);
this.scale.set(scale);
}
});
@ -1101,6 +1115,9 @@ export class MultipointIcon extends PIXI.Container {
}
})
.on('rightclick', event => {
})
.on('mouseover', event => {
});
});
// 添加选中事件

Loading…
Cancel
Save