From 654f86bdfcb8e7ef668f7e60a6fa0457e144912b Mon Sep 17 00:00:00 2001 From: jedarden Date: Wed, 6 May 2026 01:04:46 -0400 Subject: [PATCH] Fix Fresnel zone debug overlay mouse interaction bugs - Raycast against both wireframe and fill meshes for reliable detection - Wireframe is always present even when fill has 0 opacity (zones 2+) - Sort intersections by distance to get the closest intersection - Fixes hover detection not working properly for multi-zone Fresnel ellipsoids --- dashboard/js/app.js | 37 +++++++++++++++++++++++++++++-------- 1 file changed, 29 insertions(+), 8 deletions(-) diff --git a/dashboard/js/app.js b/dashboard/js/app.js index 28f1272..022c47f 100644 --- a/dashboard/js/app.js +++ b/dashboard/js/app.js @@ -2430,6 +2430,7 @@ /** * Handle mouse move events for Fresnel ellipsoid hover detection. + * Fixed to raycast against both wireframe and fill meshes for reliable detection. */ function onFresnelMouseMove(event) { if (!state.fresnelDebugVisible) return; @@ -2447,23 +2448,43 @@ // ellipsoids is an array of ellipsoid objects (zones 1-5 for this link) if (Array.isArray(ellipsoids)) { ellipsoids.forEach(function(ellipsoid) { - if (ellipsoid.fill) { - var result = state.fresnelRaycaster.intersectObject(ellipsoid.fill, true); - if (result.length > 0) { - intersects.push(result[0]); + // Raycast against both wireframe and fill for reliable detection + // Wireframe is always present even when fill has 0 opacity (zones 2+) + if (ellipsoid.wireframe) { + var wireResult = state.fresnelRaycaster.intersectObject(ellipsoid.wireframe, true); + if (wireResult.length > 0) { + intersects.push(wireResult[0]); + } + } + if (ellipsoid.fill && ellipsoid.fill.material.opacity > 0) { + var fillResult = state.fresnelRaycaster.intersectObject(ellipsoid.fill, true); + if (fillResult.length > 0) { + intersects.push(fillResult[0]); } } }); - } else if (ellipsoids && ellipsoids.fill) { + } else if (ellipsoids) { // Legacy: single ellipsoid - var result = state.fresnelRaycaster.intersectObject(ellipsoids.fill, true); - if (result.length > 0) { - intersects.push(result[0]); + if (ellipsoids.wireframe) { + var wireResult = state.fresnelRaycaster.intersectObject(ellipsoids.wireframe, true); + if (wireResult.length > 0) { + intersects.push(wireResult[0]); + } + } + if (ellipsoids.fill && ellipsoids.fill.material.opacity > 0) { + var fillResult = state.fresnelRaycaster.intersectObject(ellipsoids.fill, true); + if (fillResult.length > 0) { + intersects.push(fillResult[0]); + } } } }); if (intersects.length > 0) { + // Sort by distance to get the closest intersection + intersects.sort(function(a, b) { + return a.distance - b.distance; + }); var intersect = intersects[0]; var linkID = intersect.object.userData.linkID;