diff --git a/src/app/babylon/controller/config-manager.ts b/src/app/babylon/controller/config-manager.ts index a8801b0..9cdd168 100644 --- a/src/app/babylon/controller/config-manager.ts +++ b/src/app/babylon/controller/config-manager.ts @@ -43,7 +43,7 @@ export class ConfigManager { case FacilityType.QY: case FacilityType.TPBZ: case FacilityType.DWBZ: - case FacilityType.JY_JYJ://临时 + // case FacilityType.JY_JYJ://临时 case FacilityType.JY_YG://临时 result = true; diff --git a/src/app/babylon/model/info/model/model-info-facility.ts b/src/app/babylon/model/info/model/model-info-facility.ts index 207b1a9..6c41152 100644 --- a/src/app/babylon/model/info/model/model-info-facility.ts +++ b/src/app/babylon/model/info/model/model-info-facility.ts @@ -47,15 +47,18 @@ export class ModelInfo_facility extends ModelInfo { onCreateFollowUI() { let facilityData = this.modelData as ModelData_facility; + super.onCreateFollowUI(); + BabylonUIStyleTool.setStyle_size(this.uiFollowRoot, ConfigManager.c_size_facilityIconSize + "px", ConfigManager.c_size_facilityIconSize + "px"); if (!ConfigManager.getFacilityNeedIcon(facilityData.facilityType)) { return; } - super.onCreateFollowUI(); + + let instance = this; let posType = ConfigManager.getPosType(facilityData.facilityType); let iconPath = ConfigManager.getFacilityIconUrl(facilityData.facilityType, posType); - BabylonUIStyleTool.setStyle_size(this.uiFollowRoot, ConfigManager.c_size_facilityIconSize + "px", ConfigManager.c_size_facilityIconSize + "px"); + this.uiFollowRoot.thickness = 0; diff --git a/src/app/babylon/model/info/model/model-info.ts b/src/app/babylon/model/info/model/model-info.ts index 0aac638..199f9b5 100644 --- a/src/app/babylon/model/info/model/model-info.ts +++ b/src/app/babylon/model/info/model/model-info.ts @@ -144,6 +144,7 @@ export class ModelInfo { onCreateFollowUI() { this.uiFollowRoot = new Rectangle('follow_' + this.key); + this.uiFollowRoot.thickness = 0; UIManager.Instance.uiRoot.addControl(this.uiFollowRoot); } diff --git a/src/app/babylon/view/facilityinfoinscene-window/facilityinfo-ui-item.ts b/src/app/babylon/view/facilityinfoinscene-window/facilityinfo-ui-item.ts index 5a90ff2..0ff2857 100644 --- a/src/app/babylon/view/facilityinfoinscene-window/facilityinfo-ui-item.ts +++ b/src/app/babylon/view/facilityinfoinscene-window/facilityinfo-ui-item.ts @@ -96,6 +96,7 @@ export class FacilityInfoUIItem { this.facilityInfoInSceneWindow.selectFacilityItemToThree([this], true); this.modelInfo.setIconEnable(select); this.facilityInfoInSceneWindow.playJYJSelectEffect(select, this.modelInfo) + this.setHeadUICurrentPos(); } else { this.facilityInfoInSceneWindow.selectFacilityItemToThree([this], false); @@ -137,18 +138,32 @@ export class FacilityInfoUIItem { } + /** + * 当前ui位置 + */ + currentUIPos: Vector2 = Vector2.Zero(); + /** * 获取头部UI的位置(像素) */ getHeadUIPos(): Vector2 { if (this.modelInfo != null) { - return this.modelInfo.getHeadUIPos(); + + this.currentUIPos = Vector2.Lerp(this.currentUIPos, this.modelInfo.getHeadUIPos(), 0.3); + + return this.currentUIPos; } else { return null; } } + /** + * 设置UI当前位置起点(配合缓动) + */ + setHeadUICurrentPos() { + this.currentUIPos = this.modelInfo.getHeadUIPos(); + } } \ No newline at end of file diff --git a/src/app/pages/left-domain/left-domain.component.ts b/src/app/pages/left-domain/left-domain.component.ts index 02c336b..4fcf754 100644 --- a/src/app/pages/left-domain/left-domain.component.ts +++ b/src/app/pages/left-domain/left-domain.component.ts @@ -283,7 +283,6 @@ export class LeftDomainComponent implements OnInit { this.updateFatherData(index) //更新/初始化父组件 数据 PlanComponent.instance.initViewer() MarkWindow.instance.selectMarkNode(item.id, e.id) - PlanComponent.instance.beforePlanNode = MarkWindow.instance.currentMarkNodeInfo.nodeData } else if (this.selectPlanId === item.id && this.selectNodeId === e.id) { //取消选中 this.selectPlanId = null this.selectNodeId = null diff --git a/src/app/pages/plan/plan.component.ts b/src/app/pages/plan/plan.component.ts index 300ace5..a03de7e 100644 --- a/src/app/pages/plan/plan.component.ts +++ b/src/app/pages/plan/plan.component.ts @@ -30,6 +30,7 @@ import { Event_GetAllMarkPlanData } from 'src/app/babylon/controller/event-manag import { FacilityInfoInSceneWindow } from 'src/app/babylon/view/facilityinfoinscene-window/facilityinfoinscene-window'; import { FacilityType } from 'src/app/babylon/model/data/model-data/model-data-facility'; import { HttpClient } from '@angular/common/http'; +import { DataBuffer } from '@babylonjs/core'; @@ -54,6 +55,8 @@ export class PlanComponent implements OnInit { public isShowLoading: boolean = true; //显隐 loading加载条 public companyData: any; //当前加油站所属组织机构 data + private readonly c_frameSpace = 16;//更新的帧间隔, 16大概是60帧每秒 + private lasteUpdateTime = 0;//上次更新的时间(毫秒) ngOnInit(): void { PlanComponent.instance = this; @@ -79,6 +82,9 @@ export class PlanComponent implements OnInit { } }) //监听 delete键盘事件 + this.game.scene.onBeforeRenderObservable.add(() => { + PlanComponent.instance.onUpdate(); + }) } ngAfterViewInit(): void { @@ -123,7 +129,16 @@ export class PlanComponent implements OnInit { }) } - ngAfterViewChecked () { + /** + * 三维渲染前(每帧调用) + */ + onUpdate() { + let currentTime = new Date().getTime(); + let space = currentTime - this.lasteUpdateTime; + if (space < this.c_frameSpace) { + return; + } + this.lasteUpdateTime = currentTime; if (this.isShowNature && this.beforeOnePropertyData && (this.selectFence === 1 || this.selectFence === 2)) { //刷新弹窗 位置 this.renovateDialogPosition() } @@ -398,15 +413,17 @@ export class PlanComponent implements OnInit { window.setTimeout(() => { this.propertyImg = new Viewer(this.element.nativeElement.querySelector('#propertyImg'), { url: 'data-original', navbar: false }); }, 0) - } + } } //刷新设备属性 弹窗位置 renovateDialogPosition() { - window.setTimeout(()=>{ - this.naturePosition.left = `${this.beforeOnePropertyData.getHeadUIPos().x - 150}px` - this.naturePosition.top = `${this.beforeOnePropertyData.getHeadUIPos().y + 100}px` - },0) + // window.setTimeout(() => { + this.naturePosition.left = `${this.beforeOnePropertyData.getHeadUIPos().x - 150}px` + this.naturePosition.top = `${this.beforeOnePropertyData.getHeadUIPos().y + 100}px` + // }, 0) + + } //上传设备 图片 @@ -458,7 +475,6 @@ export class PlanComponent implements OnInit { this.isShowChildComponent && this.leftDomain ? this.leftDomain.selectPlanId = this.beforeEmergencyPlan.id : null this.isShowChildComponent && this.leftDomain ? this.leftDomain.selectNodeId = this.beforePlanNode.id : null MarkWindow.instance.selectMarkNode(this.beforeEmergencyPlan.id, this.beforePlanNode.id, false, true) - this.beforePlanNode = MarkWindow.instance.currentMarkNodeInfo.nodeData this.initViewer() this.updateProgress() //更新进度条 resolve(true) @@ -855,6 +871,7 @@ export class taskList { export class naturePosition { top: string = "0px" left: string = "0px" + } // 处置预案 所有图标 export class planIcons {