feat: Render copper text via circuit-to-canvas on copper layers#677
feat: Render copper text via circuit-to-canvas on copper layers#677rushabhcodes wants to merge 5 commits intotscircuit:mainfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
there is a issue in bottom knockout |
There was a problem hiding this comment.
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.tswithdrawCopperTextElementsForLayerto renderpcb_copper_textusingCircuitToCanvasDrawer. - Updated
CanvasPrimitiveRenderer.tsxto exclude copper text fromdrawPrimitivesand render it per copper layer via the new draw helper. - Removed the legacy primitive conversion for copper text and updated
convertElementToPrimitivesso 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.
@seveibar fixed
|
|
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") |
There was a problem hiding this comment.
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 === |
There was a problem hiding this comment.
keep the traces don't remove it


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:
drawCopperTextElementsForLayerfunction insrc/lib/draw-copper-text.tsto handle the drawing of copper text elements directly using the circuit-to-canvas renderer, with custom color mapping for copper layers.CanvasPrimitiveRenderer.tsxto 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:
convertPcbCopperTextToPrimitivefunction and its import, as copper text elements are no longer converted to primitives. [1] [2]convertElementToPrimitivesfunction to return an empty array for copper text elements, reflecting their new handling approach.