From 4f8a4129fde25defab5cf4a4d1c79b0deba181c7 Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Thu, 21 May 2026 17:12:03 +0000 Subject: [PATCH] Changes Co-authored-by: Reifonas <211114984+Reifonas@users.noreply.github.com> --- src/components/three/ModelViewer.tsx | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/src/components/three/ModelViewer.tsx b/src/components/three/ModelViewer.tsx index 24e460e..9c4132e 100644 --- a/src/components/three/ModelViewer.tsx +++ b/src/components/three/ModelViewer.tsx @@ -723,26 +723,16 @@ function SelectionHandler() { mouse.y = -((e.clientY - rect.top) / rect.height) * 2 + 1; raycaster.setFromCamera(mouse, camera); const intersects = raycaster.intersectObjects(scene.children, true); - const hit = intersects.find((i) => { - const o = i.object; - if (!(o instanceof THREE.Mesh)) return false; - if (o.userData.__edgeLine) return false; - if (o.geometry instanceof THREE.SphereGeometry) return false; - if (o.geometry instanceof THREE.RingGeometry) return false; - if (o.geometry instanceof THREE.PlaneGeometry) return false; - return true; - }); + const hit = intersects.find((i) => isPickableModelMesh(i.object)); if (!hit) return; + const element = findElementRoot(hit.object); let cur: THREE.Object3D | null = hit.object; - let element: THREE.Object3D | null = null; let modelId: string | null = null; while (cur) { - if (!element && cur.userData?.ifcElement) element = cur; if (!modelId && cur.userData?.modelId) modelId = cur.userData.modelId as string; cur = cur.parent; } - if (!element) element = hit.object; if (!modelId) modelId = useModelStore.getState().activeModelId; if (!modelId || !element) return; const key = elementKey(modelId, element);