Skip to content

feat: schematic placement tools and pin-to-pin trace routing - #238

Open
AM-Mehrabii wants to merge 21 commits into
tscircuit:mainfrom
AM-Mehrabii:feat/wire-drawing-gnd-placement
Open

feat: schematic placement tools and pin-to-pin trace routing#238
AM-Mehrabii wants to merge 21 commits into
tscircuit:mainfrom
AM-Mehrabii:feat/wire-drawing-gnd-placement

Conversation

@AM-Mehrabii

Copy link
Copy Markdown

Summary

Adds interactive schematic drawing/placement modes to SchematicViewer, emitting typed manual edit events for host apps to persist.

Draw modes & edit events

toolMode Edit event
draw_wire edit_schematic_wire_add
draw_bus edit_schematic_bus_add
draw_bus_entry edit_schematic_bus_entry_add
draw_no_connect edit_schematic_no_connect_add
draw_net_label edit_schematic_net_label_add
draw_global_label edit_schematic_global_label_add
draw_power_port edit_schematic_power_port_add
draw_ground_port edit_schematic_ground_port_add
draw_text_note edit_schematic_text_note_add
draw_hier_sheet edit_schematic_hier_sheet_add
draw_component edit_schematic_component_add
draw_trace edit_schematic_wire_add (auto Manhattan route)

Behaviour highlights

  • Wire: port → waypoints → destination port
  • Trace: port → port only; L-route via computeTraceRoute
  • Bus: polyline waypoints; finish with Enter or double-click
  • Labels / ports: click to place, name dialog where needed
  • Hierarchical sheet: drag box → name + target sheet dialog
  • Component placement: resistor / capacitor / inductor; R rotates preview
  • Shared port hit-testing (schematicPortHitTest.ts) for wire + trace
  • Draw tools skip capture on data-schematic-ignore-mouse-capture (host toolbars/dialogs)
  • Pan disabled while draw modes are active (wire, bus, trace, labels, etc.)

API

  • New toolMode values and matching on*Added callbacks on SchematicViewer
  • New types exported from package entry (lib/index.ts)

Test plan

  • Wire: start on port, add waypoints, finish on destination port
  • Bus: waypoints, Enter / double-click to finish, Esc to cancel
  • Bus entry: click to place stub
  • No connect: click near port or on canvas
  • Net label / global label: click, enter name, confirm
  • Power / ground port: click, enter net name
  • Text note: click, enter text
  • Hierarchical sheet: drag box, name persists, target select opens, Place sheet works
  • Component: click to place R/C/L, R rotates preview
  • Trace: click two ports, dashed L-route preview, wire committed
  • Host toolbar still clickable when draw tool active (data-schematic-ignore-mouse-capture)
  • Canvas pan blocked during draw modes; Escape clears in-progress draw

Extend SchematicViewer with additional draw modes (global labels, power and
ground ports, text notes, hierarchical sheets, passive placement) and a
draw_trace mode that emits edit_schematic_wire_add with an auto Manhattan
route between two schematic ports.

Share port hit-testing between wire and trace, skip mouse capture on UI
marked data-schematic-ignore-mouse-capture, and fix bus finish plus
hierarchical sheet dialog input stability.
@vercel

vercel Bot commented Jul 12, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
schematic-viewer Ready Ready Preview Aug 11, 2026 7:54pm

Request Review

pnpm/vite install from GitHub needs compiled output because dist is
not produced during git dependency install without devDependencies.
Resolve SchematicViewer conflicts: keep draw tools alongside sheet
selector, net hover, css/className props, and rename internal sheet id to
selectedSchematicSheetId so host activeSheetId stays for hier placement.
Cast simulation current-graph circuit-json fields for dts generation and
refresh dist output for git-based installs.
Drop verbose inline notes and keep only prop docs and non-obvious behavior
comments that match the rest of schematic-viewer.
Fix format-check CI by running biome format on schematic draw/placement
sources added in this branch.
…ce reshape

Keep components/ports out of blocked screen areas during drag, and let users grab traces to move the L-corner while endpoints stay pinned.

Co-authored-by: Cursor <cursoragent@cursor.com>
Use the native sch-trace-hitbox path (same target as net hover) instead of a misaligned HTML overlay, and apply in-progress orthogonal routes live while dragging.

Co-authored-by: Cursor <cursoragent@cursor.com>
Block canvas pan on wire/port hits, drag ports via SVG hit-targets, and keep select-mode port overlays available from the host app.

Co-authored-by: Cursor <cursoragent@cursor.com>
Resolve source_port_id vs schematic_port_id on pin groups, keep native pin styling in select, and prefer local hit-targets so drags are visible.

Co-authored-by: Cursor <cursoragent@cursor.com>
Shift only pin-attached vertices instead of rewriting traces as port-to-port L-routes, and avoid double-transforming pins that already move with their component group.

Co-authored-by: Cursor <cursoragent@cursor.com>
Disable independent pin drag; keep orthogonal wire follow on component move and allow segment reshape with endpoints pinned to elements.

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant