From a85be09c8a6955abdb10c063ed18a6626382e558 Mon Sep 17 00:00:00 2001 From: liuxianghui <519646741@qq.com> Date: Wed, 1 Dec 2021 09:03:40 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E5=8A=A0=E6=B2=B9=E6=9C=BA=E5=B1=9E?= =?UTF-8?q?=E6=80=A7=E8=B7=9F=E9=9A=8F=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/babylon/controller/config-manager.ts | 2 +- .../model/info/model/model-info-facility.ts | 7 +++-- .../babylon/model/info/model/model-info.ts | 1 + .../facilityinfo-ui-item.ts | 17 ++++++++++- src/app/pages/plan/plan.component.ts | 30 +++++++++++++++---- 5 files changed, 47 insertions(+), 10 deletions(-) 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/plan/plan.component.ts b/src/app/pages/plan/plan.component.ts index 300ace5..361a8a5 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.ngAfterViewCheckedA(); + }) } ngAfterViewInit(): void { @@ -123,7 +129,16 @@ export class PlanComponent implements OnInit { }) } - ngAfterViewChecked () { + /** + * 视图检测改变之后 + */ + ngAfterViewCheckedA() { + 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) + + } //上传设备 图片 @@ -855,6 +872,7 @@ export class taskList { export class naturePosition { top: string = "0px" left: string = "0px" + } // 处置预案 所有图标 export class planIcons { From dfc8c95a95b0f09893e6acc579c15e3b57740341 Mon Sep 17 00:00:00 2001 From: liuxianghui <519646741@qq.com> Date: Wed, 1 Dec 2021 09:05:01 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E5=AE=8C=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/pages/plan/plan.component.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/app/pages/plan/plan.component.ts b/src/app/pages/plan/plan.component.ts index 361a8a5..3f90992 100644 --- a/src/app/pages/plan/plan.component.ts +++ b/src/app/pages/plan/plan.component.ts @@ -83,7 +83,7 @@ export class PlanComponent implements OnInit { }) //监听 delete键盘事件 this.game.scene.onBeforeRenderObservable.add(() => { - PlanComponent.instance.ngAfterViewCheckedA(); + PlanComponent.instance.onUpdate(); }) } @@ -130,9 +130,9 @@ export class PlanComponent implements OnInit { } /** - * 视图检测改变之后 + * 三维渲染前(每帧调用) */ - ngAfterViewCheckedA() { + onUpdate() { let currentTime = new Date().getTime(); let space = currentTime - this.lasteUpdateTime; if (space < this.c_frameSpace) { From 7ca1973a3c02004a853c9b00ba2478e551baca4e Mon Sep 17 00:00:00 2001 From: cpf <1105965053@qq.com> Date: Wed, 1 Dec 2021 09:37:46 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E5=88=A0=E9=99=A4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/pages/left-domain/left-domain.component.ts | 1 - src/app/pages/plan/plan.component.ts | 1 - 2 files changed, 2 deletions(-) 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 3f90992..a03de7e 100644 --- a/src/app/pages/plan/plan.component.ts +++ b/src/app/pages/plan/plan.component.ts @@ -475,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)