diff --git a/src/app/working-area/working-area.component.ts b/src/app/working-area/working-area.component.ts index 4070d2d..beb2d58 100644 --- a/src/app/working-area/working-area.component.ts +++ b/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 => {