Skip to content

feat: Render copper text via circuit-to-canvas on copper layers#677

Open
rushabhcodes wants to merge 5 commits intotscircuit:mainfrom
rushabhcodes:fix-copper-text
Open

feat: Render copper text via circuit-to-canvas on copper layers#677
rushabhcodes wants to merge 5 commits intotscircuit:mainfrom
rushabhcodes:fix-copper-text

Conversation

@rushabhcodes
Copy link
Copy Markdown
Contributor

@rushabhcodes rushabhcodes commented Feb 21, 2026

This pull request updates how copper text elements are rendered in the PCB canvas viewer. Instead of converting copper text elements into primitives and drawing them with the primitive renderer, copper text elements are now drawn directly using a new specialized function. This change improves rendering accuracy and code maintainability by separating copper text handling from the generic primitive pipeline.

Rendering and drawing changes:

  • Added a new drawCopperTextElementsForLayer function in src/lib/draw-copper-text.ts to handle the drawing of copper text elements directly using the circuit-to-canvas renderer, with custom color mapping for copper layers.
  • Updated CanvasPrimitiveRenderer.tsx to exclude copper text elements from the primitive drawing pipeline and instead draw them separately using the new function. [1] [2] [3]

Code cleanup and refactoring:

  • Removed the now-unused convertPcbCopperTextToPrimitive function and its import, as copper text elements are no longer converted to primitives. [1] [2]
  • Updated the convertElementToPrimitives function to return an empty array for copper text elements, reflecting their new handling approach.
image

Copilot AI review requested due to automatic review settings February 21, 2026 18:26
@vercel
Copy link
Copy Markdown

vercel bot commented Feb 21, 2026

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

Project Deployment Actions Updated (UTC)
pcb-viewer Ready Ready Preview, Comment Feb 21, 2026 9:34pm

Request Review

Copy link
Copy Markdown
Contributor

@seveibar seveibar left a comment

Choose a reason for hiding this comment

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

Test?

@rushabhcodes
Copy link
Copy Markdown
Contributor Author

@rushabhcodes
Copy link
Copy Markdown
Contributor Author

there is a issue in bottom knockout

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR changes PCB copper text rendering in the canvas viewer by removing copper text from the primitive-renderer pipeline and drawing it directly via circuit-to-canvas on copper layers, with viewer-specific copper color overrides.

Changes:

  • Added src/lib/draw-copper-text.ts with drawCopperTextElementsForLayer to render pcb_copper_text using CircuitToCanvasDrawer.
  • Updated CanvasPrimitiveRenderer.tsx to exclude copper text from drawPrimitives and render it per copper layer via the new draw helper.
  • Removed the legacy primitive conversion for copper text and updated convertElementToPrimitives so copper text no longer produces primitives.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
src/lib/element-to-primitive/convert-pcb-copper-text-to-primitive.ts Deleted legacy copper-text-to-primitive conversion.
src/lib/draw-copper-text.ts New copper text draw helper using circuit-to-canvas with copper color overrides.
src/lib/convert-element-to-primitive.ts Removes copper text conversion path (copper text now yields no primitives).
src/components/CanvasPrimitiveRenderer.tsx Excludes copper text primitives and draws copper text separately per copper layer.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@rushabhcodes
Copy link
Copy Markdown
Contributor Author

image @seveibar fixed

@seveibar
Copy link
Copy Markdown
Contributor

i think @Abse2001 should maybe review this

.filter((p) => p._element?.type !== "pcb_plated_hole")
.filter((p) => p._element?.type !== "pcb_via")
.filter((p) => p._element?.type !== "pcb_trace")
.filter((p) => p._element?.type !== "pcb_copper_text")
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.

don't filter out if you already removed the copper text primitves, we only filter things that soppourt hover

material: "fr4",
thickness: 1.6,
},
// === TRACES UNDERNEATH KNOCKOUT TEXT TO VERIFY SEE-THROUGH ===
Copy link
Copy Markdown
Contributor

@Abse2001 Abse2001 Feb 21, 2026

Choose a reason for hiding this comment

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

keep the traces don't remove it

@Abse2001
Copy link
Copy Markdown
Contributor

You can see in the preview the bottom trace should appear through knockout text letters but it's not make sure the text is a cut that is see through

Screenshot_2026-02-21-23-37-09-523_com.android.chrome-edit.jpg

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.

4 participants