Browse Source

[新增] 现在允许创建车辆时取消创建

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

38
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);
}
})

Loading…
Cancel
Save