Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

switch to symbol_display_value for symbol values #108

Merged
merged 1 commit into from
Nov 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified bun.lockb
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,7 @@ export const createSvgObjectsFromSchematicComponentWithSymbol = ({
if (text.text === "{REF}") {
textValue = srcComponent?.name ?? ""
} else if (text.text === "{VAL}") {
textValue =
(srcComponent as any)?.display_value ??
(srcComponent as any).capacitance ??
(srcComponent as any).resistance
textValue = schComponent.symbol_display_value ?? ""
}
svgObjects.push({
name: "text",
Expand Down Expand Up @@ -159,12 +156,6 @@ export const createSvgObjectsFromSchematicComponentWithSymbol = ({
// Draw Boxes

for (const box of boxes) {
// x: number;
// y: number;
// width: number;
// height: number;
// anchor: string;

const screenBoxPos = applyToPoint(
compose(realToScreenTransform, transformFromSymbolToReal),
box,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"vite-tsconfig-paths": "^5.0.1"
},
"peerDependencies": {
"circuit-json": "^0.0.93"
"circuit-json": "^0.0.95"
},
"dependencies": {
"@tscircuit/footprinter": "^0.0.57",
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.
2 changes: 1 addition & 1 deletion tests/sch/__snapshots__/resistor.snap.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 14 additions & 1 deletion tests/sch/resistor.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,19 @@ test("schematic resistor", () => {

expect(
// @ts-ignore
convertCircuitJsonToSchematicSvg(project.getCircuitJson()),
convertCircuitJsonToSchematicSvg(
project
.getCircuitJson()
// TEMPORARY HACK: until @tscircuit/core supports symbol_display_value
.map((elm) => {
if (elm.type === "schematic_component") {
return {
...elm,
symbol_display_value: "10Ω",
}
}
return elm
}),
),
).toMatchSvgSnapshot(import.meta.path)
})
Loading