Skip to content

Commit

Permalink
Allow multiple sprites #291
Browse files Browse the repository at this point in the history
  • Loading branch information
FlorianK13 committed Oct 3, 2024
1 parent 1275c2d commit 247c2aa
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/components/ThreeViewer/Controls/CustomMapControl.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,18 @@ function CustomMapControl(props) {
console.log("No children in the intersected mesh.")
return
}
let intersectedMesh = intersects[0].object
if (intersectedMesh.type === "Sprite") {
//ignore Sprites (the label of pvsystems), use the underlying object
intersectedMesh = intersects[1].object

// Filter out Sprites (ie the labels of PV systems)
let i = 0
while (i < intersects.length && intersects[i].object.type === "Sprite") {
i++
}
if (i === intersects.length) {
console.log("Only Sprite objects found in intersections.")
return
}

let intersectedMesh = intersects[i].object
console.log("Intersected Mesh", intersectedMesh)

if (!intersectedMesh) return
Expand Down

0 comments on commit 247c2aa

Please sign in to comment.