From c7b62bef1c69ab4e3a04152a47f8f9e3f883f225 Mon Sep 17 00:00:00 2001 From: wangqiujuan0808 <578331299@qq.com> Date: Fri, 15 Dec 2023 15:09:39 +0800 Subject: [PATCH] Update ThreeView2.vue --- .../bim/bimHome/components/ThreeView2.vue | 35 ++++++++++++++----- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/src/views/bim/bimHome/components/ThreeView2.vue b/src/views/bim/bimHome/components/ThreeView2.vue index 1517cc3..4a3cb71 100644 --- a/src/views/bim/bimHome/components/ThreeView2.vue +++ b/src/views/bim/bimHome/components/ThreeView2.vue @@ -12,9 +12,9 @@
- @@ -219,7 +219,7 @@ const onMouseDownRight = (event) => { const clickedObject = intersects[0].object; console.log('这是我选中的模型', clickedObject); var selectedObject = isSelent(clickedObject); - // addLabel(selectedObject); + // addLabel(selectedObject, true); emit('handleRightClick', selectedObject); } } @@ -403,18 +403,18 @@ const nearCamera = (floor) => { const setLabel = () => { if (isAddLabel.value) { let obj = scene.getObjectByName('set2'); - addLabel(obj); + addLabel(obj, false); } else { removeLabel(); } isAddLabel.value = !isAddLabel.value; } // 添加标签 -const addLabel = (obj) => { +const addLabel = (obj,isShowDetail) => { // console.log(123, obj); centerSelectedGroup(obj); let text = "设备二"; - pointLabel = createLableObj(text); + pointLabel = createLableObj(text,isShowDetail); obj.add(pointLabel); labelRenderer.setSize(window.innerWidth, window.innerHeight); labelRenderer.domElement.style.position = "absolute"; @@ -425,10 +425,15 @@ const addLabel = (obj) => { // 将呈现器的输出添加到HTML元素 document.getElementById("dom").appendChild(renderer.domElement); }; -const createLableObj = (text) => { +const createLableObj = (text,isShowDetail) => { let laberDiv = document.createElement("div"); //创建div容器 - laberDiv.className = "laber_name"; - laberDiv.innerHTML = `设备名称:${text}状态:启用压力:50 Pa` + if(!isShowDetail) { + laberDiv.className = "laber_name"; + laberDiv.innerHTML = `设备名称:${text}状态:启用压力:50 Pa` + } else { + laberDiv.className = "laber_name1"; + laberDiv.innerHTML = `