Skip to content

Highlight pcb_via_clearance_error at pcb_center#738

Merged
imrishabh18 merged 2 commits intomainfrom
codex/highlight-position-of-pcb_via_clearance_error
Apr 13, 2026
Merged

Highlight pcb_via_clearance_error at pcb_center#738
imrishabh18 merged 2 commits intomainfrom
codex/highlight-position-of-pcb_via_clearance_error

Conversation

@imrishabh18
Copy link
Copy Markdown
Member

Motivation

  • Make DRC via-clearance errors visible at the exact PCB location by rendering a marker at pcb_center for pcb_via_clearance_error entries.
  • Ensure error highlighting and the toolbar dropdown use a consistent stable error id so hover/highlight behavior is in sync across components.
  • Allow canvas interactions to highlight vias related to a hovered via-clearance error.

Description

  • Added a new utility src/lib/util/getErrorId.ts that generates stable error ids and includes pcb_via_clearance_error_id alongside existing pcb_trace_error_id and the fallback pattern.
  • Updated src/components/ErrorOverlay.tsx to render a marker and hover popup for pcb_via_clearance_error at pcb_center, preserving the same hover/highlight behavior used for trace errors.
  • Updated src/components/CanvasElementsRenderer.tsx to use getErrorId for matching hovered errors and to include pcb_via_ids in the set of related ids so associated vias are highlighted.
  • Updated src/components/ToolbarErrorDropdown.tsx to use getErrorId so toolbar hover ids match the overlay highlighting for via-clearance errors.

Testing

  • Built the project with npm run build, which completed successfully.
  • Ran formatting checks with npm run format:check after auto-formatting the changed file, and the check passed.

Codex Task

@vercel
Copy link
Copy Markdown

vercel bot commented Apr 13, 2026

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

Project Deployment Actions Updated (UTC)
pcb-viewer Ready Ready Preview, Comment Apr 13, 2026 3:13pm

Request Review

@imrishabh18
Copy link
Copy Markdown
Member Author

image

pcb_via_clearance_error_id?: string
message?: string
pcb_center?: { x: number; y: number }
error_type?: string
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not import this from circuit json?


export const getErrorId = (error: ErrorElementWithIds, index: number) =>
error.pcb_trace_error_id ||
error.pcb_via_clearance_error_id ||
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not very extensive?

export const getErrorId = (error: ErrorElementWithIds, index: number) =>
error.pcb_trace_error_id ||
error.pcb_via_clearance_error_id ||
`error_${index}_${error.error_type}_${error.message?.slice(0, 20)}`
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove

@imrishabh18 imrishabh18 force-pushed the codex/highlight-position-of-pcb_via_clearance_error branch from 6f39ec4 to 1276722 Compare April 13, 2026 14:54
@imrishabh18 imrishabh18 force-pushed the codex/highlight-position-of-pcb_via_clearance_error branch from 07bef5e to e4c19e2 Compare April 13, 2026 15:12
@imrishabh18 imrishabh18 merged commit 8cae812 into main Apr 13, 2026
5 checks passed
@imrishabh18 imrishabh18 deleted the codex/highlight-position-of-pcb_via_clearance_error branch April 13, 2026 15:13
@tscircuitbot
Copy link
Copy Markdown
Contributor


Thank you for your contribution! 🎉

PR Rating: ⭐⭐
Impact: Minor

Track your contributions and see the leaderboard at: tscircuit Contribution Tracker


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants