Skip to content

Commit 76a0678

Browse files
committed
clean
1 parent b9a76db commit 76a0678

1 file changed

Lines changed: 2 additions & 46 deletions

File tree

lib/generate-symbol-tsx.ts

Lines changed: 2 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,8 @@ import { su } from "@tscircuit/soup-util"
44
export const generateSymbolTsx = (
55
circuitJson: AnyCircuitElement[],
66
): string | null => {
7-
const schematicArcs = su(circuitJson).schematic_arc?.list() ?? []
8-
const schematicBoxes = su(circuitJson).schematic_box?.list() ?? []
9-
const schematicLines = su(circuitJson).schematic_line?.list() ?? []
10-
const schematicPaths = su(circuitJson).schematic_path?.list() ?? []
11-
const schematicTexts = su(circuitJson).schematic_text?.list() ?? []
7+
const schematicArcs = su(circuitJson).schematic_arc.list()
8+
const schematicLines = su(circuitJson).schematic_line.list()
129

1310
const elementStrings: string[] = []
1411

@@ -30,21 +27,6 @@ export const generateSymbolTsx = (
3027
)
3128
}
3229

33-
for (const box of schematicBoxes) {
34-
const x = box.x ?? 0
35-
const y = box.y ?? 0
36-
const width = box.width ?? 0
37-
const height = box.height ?? 0
38-
39-
elementStrings.push(
40-
`<schematicbox
41-
center={{ x: ${x}, y: ${y} }}
42-
width={${width}}
43-
height={${height}}
44-
/>`,
45-
)
46-
}
47-
4830
for (const line of schematicLines) {
4931
const x1 = line.x1 ?? 0
5032
const y1 = line.y1 ?? 0
@@ -57,32 +39,6 @@ export const generateSymbolTsx = (
5739
)
5840
}
5941

60-
for (const path of schematicPaths) {
61-
const pointsStr = JSON.stringify(path.points ?? [])
62-
63-
elementStrings.push(
64-
`<schematicpath
65-
points={${pointsStr}}
66-
/>`,
67-
)
68-
}
69-
70-
for (const text of schematicTexts) {
71-
const position = text.position ?? { x: 0, y: 0 }
72-
const textContent = text.text ?? ""
73-
const rotation = text.rotation ?? 0
74-
const anchor = text.anchor ?? "center"
75-
76-
elementStrings.push(
77-
`<schematictext
78-
text="${textContent.replace(/"/g, '\\"')}"
79-
center={{ x: ${position.x}, y: ${position.y} }}
80-
rotation={${rotation}}
81-
anchor="${anchor}"
82-
/>`,
83-
)
84-
}
85-
8642
if (elementStrings.length === 0) {
8743
return null
8844
}

0 commit comments

Comments
 (0)