Browse Source

删除设备

dev
陈鹏飞 3 years ago
parent
commit
c698f1e918
  1. 39
      src/app/babylon/view/facilityinfoinscene-window/facilityinfoinscene-window.ts
  2. 27
      src/app/pages/plan/plan.component.ts

39
src/app/babylon/view/facilityinfoinscene-window/facilityinfoinscene-window.ts

@ -151,30 +151,21 @@ export class FacilityInfoInSceneWindow extends UIBase {
//选中,通知前端
selectFacilityItemToThree(facilityInfoUIItem: FacilityInfoUIItem[], isChecked?: boolean) {
this.three = PlanComponent.instance;
// if (this.isMultiselect) { // 多选
// if (isChecked) { //选中
// facilityInfoUIItem.forEach(element => {
// element.isChecked = isChecked
// let isFind = this.three.beforeOnefacilityInfoList.find(item => { return item === element.getID() })
// isFind == undefined || isFind == null ? this.three.beforeOnefacilityInfoList.push(element.getID()) : null
// })
// } else { //取消选中
// this.three.isShowRightNature = false
// facilityInfoUIItem.forEach(element => {
// element.isChecked = isChecked
// let index = this.three.beforeOnefacilityInfoList.findIndex(value => value === element.getID())
// index != undefined && index != null ? this.three.beforeOnefacilityInfoList.splice(index, 1) : null
// })
// }
// } else { // 单选
// if (isChecked) { //选中
// this.three.beforeOnefacilityInfo = facilityInfoUIItem[0].getID();
// this.three.getPropertyData(facilityInfoUIItem[0])
// } else { //取消选中
// this.three.isShowRightNature = false
// this.three.beforeOnefacilityInfo = null
// }
// }
if (this.isMultiselect) { // 多选
if (isChecked) { //选中
} else { //取消选中
}
} else { // 单选
if (isChecked) { //选中
this.three.beforeOnefacilityInfo = facilityInfoUIItem[0].getID();
this.three.getPropertyData(facilityInfoUIItem[0])
} else { //取消选中
// this.three.isShowRightNature = false
this.three.beforeOnefacilityInfo = null
}
}
}
/**

27
src/app/pages/plan/plan.component.ts

@ -14,6 +14,8 @@ import { BuildingType } from 'src/app/babylon/model/data/institution/building/bu
import { BuildingWindow } from 'src/app/babylon/view/building-window/building-window';
import { FacilityUIItem } from 'src/app/babylon/view/facility-window/facility-ui-item';
import { FacilityWindow } from 'src/app/babylon/view/facility-window/facility-window';
import { FacilityInfoUIItem } from 'src/app/babylon/view/facilityinfoinscene-window/facilityinfo-ui-item';
import { EventManager } from '@angular/platform-browser';
@ -24,7 +26,7 @@ import { FacilityWindow } from 'src/app/babylon/view/facility-window/facility-wi
})
export class PlanComponent implements OnInit {
constructor(private element: ElementRef, private buildingBISrv: BuildingBasicInfosService, private objectsSrv: ObjectsService) { }
constructor(private element: ElementRef, private buildingBISrv: BuildingBasicInfosService, private objectsSrv: ObjectsService, private eventManager: EventManager) { }
static instance: PlanComponent;
public game: Game = new Game();
@ -36,6 +38,16 @@ export class PlanComponent implements OnInit {
ServeManager.Init(this.buildingBISrv, this.objectsSrv);
this.canvas = this.element.nativeElement.querySelector('#center') as HTMLCanvasElement;
this.game.init(this.canvas);
//监听 delete键盘事件
this.eventManager.addGlobalEventListener('window', 'keydown', (event: any) => {
if (event.keyCode == 46) { //delete
if (this.beforeOnePropertyData) {
let isDelete = confirm("是否删除已选择模型?");
if (isDelete) { this.beforeOnePropertyData.askDelete(false) };
}
}
})
//监听 delete键盘事件
}
ngAfterViewInit(): void {
@ -179,6 +191,14 @@ export class PlanComponent implements OnInit {
e == 0 ? bootomDiv.scrollLeft = bootomDiv.scrollLeft + 50 : bootomDiv.scrollLeft = bootomDiv.scrollLeft - 50
}
beforeOnePropertyData: FacilityInfoUIItem = null; //当前选择 设备
beforeOnefacilityInfo: string = null; //当前选择 设备ID
//获取选择设备 属性
getPropertyData(e: FacilityInfoUIItem) {
this.beforeOnePropertyData = e
}
selectRightTopFast: number = 0; //当前选择功能 快捷栏
selectAdsorb: boolean = false; //吸附状态
topLevelView: boolean = false; //顶视图状态
@ -190,7 +210,10 @@ export class PlanComponent implements OnInit {
//清空设备
clearDevice() {
ToolbarWindow.instance.clearHomeLessFacilityData()
let isClear = confirm('您确定要清空吗?')
if (isClear) {
ToolbarWindow.instance.clearHomeLessFacilityData()
}
}
//平移

Loading…
Cancel
Save