remove extraneous recolor in hover

master
howard 2021-03-30 17:20:42 -07:00
parent 6e9359138f
commit 470d96d961
1 changed files with 8 additions and 13 deletions

View File

@ -38,19 +38,17 @@ export function onHover(e) {
if (idx.length) { if (idx.length) {
if (hoverPts[idx[0]].object != this.hovered[0]) { if (hoverPts[idx[0]].object != this.hovered[0]) {
for (let x = 0; x < this.hovered.length; x++) { const obj = this.hovered[this.hovered.length - 1]
const obj = this.hovered[x]
if (obj && !this.selected.includes(obj)) { if (obj && !this.selected.includes(obj)) {
obj.material.color.set(0x555555) obj.material.color.set(0x555555)
} }
}
this.hovered = [] this.hovered = []
for (let x = 0; x < idx.length; x++) { for (let x = 0; x < idx.length; x++) {
const i = idx[x] const i = idx[x]
hoverPts[i].object.material.color.set(color.hover)
this.hovered.push(hoverPts[i].object) this.hovered.push(hoverPts[i].object)
} }
this.hovered[this.hovered.length - 1].material.color.set(color.hover)
// console.log('render1') // console.log('render1')
this.dispatchEvent({ type: 'change' }) this.dispatchEvent({ type: 'change' })
@ -58,13 +56,10 @@ export function onHover(e) {
} else { } else {
if (this.hovered.length) { if (this.hovered.length) {
for (let x = 0; x < this.hovered.length; x++) { const obj = this.hovered[this.hovered.length - 1]
const obj = this.hovered[x]
if (obj && !this.selected.includes(obj)) { if (obj && !this.selected.includes(obj)) {
// console.log(obj)
obj.material.color.set(0x555555) obj.material.color.set(0x555555)
} }
}
this.hovered = [] this.hovered = []
// console.log('render2') // console.log('render2')