From ccb2d0d2d3533c41d354da0f0baa799753030a98 Mon Sep 17 00:00:00 2001 From: liuxianghui <519646741@qq.com> Date: Thu, 11 Nov 2021 14:46:34 +0800 Subject: [PATCH] =?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/babylon/model/info/model/model-info.ts | 4 +--- .../facilityinfoinscene-window/facilityinfo-ui-item.ts | 3 ++- .../facilityinfoinscene-window.ts | 10 +++++++--- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/app/babylon/model/info/model/model-info.ts b/src/app/babylon/model/info/model/model-info.ts index eeea1de..2a31504 100644 --- a/src/app/babylon/model/info/model/model-info.ts +++ b/src/app/babylon/model/info/model/model-info.ts @@ -10,13 +10,10 @@ import { } from '@babylonjs/core'; import { Button, Rectangle, Vector2WithInfo } from '@babylonjs/gui'; import { classToClass } from 'class-transformer'; -import { SceneManager } from 'src/app/babylon/controller/scene-manager'; import { UIManager } from 'src/app/babylon/controller/ui-manager'; import { BabylonTool } from 'src/app/babylon/tool/babylon-tool'; -import { BabylonUIStyleTool } from 'src/app/babylon/tool/babylon-ui-style-tool'; import { GizmoTool } from 'src/app/babylon/tool/gizmo-tool'; import { TsTool } from 'src/app/babylon/tool/ts-tool'; -import { isRegularExpressionLiteral } from 'typescript'; import { ModelData } from '../../data/model-data/model-data'; @@ -316,6 +313,7 @@ export class ModelInfo { getHeadUIPos() { let result: Vector2 = null; if (this.uiFollowRoot != null) { + result = new Vector2(); result.x = this.uiFollowRoot.leftInPixels; result.y = this.uiFollowRoot.topInPixels; } 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 96c3b87..f9126ba 100644 --- a/src/app/babylon/view/facilityinfoinscene-window/facilityinfo-ui-item.ts +++ b/src/app/babylon/view/facilityinfoinscene-window/facilityinfo-ui-item.ts @@ -1,4 +1,5 @@ +import { Vector2 } from "@babylonjs/core"; import { SceneManager } from "../../controller/scene-manager"; import { PropertyData_Base } from "../../model/data/institution/facility/property-data/property-data-base"; import { FacilityType, ModelData_facility } from "../../model/data/model-data/model-data-facility"; @@ -137,7 +138,7 @@ export class FacilityInfoUIItem { /** * 获取头部UI的位置(像素) */ - getHeadUIPos() { + getHeadUIPos(): Vector2 { if (this.modelInfo != null) { return this.modelInfo.getHeadUIPos(); } diff --git a/src/app/babylon/view/facilityinfoinscene-window/facilityinfoinscene-window.ts b/src/app/babylon/view/facilityinfoinscene-window/facilityinfoinscene-window.ts index cf98b44..72975ef 100644 --- a/src/app/babylon/view/facilityinfoinscene-window/facilityinfoinscene-window.ts +++ b/src/app/babylon/view/facilityinfoinscene-window/facilityinfoinscene-window.ts @@ -466,7 +466,9 @@ export class FacilityInfoInSceneWindow extends UIBase { selectJYJFrom3D(pickInfo: PickingInfo) { if (this.currentSelectJYJInfo != null) { - this.playJYJSelectEffect(false, this.currentSelectJYJInfo); + let facilityItem: FacilityInfoUIItem = FacilityInfoInSceneWindow.instance.getFacilityItem(this.currentSelectJYJInfo); + facilityItem.onSelect(false); + // this.playJYJSelectEffect(false, this.currentSelectJYJInfo); this.currentSelectJYJInfo = null; } @@ -511,10 +513,12 @@ export class FacilityInfoInSceneWindow extends UIBase { if (result != null) { - this.playJYJSelectEffect(true, result); + //this.playJYJSelectEffect(true, result); let facilityItem: FacilityInfoUIItem = FacilityInfoInSceneWindow.instance.getFacilityItem(result); console.log("场景中选中设备", facilityItem); //通知前端 - FacilityInfoInSceneWindow.instance.selectFacilityItemToThree([facilityItem], true); + facilityItem.onSelect(true); + //FacilityInfoInSceneWindow.instance.selectFacilityItemToThree([facilityItem], true); + //console.log(facilityItem.getHeadUIPos()); } }