Commit 4af55f4d authored by 李苏's avatar 李苏 💬

操作模型对象 try 保护

parent d78fbec1
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Description: * @Description:
* @Author: lisu lisu@gavelinfo.com * @Author: lisu lisu@gavelinfo.com
* @LastEditors: lisu lisu@gavelinfo.com * @LastEditors: lisu lisu@gavelinfo.com
* @LastEditTime: 2024-10-08 16:51:55 * @LastEditTime: 2024-10-10 15:08:18
* @FilePath: /zghywpc-vue/src/views/yhlywsytst/yhlywsytst/index.vue * @FilePath: /zghywpc-vue/src/views/yhlywsytst/yhlywsytst/index.vue
--> -->
<template> <template>
...@@ -1504,63 +1504,55 @@ ...@@ -1504,63 +1504,55 @@
return return
} }
let model try{
/* 测试判定,实际根据模型实际特征来判定*/ let model
// if (intersects[0].object.name == '') { let modelIndex = intersects.findIndex(item=>item.object.name!==''&&item.object.visible==true)
// model = intersects[1].object if(modelIndex!=-1){
// } else { rconsole.log(`当前选中${modelIndex}`)
// model = intersects[0].object model=intersects[modelIndex].object
// } }else{
let modelIndex = intersects.findIndex(item=>item.object.name!==''&&item.object.visible==true) console.log('本次选中不存在name的节点')
if(modelIndex!=-1){ }
rconsole.log(`当前选中${modelIndex}`)
model=intersects[modelIndex].object
}else{ /* 当模型隐藏 不继续触发*/
console.log('本次选中不存在name的节点') if (model.visible == false) {
} rconsole.log('当前对象已屏蔽')
return
}
/* 当模型隐藏 不继续触发*/ this.selectedModel = model
if (model.visible == false) { // model.visible=false
rconsole.log('当前对象已屏蔽')
return /* 执行并情况材料队列 */
} this.reMaterialQue.forEach(item => {
this.selectedModel = model item.revert()
// model.visible=false })
this.reMaterialQue.splice(0, this.reMaterialQue.length)
/* 执行并情况材料队列 */
this.reMaterialQue.forEach(item => {
item.revert() /* 添加材质模型队列*/
}) let reMaterialQueItem = {
this.reMaterialQue.splice(0, this.reMaterialQue.length) model,
material: model.material.clone(),
revert: function() {
/* 添加材质模型队列*/ this.model.material = this.material
let reMaterialQueItem = { }
model, }
material: model.material.clone(),
revert: function() { this.reMaterialQue.push(reMaterialQueItem)
this.model.material = this.material
}
model.material = new THREE.MeshPhongMaterial({
color: new THREE.Color('rgba(255, 255, 0, 0.8)'),
transparent: true,
opacity: 0.8,
wireframe: false,
})
}catch(e){
rconsole.log(e)
} }
this.reMaterialQue.push(reMaterialQueItem)
model.material = new THREE.MeshPhongMaterial({
color: new THREE.Color('rgba(255, 255, 0, 0.8)'),
transparent: true,
opacity: 0.8,
wireframe: false,
})
/* */
// if (this.xzjj) {
// const object = model;
// if (object) {
// this.viewer.cameraControl.fitTo(object);
// }
// }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment