From d59bf7c7b9ba5a0563108f2deea9b3f53cd76a93 Mon Sep 17 00:00:00 2001 From: "DESKTOP-474NEJQ\\xzsjob" <359059686@qq.com> Date: Mon, 19 Oct 2020 09:58:15 +0800 Subject: [PATCH] =?UTF-8?q?[=E6=96=B0=E5=A2=9E]=20=20=E7=8E=B0=E5=9C=A8?= =?UTF-8?q?=E5=85=81=E8=AE=B8=E5=88=9B=E5=BB=BA=E8=BD=A6=E8=BE=86=E6=97=B6?= =?UTF-8?q?=E5=8F=96=E6=B6=88=E5=88=9B=E5=BB=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../working-area/working-area.component.ts | 38 +++++++++++++++---- 1 file changed, 30 insertions(+), 8 deletions(-) diff --git a/src/app/working-area/working-area.component.ts b/src/app/working-area/working-area.component.ts index c10e274..bf31285 100644 --- a/src/app/working-area/working-area.component.ts +++ b/src/app/working-area/working-area.component.ts @@ -8,12 +8,14 @@ import {CacheTokenService} from '../http-interceptors/cache-token.service'; // import * as ObjectID from 'bson-objectid'; import { Router } from '@angular/router'; import { Charm } from './charm'; +import { stringify } from 'querystring'; +import { PolylineArrowMaterialProperty } from 'cesium'; @Component({ selector: 'app-working-area', templateUrl: './working-area.component.html', - styleUrls: ['./working-area.component.scss'] + styleUrls: ['./working-area.component.scss'], }) export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterViewInit { @@ -117,7 +119,10 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV * 允许编辑 */ public allowEdit = false; - + /** + * 选择的按钮 + */ + public selectedButton = null; public c; public animation; public animationIcon; @@ -260,7 +265,8 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV * @param icon 移动到选中车辆到屏幕中心点 */ public moveIconToScreenCenter(icon) { - if (icon.parent === this.backgroundImage && ( + if (icon !== null && + icon.parent === this.backgroundImage && ( icon.assetData.Type === 1 || icon.assetData.Type === 2 || icon.assetData.Type === 3 || @@ -304,7 +310,9 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV // this.createEnterPaintEndButton(); // this.backgroundImage.addChild(this.paintingLine); this.on('select', obj => { - console.log(obj); + console.log(obj+"1111"); + // tslint:disable-next-line: curly + if (obj === null) return; this.moveIconToScreenCenter(obj); if (this.allowEdit) { if (obj instanceof MultipointIcon) { @@ -335,6 +343,8 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV } }); this.on('deselect', obj => { + // tslint:disable-next-line: curly + if (obj === null) return; if (this.allowEdit) { if (obj instanceof MultipointIcon) { obj.setPointVisiable(false); @@ -473,6 +483,10 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV * 刷新 */ public refresh(): void { + console.log(this.canvasData.planSelectData); + + console.log(this.canvasData.getCarTypesAndCount()); + this.destroyBackgroundImage(); this.createBackgroundImage(); this.refreshBackgroundImage(); @@ -1575,16 +1589,18 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV this.carData.set(data.Id, data); const carButton = PIXI.Sprite.from(data.ImageUrl); - carButton.name = data.Id; + // carButton.name = data.Id; carButton.buttonMode = true; carButton.interactive = true; carButton .on('pointerdown', (event) => { if (this.paintMode !== PaintMode.Car) { + this.selectedButton = carButton; this.setPaintMode(PaintMode.Car); - this.selectCar = this.carData.get(event.currentTarget.name); - event.currentTarget.name = ''; - event.currentTarget.visible = false; + this.selectCar = this.carData.get(data.Id); + // event.currentTarget.name = ''; + //event.currentTarget.visible = false; + this.selectedButton.visible = false; this.previewSinglePointIcon.texture = PIXI.Texture.from(data.ImageUrl); this.previewSinglePointIcon.visible = true; this.previewSinglePointIcon.scale.set(1 / this.backgroundImage.scale.x); @@ -1905,6 +1921,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV }).on('rightclick', event => { event.stopPropagation(); this.cancelPaint(); + this.setPaintMode(PaintMode.endPaint); this.selection.deselectAll(); }) .on('pointerover', (event) => { @@ -2106,6 +2123,10 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV switch (mode) { case PaintMode.endPaint: this.selectCar = null; + if (this.selectedButton) { + this.selectedButton.visible = true; + this.selectedButton = null; + } this.backgroundImage.children.forEach(item => { if (item instanceof PutCarArea) { if (item.assetData.Type.indexOf(this.selectCar?.Type) !== -1) { @@ -2951,6 +2972,7 @@ export class PutCarArea extends PIXI.Container { new PIXI.Point(this.workingArea.previewSinglePointIcon.x, this.workingArea.previewSinglePointIcon.y); this.workingArea.selectCar.Angle = this.assetData.Direction; const car = new SinglePointIcon(this.workingArea.selectCar, this.workingArea); + this.workingArea.selectedButton = null; this.workingArea.setPaintMode(PaintMode.endPaint); } })