Commit 77eb5233 authored by 李苏's avatar 李苏 💬

解决 接口高亮和单选的颜色冲突的问题bug

parent e5d1a624
......@@ -655,6 +655,8 @@
let params = _.cloneDeep(this.queryParams)
delete params.sbxxCode
/* 先清空 选中的机组*/
this.jzReMaterialQue.forEach(item => {
item.revert()
})
......@@ -667,16 +669,28 @@
let sbxxList = res.data.records || []
this.$success(`已标记${sbxxList.length}个设备`)
const sbxxCodeList = sbxxList.map(item => item.sbxxCode)
/* 解决 先缓存选中色,后渲染黄色,默认选中时颜色不对
bug: 1默认还原为原色
2.高亮为黄色触发默认选中(黄色存储在另一个队列)
3.默认选中会还原上一个颜色
4.还原为原色,触发选中。变为选中色,清除为原色,覆盖了亮色
*/
if(sbxxCodeList.length!=0){
this.reMaterialQue.forEach(item => {
item.revert()
})
}
this.reMaterialQue.splice(0, this.reMaterialQue.length)
/* 分割,在渲染高亮清空选中的*/
this.viewer.scene.traverse((model) => {
if (model.isMesh) {
if (sbxxCodeList.includes(model.name)) {
console.log(model.name,'ces')
let jzReMaterialQueItem = {
model,
material: model.material.clone(),
material: model.oldmaterial.clone(),
revert: function() {
model.material = this.material
this.model.material = this.material
}
}
this.jzReMaterialQue.push(jzReMaterialQueItem)
......@@ -691,6 +705,8 @@
}
});
if (this.jzReMaterialQue.length != 0) {
this.viewer.cameraControl.fitTo(this.jzReMaterialQue[0].model);
this.sylbshow = true
this.clickTag(this.jzReMaterialQue[0].model.name)
......@@ -917,6 +933,11 @@
model.addEventListener("loaded", () => {
this.loading = false
this.viewer.scene.traverse(model=>{
if (model.isMesh) {
model.oldmaterial=model.material.clone()
}
})
});
this.viewer.scene.add(model);
......@@ -976,6 +997,7 @@
model = intersects[0].object
}
this.selectedModel = model
/* 执行并情况材料队列 */
this.reMaterialQue.forEach(item => {
item.revert()
......@@ -991,6 +1013,7 @@
this.model.material = this.material
}
}
this.reMaterialQue.push(reMaterialQueItem)
......
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