From 199367d636a61bf2e98b9a052b9b13738f890f49 Mon Sep 17 00:00:00 2001 From: Arnav K Date: Tue, 3 Feb 2026 22:57:31 +0530 Subject: [PATCH] fix: live debug grid and port prop changes --- examples/example18-live-toggle.fixture.tsx | 60 ++++++++++++++++++++++ lib/components/SchematicViewer.tsx | 5 +- 2 files changed, 63 insertions(+), 2 deletions(-) create mode 100644 examples/example18-live-toggle.fixture.tsx diff --git a/examples/example18-live-toggle.fixture.tsx b/examples/example18-live-toggle.fixture.tsx new file mode 100644 index 0000000..4e674d1 --- /dev/null +++ b/examples/example18-live-toggle.fixture.tsx @@ -0,0 +1,60 @@ +import { useState } from "react" +import { SchematicViewer } from "lib/components/SchematicViewer" +import { renderToCircuitJson } from "lib/dev/render-to-circuit-json" + +export default () => { + const [showDebugGrid, setShowDebugGrid] = useState(true) + const [showPorts, setShowPorts] = useState(false) + + return ( +
+
+ + +
+ + + + + + + + + + + + , + )} + debugGrid={showDebugGrid} + showSchematicPorts={showPorts} + /> +
+ ) +} diff --git a/lib/components/SchematicViewer.tsx b/lib/components/SchematicViewer.tsx index 94cc6d0..791abf9 100644 --- a/lib/components/SchematicViewer.tsx +++ b/lib/components/SchematicViewer.tsx @@ -123,7 +123,8 @@ export const SchematicViewer = ({ const [editModeEnabled, setEditModeEnabled] = useState(defaultEditMode) const [snapToGrid, setSnapToGrid] = useState(true) - const [showGrid, setShowGrid] = useState(debugGrid) + const [showGridInternal, setShowGridInternal] = useState(false) + const showGrid = debugGrid || showGridInternal const [isInteractionEnabled, setIsInteractionEnabled] = useState( !clickToInteractEnabled, ) @@ -513,7 +514,7 @@ export const SchematicViewer = ({ } }} showGrid={showGrid} - onToggleGrid={setShowGrid} + onToggleGrid={setShowGridInternal} /> {spiceSimulationEnabled && ( setShowSpiceOverlay(true)} />