Skip to content

Fix schStemLength scaling for resized custom symbol ports#1964

Closed
seveibar wants to merge 2 commits intomainfrom
codex/fix-port-stem-scaling-in-custom-symbols
Closed

Fix schStemLength scaling for resized custom symbol ports#1964
seveibar wants to merge 2 commits intomainfrom
codex/fix-port-stem-scaling-in-custom-symbols

Conversation

@seveibar
Copy link
Contributor

Motivation

  • Ports inside custom <symbol /> elements with explicit width/height were not scaling their schematic stem length (schStemLength) to match the symbol resize, causing incorrect schematic_port.distance_from_component_edge and stem line endpoints after symbol scaling.

Description

  • Track each generated stem line by adding schematic_stem_line_id to Port and store the created schematic line so it can be updated later during symbol resize in lib/components/primitive-components/Port/Port.ts.
  • Implement doInitialSchematicSymbolResize on Port to recompute scaled stem length from the symbol transform and update schematic_port.distance_from_component_edge and the stem line endpoint (x2/y2) based on port direction.
  • Preserve original behavior for ports without schStemLength or symbols without explicit sizing and keep initial port/stem creation logic intact.
  • Add a regression test tests/components/primitive-components/port-sch-stem-length.test.tsx that asserts stem scaling for horizontal and vertical directions inside a resized custom symbol.

Testing

  • Ran BUN_UPDATE_SNAPSHOTS=1 bun test tests/components/primitive-components/port-sch-stem-length.test.tsx tests/components/primitive-components/port-sch-stem-length-connected.test.tsx and both tests passed.
  • Ran bunx tsc --noEmit for type checking and it completed with no errors.
  • Ran bun run format which formatted files successfully.

Codex Task

@vercel
Copy link

vercel bot commented Feb 23, 2026

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

Project Deployment Actions Updated (UTC)
tscircuit-core-benchmarks Ready Ready Preview, Comment Feb 23, 2026 8:04pm

Request Review

@github-actions
Copy link

This PR has been automatically marked as stale because it has had no recent activity. It will be closed if no further activity occurs.

@github-actions
Copy link

This PR was closed because it has been inactive for 1 day since being marked as stale.

@github-actions github-actions bot closed this Feb 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant