feat: US-005 - Hover-to-highlight interaction on desktop

This commit is contained in:
2026-02-16 09:58:27 +00:00
parent f3e9b58e8d
commit 67fe5567a9
3 changed files with 29 additions and 13 deletions
+13 -12
View File
@@ -561,24 +561,25 @@ const CareerConstellation: React.FC<CareerConstellationProps> = ({
nodeSelection.on('mouseleave', function() {
if (supportsCoarsePointer) return
applyGraphHighlight(highlightedNodeId ?? pinnedNodeId)
callbacksRef.current.onNodeHover?.(pinnedNodeId)
applyGraphHighlight(highlightedNodeId ?? null)
callbacksRef.current.onNodeHover?.(null)
})
nodeSelection.on('click', function(_event, d) {
if (supportsCoarsePointer && pinnedNodeId !== d.id) {
setPinnedNodeId(d.id)
applyGraphHighlight(d.id)
if (d.type === 'role') {
callbacksRef.current.onNodeHover?.(d.id)
if (supportsCoarsePointer) {
// Touch: tap-to-pin toggle
if (pinnedNodeId === d.id) {
setPinnedNodeId(null)
applyGraphHighlight(null)
callbacksRef.current.onNodeHover?.(null)
} else {
setPinnedNodeId(d.id)
applyGraphHighlight(d.id)
callbacksRef.current.onNodeHover?.(d.type === 'role' ? d.id : null)
}
return
}
const newPinned = pinnedNodeId === d.id ? null : d.id
setPinnedNodeId(newPinned)
callbacksRef.current.onNodeHover?.(d.type === 'role' ? newPinned : null)
// Fire detail callbacks for both desktop and touch
if (d.type === 'role') {
callbacksRef.current.onRoleClick(d.id)
} else {