From b64d943a5ee973a6999fea678b87fe4d1df53293 Mon Sep 17 00:00:00 2001 From: trp <2477421791@qq.com> Date: Sun, 29 Dec 2024 19:12:05 +0800 Subject: [PATCH] =?UTF-8?q?trp:=E9=9A=A7=E9=81=93=E4=BB=BF=E7=9C=9F?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=EF=BC=8C=E5=8E=BB=E9=99=A4=E6=A0=87=E7=AD=BE?= =?UTF-8?q?=E5=9B=9E=E6=98=BE=E5=92=8C=E9=9A=90=E8=97=8F=E9=99=84=E7=9D=80?= =?UTF-8?q?=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../content/tunnelScene/PreviewScene.vue | 2 +- .../tunnelScene/TunnelSceneSimulate.vue | 25 +++++++++++-------- .../content/tunnelScene/sceneClass/demo.js | 8 +++++- .../sceneClass/handleRLclick/handleRclick.js | 1 - 4 files changed, 22 insertions(+), 14 deletions(-) diff --git a/src/components/content/tunnelScene/PreviewScene.vue b/src/components/content/tunnelScene/PreviewScene.vue index a85669f..645925f 100644 --- a/src/components/content/tunnelScene/PreviewScene.vue +++ b/src/components/content/tunnelScene/PreviewScene.vue @@ -210,7 +210,6 @@ const getTunnel = () => { getTunnelDetail(params.tunnelId).then((res) => { if (res?.code === 1000) { form.value = res.data; - // console.log(form.value.tunnelAlias); tunnelAlias = form.value.tunnelAlias; } }); @@ -346,6 +345,7 @@ async function handleMounted() { // console.log(modelList.value); // console.log("init", params.tunnelId); demo.previewtunnelModeInit(toRaw(modelList.value), fanData); + console.log("prew",modelList.value,fanData) // setInterval("demo.previewtunnelModeInit(toRaw(modelList.value), fanData)", "1000") demo.SignsInf(tunnelAlias, String(params.tunnelLen.value)); diff --git a/src/components/content/tunnelScene/TunnelSceneSimulate.vue b/src/components/content/tunnelScene/TunnelSceneSimulate.vue index 985573a..68331c8 100644 --- a/src/components/content/tunnelScene/TunnelSceneSimulate.vue +++ b/src/components/content/tunnelScene/TunnelSceneSimulate.vue @@ -190,12 +190,15 @@ async function handleMounted() { ? "frequency" : "sensor", })); + demo.enableLeftBtn = false //关闭左键 + demo.pointsVisible(false); demo.editTunnelInit(modeData); // 初始化标牌信息 demo.SignsInf("dsadsa", String(params.tunnelLength)); } catch (err) {} } + // 从新渲染数据 async function rerender() { try { @@ -294,9 +297,9 @@ function editDevInfo( //左键/双击左键回调函数 function lClickCallback(demo) { - // console.log('左键点击查看信息'); + console.log('左键点击查看信息'); - //demo动态添加函数,为操作组件内部 + // demo动态添加函数,为操作组件内部 function displayDevInfo(targetPoint = null) { hasDevice.value = targetPoint.hasDevice; if (!targetPoint.info) { @@ -339,15 +342,15 @@ function rClickCallback(demo) { function handleAddEqu(formInfo) { demo.addEquipment(targetP.value, formInfo); // //将墙壁设置为可以穿透点击 - // for (let line = 1; line <= 20; line++) { - // if (line < 10) { - // let wall = 'wall_' + '0' + line - // this.scene.getObjectByName(wall).layers.set(0) - // } else if (line >= 10) { - // let wall = 'wall_' + line - // this.scene.getObjectByName(wall).layers.set(0) - // } - // } + for (let line = 1; line <= 20; line++) { + if (line < 10) { + let wall = 'wall_' + '0' + line + this.scene.getObjectByName(wall).layers.set(0) + } else if (line >= 10) { + let wall = 'wall_' + line + this.scene.getObjectByName(wall).layers.set(0) + } + } } const centerDialogVisible = ref(false); diff --git a/src/components/content/tunnelScene/sceneClass/demo.js b/src/components/content/tunnelScene/sceneClass/demo.js index b316d85..1673bba 100644 --- a/src/components/content/tunnelScene/sceneClass/demo.js +++ b/src/components/content/tunnelScene/sceneClass/demo.js @@ -205,7 +205,12 @@ export default class Demo { // child.material.emissive = child.material.color // child.material.emissiveMap = child.material.map } - + //是否显示附着点 + pointsVisible(isEnable = true) { + this.points.forEach((element) => { + element.material.visible = isEnable; + }); + } // 添加轨道控制器 /** * @param {Object} OrbitControls 轨道控制器 @@ -328,6 +333,7 @@ export default class Demo { // 处理点击左右键触发的事件 __handleListenerClickRLEvent(isClickModels, e) { e.preventDefault(); + if (!this.enableLeftBtn) return; clearTimeout(this.EventTimer); this.EventTimer = setTimeout(() => { const mouse = new this.THREE.Vector2(); diff --git a/src/components/content/tunnelScene/sceneClass/handleRLclick/handleRclick.js b/src/components/content/tunnelScene/sceneClass/handleRLclick/handleRclick.js index cf972f4..0f901f8 100644 --- a/src/components/content/tunnelScene/sceneClass/handleRLclick/handleRclick.js +++ b/src/components/content/tunnelScene/sceneClass/handleRLclick/handleRclick.js @@ -1,6 +1,5 @@ import toImg from "../utils/EquipmentTag"; export function handleRClick(targetPoint) { - return; this.clearTagsObj(); const worldPosition = new this.THREE.Vector3(); //获取附着点的世界坐标系