From df5e4d0614afc8c857717d59a2e565119e00e4fb Mon Sep 17 00:00:00 2001 From: KAYEB Date: Wed, 20 May 2026 11:08:26 -0700 Subject: [PATCH] Highlight connected schematic traces on hover --- lib/components/SchematicViewer.tsx | 10 ++ .../useHighlightConnectedTracesOnHover.ts | 111 ++++++++++++++++++ 2 files changed, 121 insertions(+) create mode 100644 lib/hooks/useHighlightConnectedTracesOnHover.ts diff --git a/lib/components/SchematicViewer.tsx b/lib/components/SchematicViewer.tsx index ab4fd20..9a4822c 100644 --- a/lib/components/SchematicViewer.tsx +++ b/lib/components/SchematicViewer.tsx @@ -5,6 +5,7 @@ import { import { su } from "@tscircuit/soup-util" import { useChangeSchematicComponentLocationsInSvg } from "lib/hooks/useChangeSchematicComponentLocationsInSvg" import { useChangeSchematicTracesForMovedComponents } from "lib/hooks/useChangeSchematicTracesForMovedComponents" +import { useHighlightConnectedTracesOnHover } from "lib/hooks/useHighlightConnectedTracesOnHover" import { useSchematicGroupsOverlay } from "lib/hooks/useSchematicGroupsOverlay" import { enableDebug } from "lib/utils/debug" import { useCallback, useEffect, useMemo, useRef, useState } from "react" @@ -345,6 +346,11 @@ export const SchematicViewer = ({ editEvents: editEventsWithUnappliedEditEvents, }) + useHighlightConnectedTracesOnHover({ + svgDivRef, + circuitJson, + }) + // Add group overlays when enabled useSchematicGroupsOverlay({ svgDivRef, @@ -396,6 +402,10 @@ export const SchematicViewer = ({ return ( + {onSchematicComponentClicked && (