Skip to content

Commit

Permalink
Merge pull request #109 from tscircuit/portcore
Browse files Browse the repository at this point in the history
Fix schematic port label name using schematic_port.display_pin_label, fix anchoring of bottom text on components, update core
  • Loading branch information
seveibar authored Nov 7, 2024
2 parents fe7e564 + 1b1638a commit 21a8486
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
Binary file modified bun.lockb
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ export const createSvgObjectsForSchPortPinLabel = (params: {
// Transform the pin position from local to global coordinates
const screenPinNumberTextPos = applyToPoint(transform, realPinNumberPos)

const label = schComponent.port_labels?.[`pin${schPort.pin_number}`]
const label =
schPort.display_pin_label ??
schComponent.port_labels?.[`pin${schPort.pin_number}`]

if (!label) return []

Expand All @@ -53,7 +55,11 @@ export const createSvgObjectsForSchPortPinLabel = (params: {
y: screenPinNumberTextPos.y.toString(),
style: "font-family: sans-serif;",
fill: colorMap.schematic.pin_number,
"text-anchor": schPort.side_of_component === "left" ? "start" : "end",
"text-anchor":
schPort.side_of_component === "left" ||
schPort.side_of_component === "bottom"
? "start"
: "end",
"dominant-baseline": "middle",
"font-size": `${getSchFontSize(transform, "pin_number")}px`,
transform:
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"@storybook/react": "^8.2.5",
"@storybook/react-vite": "^8.2.5",
"@storybook/test": "^8.2.5",
"@tscircuit/core": "^0.0.148",
"@tscircuit/core": "^0.0.153",
"@tscircuit/plop": "^0.0.10",
"@types/bun": "^1.1.9",
"bun-match-svg": "^0.0.6",
Expand Down
2 changes: 1 addition & 1 deletion tests/sch/__snapshots__/kicad-theme-demo.snap.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 21a8486

Please sign in to comment.