Browse Source

[优化] 拖动显示创建区域与修改车头方向

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

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

@ -2351,21 +2351,29 @@ export class SinglePointIcon extends PIXI.Container {
event.currentTarget.parent.y = newPosition.y;
this.assetData.Point = new PIXI.Point(this.x, this.y);
this.workingArea.canvasData.isChange = true;
// // 拖动过程中判断车辆放置区域是否包含当前图标位置
// let b = false;
// this.workingArea.backgroundImage.children.forEach(item => {
// if (item instanceof PutCarArea) {
// console.log(item.polygonGraphics._bounds)
// if (item.polygonGraphics.containsPoint(newPosition)) {
// b = true;
// }
// }
// });
// if (b) {
// console.log('当前点可以创建');
// } else {
// console.log('当前点不可以创建');
// }
// 拖动过程中判断车辆放置区域是否包含当前图标位置
console.log(this.position);
let b = false;
let direction = 0;
this.workingArea.backgroundImage.children.forEach(item => {
if (item instanceof PutCarArea) {
if (item.polygonGraphics.interactive && item.polygonGraphics.containsPoint(this.workingArea.mousePosition)) {
b = true;
direction = item.assetData.Direction;
}
}
});
if (b) {
// console.log('当前点可以创建');
this.image.filters = null;
// 设置车辆方向
this.image.angle = direction;
} else {
// console.log('当前点不可以创建');
this.image.filters = [
new OldFilmFilter()
];
}
}
})
.on('rightclick', event => {

Loading…
Cancel
Save