Changes
Co-authored-by: Reifonas <211114984+Reifonas@users.noreply.github.com>
This commit is contained in:
@@ -712,10 +712,8 @@ function SelectionHandler() {
|
|||||||
if (o.geometry instanceof THREE.PlaneGeometry) return false;
|
if (o.geometry instanceof THREE.PlaneGeometry) return false;
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
console.log('[Selection] click', { intersects: intersects.length, hit: !!hit, hitName: hit?.object?.name, hitUserData: hit?.object?.userData });
|
|
||||||
if (!hit) return;
|
if (!hit) return;
|
||||||
|
|
||||||
// Walk up to find ifcElement node AND the GLBModel root (carrying modelId)
|
|
||||||
let cur: THREE.Object3D | null = hit.object;
|
let cur: THREE.Object3D | null = hit.object;
|
||||||
let element: THREE.Object3D | null = null;
|
let element: THREE.Object3D | null = null;
|
||||||
let modelId: string | null = null;
|
let modelId: string | null = null;
|
||||||
@@ -724,13 +722,10 @@ function SelectionHandler() {
|
|||||||
if (!modelId && cur.userData?.modelId) modelId = cur.userData.modelId as string;
|
if (!modelId && cur.userData?.modelId) modelId = cur.userData.modelId as string;
|
||||||
cur = cur.parent;
|
cur = cur.parent;
|
||||||
}
|
}
|
||||||
console.log('[Selection] walked', { foundIfcElement: !!element, modelId, elementName: element?.name });
|
|
||||||
// Non-IFC fallback: pick the mesh itself
|
|
||||||
if (!element) element = hit.object;
|
if (!element) element = hit.object;
|
||||||
if (!modelId) modelId = useModelStore.getState().activeModelId;
|
if (!modelId) modelId = useModelStore.getState().activeModelId;
|
||||||
if (!modelId || !element) { console.log('[Selection] aborted: no modelId/element'); return; }
|
if (!modelId || !element) return;
|
||||||
const key = elementKey(modelId, element);
|
const key = elementKey(modelId, element);
|
||||||
console.log('[Selection] toggling', key);
|
|
||||||
useModelStore.getState().toggleElementSelection(key);
|
useModelStore.getState().toggleElementSelection(key);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user