Skip to content

Fix bottom copper text auto-mirroring in board textures and add regression tests#755

Open
rushabhcodes wants to merge 3 commits intotscircuit:mainfrom
rushabhcodes:feat/add-bottom-text-mirroring
Open

Fix bottom copper text auto-mirroring in board textures and add regression tests#755
rushabhcodes wants to merge 3 commits intotscircuit:mainfrom
rushabhcodes:feat/add-bottom-text-mirroring

Conversation

@rushabhcodes
Copy link
Copy Markdown
Contributor

This PR reproduces and fixes a subtle rendering bug where bottom-layer copper text was not automatically mirrored in the 3D viewer unless is_mirrored was explicitly set.

Changes:

  • Default bottom pcb_copper_text elements to is_mirrored: true during texture generation
  • Preserve explicit overrides such as is_mirrored: false
  • Add focused regression tests covering:
    • bottom copper text auto-mirroring by default
    • explicit bottom non-mirrored text remaining unchanged
    • top copper text behavior staying unchanged

Why this matters:

  • Fixes incorrect bottom-side text rendering
  • Aligns implementation with the expected bottom-layer mirroring behavior already documented in stories

Before

image

After

Screenshot_20260406_212500

Copilot AI review requested due to automatic review settings April 6, 2026 16:06
@vercel
Copy link
Copy Markdown

vercel bot commented Apr 6, 2026

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

Project Deployment Actions Updated (UTC)
3d-viewer Ready Ready Preview, Comment Apr 6, 2026 4:12pm

Request Review

Copy link
Copy Markdown
Contributor

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

Fixes bottom-layer copper text rendering in the 3D viewer by defaulting bottom pcb_copper_text elements to mirrored during copper text texture generation (while preserving explicit is_mirrored overrides).

Changes:

  • Added applyDefaultBottomCopperTextMirroring() to default is_mirrored to true for bottom-layer copper text when unspecified.
  • Updated copper text texture generation to apply this defaulting to filtered copper text elements.
Comments suppressed due to low confidence (1)

src/textures/create-copper-text-texture-for-layer.ts:16

  • PR description mentions adding regression tests for bottom copper text auto-mirroring, but no new/updated test files appear in this change set (and the existing tests/ directory contains no pcb_copper_text coverage). Please either add the promised tests or update the PR description to match what’s actually being delivered.
export function createCopperTextTextureForLayer({
  layer,
  circuitJson,
  boardData,
  copperColor = "rgb(230, 153, 51)",
  traceTextureResolution = TRACE_TEXTURE_RESOLUTION,
}: {
  layer: "top" | "bottom"
  circuitJson: AnyCircuitElement[]
  boardData: PcbBoard

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

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.

2 participants