diff --git a/changelog/entries/2026-06-05-schematic-wire-escape-cancel.json b/changelog/entries/2026-06-05-schematic-wire-escape-cancel.json new file mode 100644 index 00000000..c90fad95 --- /dev/null +++ b/changelog/entries/2026-06-05-schematic-wire-escape-cancel.json @@ -0,0 +1,9 @@ +{ + "id": "2026-06-05-schematic-wire-escape-cancel", + "version": "0.9.4", + "date": "2026-06-05", + "category": "fix", + "title": "Press Escape to cancel an in-progress schematic wire", + "summary": "Drawing a wire and want out? Escape now drops it — the universal EDA reflex, complementing right-click cancel and double-click finish.", + "features": ["electronics", "schematic", "ux"] +} diff --git a/packages/app/src/components/electronics/SchematicCanvas.tsx b/packages/app/src/components/electronics/SchematicCanvas.tsx index f4daa095..45b97e90 100644 --- a/packages/app/src/components/electronics/SchematicCanvas.tsx +++ b/packages/app/src/components/electronics/SchematicCanvas.tsx @@ -6,7 +6,7 @@ * Supports place, wire, label, delete, and move tools. */ -import { useRef, useCallback, useState, useMemo } from "react"; +import { useRef, useCallback, useState, useMemo, useEffect } from "react"; import { useDocumentStore, getPcbNodeIds } from "@vcad/core"; import type { SchematicComponent, SchematicWire } from "@vcad/ir"; import { useElectronicsStore } from "@/stores/electronics-store"; @@ -261,6 +261,18 @@ export function SchematicCanvas() { const select = useElectronicsStore((s) => s.select); const setHoveredNet = useElectronicsStore((s) => s.setHoveredNet); + + // Escape cancels an in-progress wire (the universal EDA reflex; complements + // the right-click cancel and double-click finish). + useEffect(() => { + const onKey = (e: KeyboardEvent) => { + if (e.key === "Escape" && schTool === "wire") { + useElectronicsStore.getState().cancelSchWire(); + } + }; + window.addEventListener("keydown", onKey); + return () => window.removeEventListener("keydown", onKey); + }, [schTool]); const zoomAt = useElectronicsStore((s) => s.zoomSchAt); const adjustPan = useElectronicsStore((s) => s.adjustSchPan); const startSchWire = useElectronicsStore((s) => s.startSchWire);