diff --git a/package.json b/package.json index d21e1b7..32e3865 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ }, "dependencies": { "@element-plus/icons-vue": "2.0.10", + "@jiaminghi/data-view": "^2.10.0", "@vueup/vue-quill": "1.2.0", "@vueuse/core": "9.5.0", "axios": "0.27.2", diff --git a/src/assets/images/top.png b/src/assets/images/top.png new file mode 100644 index 0000000..2b39cc8 Binary files /dev/null and b/src/assets/images/top.png differ diff --git a/src/main.js b/src/main.js index 1bae669..f03d7e8 100644 --- a/src/main.js +++ b/src/main.js @@ -44,6 +44,8 @@ import TreeSelect from '@/components/TreeSelect' import DictTag from '@/components/DictTag' // troisjs import { TroisJSVuePlugin } from 'troisjs'; +// 边框ui组件 +import dataV from '@jiaminghi/data-view' const app = createApp(App) @@ -68,6 +70,7 @@ app.component('ImagePreview', ImagePreview) app.component('RightToolbar', RightToolbar) app.component('Editor', Editor) +app.use(dataV) app.use(TroisJSVuePlugin) app.use(router) app.use(store) diff --git a/src/views/bim/bimHome/components/ApplicationTree.vue b/src/views/bim/bimHome/components/ApplicationTree.vue index cd708b2..896c883 100644 --- a/src/views/bim/bimHome/components/ApplicationTree.vue +++ b/src/views/bim/bimHome/components/ApplicationTree.vue @@ -1,10 +1,13 @@ \ No newline at end of file diff --git a/src/views/bim/bimHome/components/BuildTree.vue b/src/views/bim/bimHome/components/BuildTree.vue index f5398c6..55928d8 100644 --- a/src/views/bim/bimHome/components/BuildTree.vue +++ b/src/views/bim/bimHome/components/BuildTree.vue @@ -1,10 +1,12 @@ \ No newline at end of file diff --git a/src/views/bim/bimHome/components/DeviceInfo.vue b/src/views/bim/bimHome/components/DeviceInfo.vue index f170b9d..e82ee84 100644 --- a/src/views/bim/bimHome/components/DeviceInfo.vue +++ b/src/views/bim/bimHome/components/DeviceInfo.vue @@ -1,12 +1,34 @@ \ No newline at end of file diff --git a/src/views/bim/bimHome/components/DevicePie.vue b/src/views/bim/bimHome/components/DevicePie.vue index d90628f..67499d0 100644 --- a/src/views/bim/bimHome/components/DevicePie.vue +++ b/src/views/bim/bimHome/components/DevicePie.vue @@ -1,10 +1,12 @@ \ No newline at end of file diff --git a/src/views/bim/bimHome/components/RealData.vue b/src/views/bim/bimHome/components/RealData.vue index e1c6450..23236ac 100644 --- a/src/views/bim/bimHome/components/RealData.vue +++ b/src/views/bim/bimHome/components/RealData.vue @@ -1,26 +1,80 @@ \ No newline at end of file diff --git a/src/views/bim/bimHome/components/ThreeView.vue b/src/views/bim/bimHome/components/ThreeView.vue index 1fc84bb..bbea9de 100644 --- a/src/views/bim/bimHome/components/ThreeView.vue +++ b/src/views/bim/bimHome/components/ThreeView.vue @@ -46,6 +46,7 @@ onMounted(() => { loadSence(); // 启动动画 renderScene(); + document.addEventListener("click", modelMouseClick); }); const init = () => { scene = new THREE.Scene(); @@ -105,6 +106,22 @@ const renderScene = () => { // 写在requestAnimationFrame之后,否则会报错 labelRenderer.render(scene, camera); }; + +const modelMouseClick = (event) => { + mouse.x = (event.clientX / window.innerWidth) * 2 - 1; + mouse.y = -(event.clientY / window.innerHeight) * 2 + 1; + raycaster.setFromCamera(mouse, camera); + const intersects = raycaster.intersectObject(scene, true); + if (intersects.length > 0) { + console.log(intersects[0].object); + outlineObj(intersects[0].object); + } +}; + +//高亮 +const outlineObj = (object) => { + object.material.color.set(0x66ff00); +} \ No newline at end of file diff --git a/src/views/bim/bimHome/index.vue b/src/views/bim/bimHome/index.vue index a53e9ec..15726b3 100644 --- a/src/views/bim/bimHome/index.vue +++ b/src/views/bim/bimHome/index.vue @@ -1,7 +1,7 @@