|
|
|
@ -127,11 +127,11 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
|
|
|
|
|
this.content.nativeElement.appendChild(this.app.view); |
|
|
|
|
|
|
|
|
|
this.createBackgroundImage(); |
|
|
|
|
this.createPreviewSinglePointIcon(); |
|
|
|
|
this.createPreviewLineSegment(); |
|
|
|
|
this.createCircleShadow(); |
|
|
|
|
// this.createPreviewSinglePointIcon();
|
|
|
|
|
// this.createPreviewLineSegment();
|
|
|
|
|
// this.createCircleShadow();
|
|
|
|
|
// this.createEnterPaintEndButton();
|
|
|
|
|
this.backgroundImage.addChild(this.paintingLine); |
|
|
|
|
// this.backgroundImage.addChild(this.paintingLine);
|
|
|
|
|
this.on('select', obj => { |
|
|
|
|
// console.log(obj.assetData);
|
|
|
|
|
// obj.assetData.Name = '这是我修改了的名字';
|
|
|
|
@ -170,8 +170,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
|
|
|
|
|
* 刷新 |
|
|
|
|
*/ |
|
|
|
|
public refresh(): void { |
|
|
|
|
// 清空画布
|
|
|
|
|
this.app.stage.removeChild(this.backgroundImage); |
|
|
|
|
this.destroyBackgroundImage(); |
|
|
|
|
this.createBackgroundImage(); |
|
|
|
|
this.refreshBackgroundImage(); |
|
|
|
|
this.versionChecking(); |
|
|
|
@ -238,161 +237,6 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
|
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// /**
|
|
|
|
|
// * 创建单点图标
|
|
|
|
|
// * @param source todo
|
|
|
|
|
// * @param x todo
|
|
|
|
|
// * @param y todo
|
|
|
|
|
// * @param width todo
|
|
|
|
|
// * @param height todo
|
|
|
|
|
// * @param alpha todo
|
|
|
|
|
// */
|
|
|
|
|
// private createSinglePointIcon(assetData: any): PIXI.Sprite {
|
|
|
|
|
// const singlePointIcon = PIXI.Sprite.from(assetData.ImageUri);
|
|
|
|
|
// singlePointIcon.x = assetData.Point.x;
|
|
|
|
|
// singlePointIcon.y = assetData.Point.y;
|
|
|
|
|
// singlePointIcon.width = assetData.Width;
|
|
|
|
|
// singlePointIcon.height = assetData.Height;
|
|
|
|
|
// singlePointIcon.alpha = 1;
|
|
|
|
|
// singlePointIcon.anchor.set(0.5);
|
|
|
|
|
// singlePointIcon.interactive = true;
|
|
|
|
|
// singlePointIcon.name = assetData.Name;
|
|
|
|
|
// singlePointIcon
|
|
|
|
|
// .on('mousedown', event => {
|
|
|
|
|
// event.stopPropagation();
|
|
|
|
|
|
|
|
|
|
// event.currentTarget.data = event.data;
|
|
|
|
|
// event.currentTarget.alpha = 0.5;
|
|
|
|
|
// event.currentTarget.dragging = true;
|
|
|
|
|
|
|
|
|
|
// this.selection.selectOne(event.currentTarget);
|
|
|
|
|
// })
|
|
|
|
|
// .on('mouseup', event => {
|
|
|
|
|
// event.currentTarget.alpha = 1;
|
|
|
|
|
// event.currentTarget.dragging = false;
|
|
|
|
|
// event.currentTarget.data = null;
|
|
|
|
|
// })
|
|
|
|
|
// .on('mouseupoutside', event => {
|
|
|
|
|
// event.currentTarget.alpha = 1;
|
|
|
|
|
// event.currentTarget.dragging = false;
|
|
|
|
|
// event.currentTarget.data = null;
|
|
|
|
|
// })
|
|
|
|
|
// .on('mousemove', event => {
|
|
|
|
|
// if (event.currentTarget.dragging) {
|
|
|
|
|
// const newPosition = event.currentTarget.data.getLocalPosition(event.currentTarget.parent);
|
|
|
|
|
// event.currentTarget.x = newPosition.x;
|
|
|
|
|
// event.currentTarget.y = newPosition.y;
|
|
|
|
|
// }
|
|
|
|
|
// })
|
|
|
|
|
// .on('rightclick', event => {
|
|
|
|
|
|
|
|
|
|
// });
|
|
|
|
|
// this.backgroundImage.addChild(singlePointIcon);
|
|
|
|
|
// return singlePointIcon;
|
|
|
|
|
// }
|
|
|
|
|
// /**
|
|
|
|
|
// * 多点连线
|
|
|
|
|
// * @param source todo
|
|
|
|
|
// * @param x todo
|
|
|
|
|
// * @param y todo
|
|
|
|
|
// * @param points todo
|
|
|
|
|
// */
|
|
|
|
|
// private createLineIcon(source: PIXI.Texture, x: number, y: number, points: PIXI.Point[]) {
|
|
|
|
|
// const container = new PIXI.Container();
|
|
|
|
|
// container.name = '多点连线';
|
|
|
|
|
// // 画点
|
|
|
|
|
// points.forEach((item, index, array) => {
|
|
|
|
|
// const iconPoint = new PIXI.Graphics();
|
|
|
|
|
// iconPoint.lineStyle(0);
|
|
|
|
|
// iconPoint.beginFill(0xFFFF0B, 1);
|
|
|
|
|
// iconPoint.drawCircle(0, 0, 15);
|
|
|
|
|
// iconPoint.x = item.x;
|
|
|
|
|
// iconPoint.y = item.y;
|
|
|
|
|
// iconPoint.endFill();
|
|
|
|
|
// container.addChild(iconPoint);
|
|
|
|
|
// });
|
|
|
|
|
// // 画线图标
|
|
|
|
|
// for (let i = 0, count = points.length - 1; i < count; i++) {
|
|
|
|
|
// const pointA = points[i];
|
|
|
|
|
// const pointB = points[i + 1];
|
|
|
|
|
|
|
|
|
|
// const angle = Math.atan2((pointB.y - pointA.y), (pointB.x - pointA.x)) * (180 / Math.PI);
|
|
|
|
|
// const a = pointB.x - pointA.x;
|
|
|
|
|
// const b = pointB.y - pointA.y;
|
|
|
|
|
// const distance = Math.sqrt(a * a + b * b);
|
|
|
|
|
|
|
|
|
|
// const icon = new PIXI.TilingSprite(source, distance, 64);
|
|
|
|
|
// icon.anchor.set(0, 0.5);
|
|
|
|
|
// icon.x = pointA.x;
|
|
|
|
|
// icon.y = pointA.y;
|
|
|
|
|
// icon.angle = angle;
|
|
|
|
|
// container.addChild(icon);
|
|
|
|
|
// }
|
|
|
|
|
// this.backgroundImage.addChild(container);
|
|
|
|
|
// // 添加事件
|
|
|
|
|
// container.children.forEach(item => {
|
|
|
|
|
// if (item instanceof PIXI.Graphics) {
|
|
|
|
|
// item.interactive = true;
|
|
|
|
|
// item.on('mousedown', event => {
|
|
|
|
|
// event.stopPropagation();
|
|
|
|
|
// event.currentTarget.data = event.data;
|
|
|
|
|
// event.currentTarget.alpha = 0.5;
|
|
|
|
|
// event.currentTarget.dragging = true;
|
|
|
|
|
// })
|
|
|
|
|
// .on('mouseup', event => {
|
|
|
|
|
// event.currentTarget.alpha = 1;
|
|
|
|
|
// event.currentTarget.dragging = false;
|
|
|
|
|
// event.currentTarget.data = null;
|
|
|
|
|
// })
|
|
|
|
|
// .on('mouseupoutside', event => {
|
|
|
|
|
// event.currentTarget.alpha = 1;
|
|
|
|
|
// event.currentTarget.dragging = false;
|
|
|
|
|
// event.currentTarget.data = null;
|
|
|
|
|
// })
|
|
|
|
|
// .on('mousemove', event => {
|
|
|
|
|
// if (event.currentTarget.dragging) {
|
|
|
|
|
// const newPosition = event.currentTarget.data.getLocalPosition(event.currentTarget.parent);
|
|
|
|
|
// event.currentTarget.x = newPosition.x;
|
|
|
|
|
// event.currentTarget.y = newPosition.y;
|
|
|
|
|
// }
|
|
|
|
|
// })
|
|
|
|
|
// .on('rightclick', event => {
|
|
|
|
|
// });
|
|
|
|
|
// } else if (item instanceof PIXI.TilingSprite) {
|
|
|
|
|
// item.interactive = true;
|
|
|
|
|
// item.on('mousedown', event => {
|
|
|
|
|
// event.stopPropagation();
|
|
|
|
|
// event.currentTarget.parent.data = event.data;
|
|
|
|
|
// event.currentTarget.parent.alpha = 0.5;
|
|
|
|
|
// event.currentTarget.parent.dragging = true;
|
|
|
|
|
|
|
|
|
|
// event.currentTarget.parent.dragPoint = event.data.getLocalPosition(event.currentTarget.parent.parent);
|
|
|
|
|
// event.currentTarget.parent.dragPoint.x -= event.currentTarget.parent.x;
|
|
|
|
|
// event.currentTarget.parent.dragPoint.y -= event.currentTarget.parent.y;
|
|
|
|
|
// })
|
|
|
|
|
// .on('mouseup', event => {
|
|
|
|
|
// event.currentTarget.parent.alpha = 1;
|
|
|
|
|
// event.currentTarget.parent.dragging = false;
|
|
|
|
|
// event.currentTarget.parent.data = null;
|
|
|
|
|
// })
|
|
|
|
|
// .on('mouseupoutside', event => {
|
|
|
|
|
// event.currentTarget.parent.alpha = 1;
|
|
|
|
|
// event.currentTarget.parent.dragging = false;
|
|
|
|
|
// event.currentTarget.parent.data = null;
|
|
|
|
|
// })
|
|
|
|
|
// .on('mousemove', event => {
|
|
|
|
|
// if (event.currentTarget.parent.dragging) {
|
|
|
|
|
// const newPosition = event.currentTarget.parent.data.getLocalPosition(event.currentTarget.parent.parent);
|
|
|
|
|
// event.currentTarget.parent.x = newPosition.x - event.currentTarget.parent.dragPoint.x;
|
|
|
|
|
// event.currentTarget.parent.y = newPosition.y - event.currentTarget.parent.dragPoint.y;
|
|
|
|
|
// }
|
|
|
|
|
// })
|
|
|
|
|
// .on('rightclick', event => {
|
|
|
|
|
// });
|
|
|
|
|
// }
|
|
|
|
|
// });
|
|
|
|
|
// }
|
|
|
|
|
/** |
|
|
|
|
* 创建确认绘制结束按钮 |
|
|
|
|
*/ |
|
|
|
@ -535,6 +379,11 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
|
|
|
|
|
this.selection.deselectAll(); |
|
|
|
|
}); |
|
|
|
|
this.app.stage.addChild(this.backgroundImage); |
|
|
|
|
|
|
|
|
|
this.createPreviewSinglePointIcon(); |
|
|
|
|
this.createPreviewLineSegment(); |
|
|
|
|
this.createCircleShadow(); |
|
|
|
|
this.backgroundImage.addChild(this.paintingLine); |
|
|
|
|
} |
|
|
|
|
/** |
|
|
|
|
* 刷新背景图 |
|
|
|
@ -548,6 +397,12 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
|
|
|
|
|
this.backgroundImage.visible = true; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
/** |
|
|
|
|
* 清空画布 |
|
|
|
|
*/ |
|
|
|
|
public destroyBackgroundImage(): void { |
|
|
|
|
this.app.stage.removeChild(this.backgroundImage); |
|
|
|
|
} |
|
|
|
|
/** |
|
|
|
|
* 设置背景图角度 |
|
|
|
|
* @param imageAngle 角度值 |
|
|
|
|