diff --git a/src/views/bim/bimHome/components/ThreeView2.vue b/src/views/bim/bimHome/components/ThreeView2.vue index 4a2de19..b4a4531 100644 --- a/src/views/bim/bimHome/components/ThreeView2.vue +++ b/src/views/bim/bimHome/components/ThreeView2.vue @@ -125,11 +125,13 @@ Bus.on('clickApplication', (isParent) => { } }) - +// 监听底部菜单切换 watch(() => bimStore().activateMenu, value => { // 更换场景颜色 scene.background = new THREE.Color(value.background); toHomeView(); + // 移除消防图标 + removexf(); }, { deep: true }); const init = () => { @@ -219,6 +221,7 @@ const renderScene = () => { // console.log('坐标', cameraX, cameraY, cameraZ); TWEEN.update(); controls.update(); + renderer.clear(); renderer.render(scene, camera); labelRenderer.render(scene, camera); }; @@ -618,28 +621,29 @@ const xfadd = (obj, state) => { sprite.scale.set(5, 5, 5); sprite.position.y = 12; //标签底部箭头和空对象标注点重合 obj.add(sprite); //tag会标注在空对象obj对应的位置 - console.log(123, obj) } // 移除消防标签 const removexf = () => { - model.traverse(e => { - if (e.isMesh && e.children.length > 0) { - e.remove(e.children[0]) - } else { - e.traverse(o => { - if (o.isMesh && o.children.length > 0) { - o.remove(o.children[0]) - } - }) + // model.traverse(e => { + // if (e.isMesh && e.children.length > 0) { + // e.remove(e.children[0]) + // } else { + // e.traverse(o => { + // if (o.isMesh && o.children.length > 0) { + // o.remove(o.children[0]) + // } + // }) - } + // } + // }) + console.log(xfobj.length); + xfobj.forEach((o) => { + // 倒序 + o.remove(o.children[o.children.length-1]); }) - scene.remove(sprite); } // 更换纹理贴图方法 const changeMap = (img) => { - // 测试移除消防图标 - removexf(); isShowWall.value = true; // 获取墙体 model.traverse(e => {