From f9ed3b3d44023150cb08ecfa0a1e9ca5185ed04b Mon Sep 17 00:00:00 2001 From: naweiss Date: Mon, 11 May 2026 08:54:56 +0300 Subject: [PATCH] Make wire connected to ground black even when ending in ground --- frontend/src/store/useSimulatorStore.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/frontend/src/store/useSimulatorStore.ts b/frontend/src/store/useSimulatorStore.ts index e265995d..e8c401f3 100644 --- a/frontend/src/store/useSimulatorStore.ts +++ b/frontend/src/store/useSimulatorStore.ts @@ -17,6 +17,7 @@ import { Esp32Bridge } from '../simulation/Esp32Bridge'; import { useEditorStore } from './useEditorStore'; import { useVfsStore } from './useVfsStore'; import { boardPinToNumber, isBoardComponent } from '../utils/boardPinMapping'; +import { autoWireColor, DEFAULT_WIRE_COLOR } from '../utils/wireUtils'; import { createSerialBatcher } from './serialBatcher'; import { bindBoard as icBindBoard, @@ -1654,12 +1655,16 @@ export const useSimulatorStore = create((set, get) => { const state = get(); if (!state.wireInProgress) return; const { startEndpoint, waypoints, color } = state.wireInProgress; + + // Finish wire: auto-detect color from pin name + const finalColor = color === DEFAULT_WIRE_COLOR ? autoWireColor(endpoint.pinName) : color; + const newWire: Wire = { id: `wire-${Date.now()}`, start: startEndpoint, end: endpoint, waypoints, - color, + color: finalColor, }; set((state) => ({ wires: [...state.wires, newWire], wireInProgress: null })); },