Skip to content

fix: prevent duplicate pin indicators by deduplicating primitives by element#697

Open
techmannih wants to merge 5 commits intotscircuit:mainfrom
techmannih:jaa
Open

fix: prevent duplicate pin indicators by deduplicating primitives by element#697
techmannih wants to merge 5 commits intotscircuit:mainfrom
techmannih:jaa

Conversation

@techmannih
Copy link
Member

@techmannih techmannih commented Mar 12, 2026

https://discord.com/channels/1233487248129921135/1265314333764878387/1481533515240570960

This PR fixes a bug where hovering over plated holes or complex pads would cause the pin indicator text and red overlay box to appear twice. This occurred because the viewer rendered an overlay for every primitive associated with a pin (e.g., both the copper pad and the drill hole).

Changes

  • Primitive Deduplication: Updated ElementOverlayBox to deduplicate highlighted primitives by their parent _element. This ensures each physical pin or component element gets exactly one overlay box and label, regardless of its internal primitive count.

  • Expanded Hover Priority: Included pcb_plated_hole in the logic that prioritizes pins over traces. When hovering over a plated hole that overlaps with a trace, the pin indicator now correctly takes precedence.

test https://pcb-viewer-bpoaupbkv-tscircuit.vercel.app/?fixture=%7B%22path%22%3A%22src%2Fexamples%2F2026%2Fplated_hole_hover_fix.fixture.tsx%22%7D

@vercel
Copy link

vercel bot commented Mar 12, 2026

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

Project Deployment Actions Updated (UTC)
pcb-viewer Ready Ready Preview, Comment Mar 12, 2026 7:39pm

Request Review

@techmannih
Copy link
Member Author

cc @Abse2001 @ShiboSoftwareDev

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1eb5b92895

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@techmannih techmannih marked this pull request as draft March 13, 2026 17:28
@techmannih techmannih marked this pull request as ready for review March 13, 2026 18:54
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