@tscircuit/schematic-trace-solver 0.0.24 → 0.0.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/.github/workflows/bun-test.yml +8 -0
  2. package/README.md +28 -0
  3. package/bunfig.toml +2 -2
  4. package/dist/index.js +24 -6137
  5. package/lib/solvers/NetLabelPlacementSolver/NetLabelPlacementSolver.ts +0 -1
  6. package/lib/solvers/NetLabelPlacementSolver/SingleNetLabelPlacementSolver/SingleNetLabelPlacementSolver_visualize.ts +0 -1
  7. package/lib/solvers/NetLabelPlacementSolver/SingleNetLabelPlacementSolver/geometry.ts +1 -1
  8. package/lib/solvers/SchematicTraceLinesSolver/SchematicTraceLinesSolver.ts +0 -2
  9. package/lib/solvers/SchematicTraceLinesSolver/SchematicTraceSingleLineSolver/SchematicTraceSingleLineSolver.ts +0 -1
  10. package/lib/solvers/TraceOverlapShiftSolver/TraceOverlapIssueSolver/TraceOverlapIssueSolver.ts +0 -2
  11. package/lib/solvers/TraceOverlapShiftSolver/TraceOverlapShiftSolver.ts +0 -1
  12. package/package.json +6 -7
  13. package/site/components/DownloadDropdown.tsx +4 -2
  14. package/site/examples/example01-basic.page.tsx +1 -1
  15. package/site/examples/example02.page.tsx +1 -1
  16. package/site/examples/example03.page.tsx +1 -1
  17. package/site/examples/example04-single-symbol.page.tsx +1 -1
  18. package/site/examples/example05.page.tsx +1 -1
  19. package/site/examples/example06.page.tsx +1 -1
  20. package/site/examples/example07.page.tsx +1 -1
  21. package/site/examples/example08.page.tsx +1 -1
  22. package/site/examples/example09.page.tsx +1 -1
  23. package/site/examples/example10.page.tsx +1 -1
  24. package/site/examples/example11.page.tsx +119 -0
  25. package/site/examples/example12.page.tsx +97 -0
  26. package/tests/__snapshots__/svg.snap.svg +3 -0
  27. package/tests/examples/__snapshots__/example01.snap.svg +157 -0
  28. package/tests/examples/__snapshots__/example02.snap.svg +262 -0
  29. package/tests/examples/__snapshots__/example03.snap.svg +282 -0
  30. package/tests/examples/__snapshots__/example04.snap.svg +87 -0
  31. package/tests/examples/__snapshots__/example05.snap.svg +190 -0
  32. package/tests/examples/__snapshots__/example06.snap.svg +94 -0
  33. package/tests/examples/__snapshots__/example07.snap.svg +204 -0
  34. package/tests/examples/__snapshots__/example08.snap.svg +136 -0
  35. package/tests/examples/__snapshots__/example09.snap.svg +484 -0
  36. package/tests/examples/__snapshots__/example10.snap.svg +135 -0
  37. package/tests/examples/example01.test.ts +12 -0
  38. package/tests/examples/example02.test.ts +12 -0
  39. package/tests/examples/example03.test.ts +12 -0
  40. package/tests/examples/example04.test.ts +12 -0
  41. package/tests/examples/example05.test.ts +12 -0
  42. package/tests/examples/example06.test.ts +12 -0
  43. package/tests/examples/example07.test.ts +12 -0
  44. package/tests/examples/example08.test.ts +12 -0
  45. package/tests/examples/example09.test.ts +12 -0
  46. package/tests/examples/example10.test.ts +12 -0
  47. package/tests/fixtures/matcher.ts +62 -0
  48. package/tests/fixtures/preload.ts +1 -0
  49. package/tests/svg.test.ts +11 -0
@@ -306,7 +306,6 @@ export class NetLabelPlacementSolver extends BaseSolver {
306
306
  graphics.lines!.push({
307
307
  points: trace.tracePath,
308
308
  strokeColor: "purple",
309
- strokeWidth: 0.005,
310
309
  })
311
310
  }
312
311
 
@@ -26,7 +26,6 @@ export function visualizeSingleNetLabelPlacementSolver(
26
26
  graphics.lines!.push({
27
27
  points: trace.tracePath,
28
28
  strokeColor: isHost ? groupStroke : groupFill,
29
- strokeWidth: isHost ? 0.006 : 0.003,
30
29
  strokeDash: isHost ? undefined : "4 2",
31
30
  } as any)
32
31
  }
@@ -1,6 +1,6 @@
1
1
  import type { FacingDirection } from "lib/utils/dir"
2
2
 
3
- export const NET_LABEL_HORIZONTAL_WIDTH = 0.5
3
+ export const NET_LABEL_HORIZONTAL_WIDTH = 0.45
4
4
  export const NET_LABEL_HORIZONTAL_HEIGHT = 0.2
5
5
 
6
6
  export function getDimsForOrientation(orientation: FacingDirection) {
@@ -132,7 +132,6 @@ export class SchematicTraceLinesSolver extends BaseSolver {
132
132
  for (const { mspPairId, tracePath } of this.solvedTracePaths) {
133
133
  graphics.lines!.push({
134
134
  points: tracePath,
135
- strokeWidth: 0.005,
136
135
  strokeColor: "green",
137
136
  })
138
137
  }
@@ -146,7 +145,6 @@ export class SchematicTraceLinesSolver extends BaseSolver {
146
145
  ],
147
146
  strokeColor: "red",
148
147
  strokeDash: "4 2",
149
- strokeWidth: 0.004,
150
148
  })
151
149
  }
152
150
 
@@ -241,7 +241,6 @@ export class SchematicTraceSingleLineSolver extends BaseSolver {
241
241
  graphics.lines!.push({
242
242
  points: this.queuedCandidatePaths[0],
243
243
  strokeColor: "orange",
244
- strokeWidth: boundsWidth * 0.005,
245
244
  })
246
245
  }
247
246
 
@@ -162,7 +162,6 @@ export class TraceOverlapIssueSolver extends BaseSolver {
162
162
  graphics.lines!.push({
163
163
  points: [segStart, segEnd],
164
164
  strokeColor: "red",
165
- strokeWidth: 0.006,
166
165
  })
167
166
  }
168
167
  }
@@ -173,7 +172,6 @@ export class TraceOverlapIssueSolver extends BaseSolver {
173
172
  points: trace.tracePath,
174
173
  strokeColor: "blue",
175
174
  strokeDash: "4 2",
176
- strokeWidth: 0.004,
177
175
  })
178
176
  }
179
177
 
@@ -255,7 +255,6 @@ export class TraceOverlapShiftSolver extends BaseSolver {
255
255
  graphics.lines!.push({
256
256
  points: trace.tracePath,
257
257
  strokeColor: "purple",
258
- strokeWidth: 0.005,
259
258
  })
260
259
  }
261
260
 
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@tscircuit/schematic-trace-solver",
3
3
  "main": "dist/index.js",
4
- "version": "0.0.24",
4
+ "version": "0.0.26",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "start": "cosmos",
8
- "build": "tsup lib/index.ts --format esm --dts",
8
+ "build": "tsup-node lib/index.ts --format esm --dts",
9
9
  "format": "biome format --write .",
10
10
  "format:check": "biome format ."
11
11
  },
@@ -13,21 +13,20 @@
13
13
  "@biomejs/biome": "^2.2.2",
14
14
  "@react-hook/resize-observer": "^2.0.2",
15
15
  "@tscircuit/math-utils": "^0.0.19",
16
- "@types/bun": "latest",
16
+ "@types/bun": "^1.2.21",
17
+ "bun-match-svg": "^0.0.13",
17
18
  "calculate-elbow": "^0.0.11",
18
19
  "connectivity-map": "^1.0.0",
19
20
  "flatbush": "^4.5.0",
20
21
  "graphics-debug": "^0.0.62",
22
+ "react": "^19.1.1",
21
23
  "react-cosmos": "^7.0.0",
22
24
  "react-cosmos-plugin-vite": "^7.0.0",
25
+ "react-dom": "^19.1.1",
23
26
  "tsup": "^8.5.0",
24
27
  "vite": "^7.1.3"
25
28
  },
26
29
  "peerDependencies": {
27
30
  "typescript": "^5"
28
- },
29
- "dependencies": {
30
- "react": "^19.1.1",
31
- "react-dom": "^19.1.1"
32
31
  }
33
32
  }
@@ -98,11 +98,11 @@ export default () => <PipelineDebugger inputProblem={inputProblem} />
98
98
  import { GenericSolverDebugger } from "../components/GenericSolverDebugger"
99
99
  import { ${solverName} } from "lib/solvers/${solverName}/${solverName}"
100
100
 
101
- const input = ${JSON.stringify(params, null, 2)}
101
+ export const inputProblem = ${JSON.stringify(params, null, 2)}
102
102
 
103
103
  export default () => {
104
104
  const solver = useMemo(() => {
105
- return new ${solverName}(input as any)
105
+ return new ${solverName}(inputProblem as any)
106
106
  }, [])
107
107
  return <GenericSolverDebugger solver={solver} />
108
108
  }
@@ -138,6 +138,8 @@ test("${solverName} should solve problem correctly", () => {
138
138
 
139
139
  const solver = new ${solverName}(input as any)
140
140
  solver.solve()
141
+
142
+ expect(solver).toMatchSolverSnapshot(import.meta.path)
141
143
 
142
144
  // Add more specific assertions based on expected output
143
145
  // expect(solver.netLabelPlacementSolver!.netLabelPlacements).toMatchInlineSnapshot()
@@ -1,7 +1,7 @@
1
1
  import type { InputProblem } from "lib/types/InputProblem"
2
2
  import { PipelineDebugger } from "site/components/PipelineDebugger"
3
3
 
4
- const inputProblem: InputProblem = {
4
+ export const inputProblem: InputProblem = {
5
5
  chips: [
6
6
  {
7
7
  chipId: "U1",
@@ -1,6 +1,6 @@
1
1
  import { PipelineDebugger } from "site/components/PipelineDebugger"
2
2
  import type { InputProblem } from "lib/types/InputProblem"
3
- const inputProblem: InputProblem = {
3
+ export const inputProblem: InputProblem = {
4
4
  chips: [
5
5
  {
6
6
  chipId: "schematic_component_0",
@@ -1,7 +1,7 @@
1
1
  import type { InputProblem } from "lib/index"
2
2
  import { PipelineDebugger } from "site/components/PipelineDebugger"
3
3
 
4
- const inputProblem: InputProblem = {
4
+ export const inputProblem: InputProblem = {
5
5
  chips: [
6
6
  {
7
7
  chipId: "schematic_component_0",
@@ -1,7 +1,7 @@
1
1
  import { PipelineDebugger } from "../components/PipelineDebugger"
2
2
  import type { InputProblem } from "lib/types/InputProblem"
3
3
 
4
- const inputProblem: InputProblem = {
4
+ export const inputProblem: InputProblem = {
5
5
  chips: [
6
6
  {
7
7
  chipId: "schematic_component_0",
@@ -1,7 +1,7 @@
1
1
  import type { InputProblem } from "lib/index"
2
2
  import { PipelineDebugger } from "site/components/PipelineDebugger"
3
3
 
4
- const inputProblem: InputProblem = {
4
+ export const inputProblem: InputProblem = {
5
5
  chips: [
6
6
  {
7
7
  chipId: "schematic_component_0",
@@ -1,7 +1,7 @@
1
1
  import { PipelineDebugger } from "site/components/PipelineDebugger"
2
2
  import type { InputProblem } from "lib/types/InputProblem"
3
3
 
4
- const inputProblem: InputProblem = {
4
+ export const inputProblem: InputProblem = {
5
5
  chips: [
6
6
  {
7
7
  chipId: "schematic_component_0",
@@ -1,7 +1,7 @@
1
1
  import { PipelineDebugger } from "site/components/PipelineDebugger"
2
2
  import type { InputProblem } from "lib/types/InputProblem"
3
3
 
4
- const inputProblem: InputProblem = {
4
+ export const inputProblem: InputProblem = {
5
5
  chips: [
6
6
  {
7
7
  chipId: "schematic_component_0",
@@ -1,7 +1,7 @@
1
1
  import { PipelineDebugger } from "site/components/PipelineDebugger"
2
2
  import type { InputProblem } from "lib/types/InputProblem"
3
3
 
4
- const inputProblem: InputProblem = {
4
+ export const inputProblem: InputProblem = {
5
5
  chips: [
6
6
  {
7
7
  chipId: "schematic_component_0",
@@ -1,7 +1,7 @@
1
1
  import { PipelineDebugger } from "site/components/PipelineDebugger"
2
2
  import type { InputProblem } from "lib/types/InputProblem"
3
3
 
4
- const inputProblem: InputProblem = {
4
+ export const inputProblem: InputProblem = {
5
5
  chips: [
6
6
  {
7
7
  chipId: "schematic_component_0",
@@ -1,7 +1,7 @@
1
1
  import { PipelineDebugger } from "site/components/PipelineDebugger"
2
2
  import type { InputProblem } from "lib/types/InputProblem"
3
3
 
4
- const inputProblem: InputProblem = {
4
+ export const inputProblem: InputProblem = {
5
5
  chips: [
6
6
  {
7
7
  chipId: "schematic_component_0",
@@ -0,0 +1,119 @@
1
+ import { PipelineDebugger } from "site/components/PipelineDebugger"
2
+ import type { InputProblem } from "lib/types/InputProblem"
3
+
4
+ const inputProblem: InputProblem = {
5
+ chips: [
6
+ {
7
+ chipId: "schematic_component_0",
8
+ center: {
9
+ x: -1.03,
10
+ y: 0.765,
11
+ },
12
+ width: 1.06,
13
+ height: 0.388910699999999,
14
+ pins: [
15
+ {
16
+ pinId: "R1.1",
17
+ x: -1.58,
18
+ y: 0.765,
19
+ },
20
+ {
21
+ pinId: "R1.2",
22
+ x: -0.48,
23
+ y: 0.765,
24
+ },
25
+ ],
26
+ },
27
+ {
28
+ chipId: "schematic_component_1",
29
+ center: {
30
+ x: 1.03,
31
+ y: 0.765,
32
+ },
33
+ width: 1.06,
34
+ height: 0.388910699999999,
35
+ pins: [
36
+ {
37
+ pinId: "R2.1",
38
+ x: 0.48,
39
+ y: 0.765,
40
+ },
41
+ {
42
+ pinId: "R2.2",
43
+ x: 1.58,
44
+ y: 0.765,
45
+ },
46
+ ],
47
+ },
48
+ {
49
+ chipId: "schematic_component_2",
50
+ center: {
51
+ x: -1.03,
52
+ y: -0.765,
53
+ },
54
+ width: 1.06,
55
+ height: 0.388910699999999,
56
+ pins: [
57
+ {
58
+ pinId: "R3.1",
59
+ x: -1.58,
60
+ y: -0.765,
61
+ },
62
+ {
63
+ pinId: "R3.2",
64
+ x: -0.48,
65
+ y: -0.765,
66
+ },
67
+ ],
68
+ },
69
+ {
70
+ chipId: "schematic_component_3",
71
+ center: {
72
+ x: 1.03,
73
+ y: -0.765,
74
+ },
75
+ width: 0.88,
76
+ height: 0.53,
77
+ pins: [
78
+ {
79
+ pinId: "J1.1",
80
+ x: 0.5800000000000001,
81
+ y: -0.665,
82
+ },
83
+ {
84
+ pinId: "J1.2",
85
+ x: 1.03,
86
+ y: -1.0150000000000001,
87
+ },
88
+ {
89
+ pinId: "J1.3",
90
+ x: 1.48,
91
+ y: -0.665,
92
+ },
93
+ ],
94
+ },
95
+ ],
96
+ directConnections: [
97
+ {
98
+ pinIds: ["R2.1", "R3.2"],
99
+ netId: ".R2 > .pin1 to .R3 > .pin2",
100
+ },
101
+ {
102
+ pinIds: ["R2.2", "R3.1"],
103
+ netId: ".R2 > .pin2 to .R3 > .pin1",
104
+ },
105
+ {
106
+ pinIds: ["J1.1", "R1.1"],
107
+ netId: ".J1 > .pin1 to .R1 > .pin1",
108
+ },
109
+ {
110
+ pinIds: ["J1.3", "R1.2"],
111
+ netId: ".J1 > .pin3 to .R1 > .pin2",
112
+ },
113
+ ],
114
+ netConnections: [],
115
+ availableNetLabelOrientations: {},
116
+ maxMspPairDistance: 5,
117
+ }
118
+
119
+ export default () => <PipelineDebugger inputProblem={inputProblem} />
@@ -0,0 +1,97 @@
1
+ import { PipelineDebugger } from "site/components/PipelineDebugger"
2
+ import type { InputProblem } from "lib/types/InputProblem"
3
+
4
+ const inputProblem: InputProblem = {
5
+ chips: [
6
+ {
7
+ chipId: "schematic_component_0",
8
+ center: {
9
+ x: 0,
10
+ y: 0,
11
+ },
12
+ width: 1.4000000000000001,
13
+ height: 0.8,
14
+ pins: [
15
+ {
16
+ pinId: "J1.1",
17
+ x: 1.1,
18
+ y: 0.2,
19
+ },
20
+ {
21
+ pinId: "J1.2",
22
+ x: 1.1,
23
+ y: 0,
24
+ },
25
+ {
26
+ pinId: "J1.3",
27
+ x: 1.1,
28
+ y: -0.2,
29
+ },
30
+ ],
31
+ },
32
+ {
33
+ chipId: "schematic_component_1",
34
+ center: {
35
+ x: 1.0999999999999996,
36
+ y: -1.7944553499999996,
37
+ },
38
+ width: 1.06,
39
+ height: 0.388910699999999,
40
+ pins: [
41
+ {
42
+ pinId: "R1.1",
43
+ x: 0.5499999999999996,
44
+ y: -1.7944553499999996,
45
+ },
46
+ {
47
+ pinId: "R1.2",
48
+ x: 1.6499999999999997,
49
+ y: -1.7944553499999996,
50
+ },
51
+ ],
52
+ },
53
+ {
54
+ chipId: "schematic_component_2",
55
+ center: {
56
+ x: 2.86,
57
+ y: 0.01999999999999985,
58
+ },
59
+ width: 1.06,
60
+ height: 0.84,
61
+ pins: [
62
+ {
63
+ pinId: "C1.1",
64
+ x: 2.3099999999999996,
65
+ y: 0.01999999999999985,
66
+ },
67
+ {
68
+ pinId: "C1.2",
69
+ x: 3.41,
70
+ y: 0.01999999999999985,
71
+ },
72
+ ],
73
+ },
74
+ ],
75
+ directConnections: [],
76
+ netConnections: [
77
+ {
78
+ netId: "VCC",
79
+ pinIds: ["J1.1", "C1.1"],
80
+ },
81
+ {
82
+ netId: "OUT",
83
+ pinIds: ["J1.2", "R1.1"],
84
+ },
85
+ {
86
+ netId: "GND",
87
+ pinIds: ["J1.3", "R1.2", "C1.2"],
88
+ },
89
+ ],
90
+ availableNetLabelOrientations: {
91
+ VCC: ["y+"],
92
+ GND: ["y-"],
93
+ },
94
+ maxMspPairDistance: 5,
95
+ }
96
+
97
+ export default () => <PipelineDebugger inputProblem={inputProblem} />
@@ -0,0 +1,3 @@
1
+ <svg width="100" height="100" xmlns="http://www.w3.org/2000/svg">
2
+ <circle cx="50" cy="50" r="40" stroke="black" stroke-width="3" fill="red" />
3
+ </svg>
@@ -0,0 +1,157 @@
1
+ <svg width="640" height="640" viewBox="0 0 640 640" xmlns="http://www.w3.org/2000/svg">
2
+ <rect width="100%" height="100%" fill="white" />
3
+ <g>
4
+ <circle data-type="point" data-label="U1.1
5
+ x-" data-x="-0.8" data-y="0.2" cx="422.5742574257426" cy="297.8217821782178" r="3" fill="hsl(319, 100%, 50%, 0.8)" />
6
+ </g>
7
+ <g>
8
+ <circle data-type="point" data-label="U1.2
9
+ x-" data-x="-0.8" data-y="0" cx="422.5742574257426" cy="320" r="3" fill="hsl(320, 100%, 50%, 0.8)" />
10
+ </g>
11
+ <g>
12
+ <circle data-type="point" data-label="U1.3
13
+ x-" data-x="-0.8" data-y="-0.2" cx="422.5742574257426" cy="342.1782178217822" r="3" fill="hsl(321, 100%, 50%, 0.8)" />
14
+ </g>
15
+ <g>
16
+ <circle data-type="point" data-label="U1.4
17
+ x+" data-x="0.8" data-y="-0.2" cx="600" cy="342.1782178217822" r="3" fill="hsl(322, 100%, 50%, 0.8)" />
18
+ </g>
19
+ <g>
20
+ <circle data-type="point" data-label="U1.5
21
+ x+" data-x="0.8" data-y="0" cx="600" cy="320" r="3" fill="hsl(323, 100%, 50%, 0.8)" />
22
+ </g>
23
+ <g>
24
+ <circle data-type="point" data-label="U1.6
25
+ x+" data-x="0.8" data-y="0.2" cx="600" cy="297.8217821782178" r="3" fill="hsl(324, 100%, 50%, 0.8)" />
26
+ </g>
27
+ <g>
28
+ <circle data-type="point" data-label="C1.1
29
+ y+" data-x="-2" data-y="0.5" cx="289.50495049504957" cy="264.55445544554453" r="3" fill="hsl(121, 100%, 50%, 0.8)" />
30
+ </g>
31
+ <g>
32
+ <circle data-type="point" data-label="C1.2
33
+ y-" data-x="-2" data-y="-0.5" cx="289.50495049504957" cy="375.44554455445547" r="3" fill="hsl(122, 100%, 50%, 0.8)" />
34
+ </g>
35
+ <g>
36
+ <circle data-type="point" data-label="C2.1
37
+ y+" data-x="-4" data-y="0.5" cx="67.72277227722776" cy="264.55445544554453" r="3" fill="hsl(2, 100%, 50%, 0.8)" />
38
+ </g>
39
+ <g>
40
+ <circle data-type="point" data-label="C2.2
41
+ y-" data-x="-4" data-y="-0.5" cx="67.72277227722776" cy="375.44554455445547" r="3" fill="hsl(3, 100%, 50%, 0.8)" />
42
+ </g>
43
+ <g>
44
+ <circle data-type="point" data-label="" data-x="-1.4" data-y="0.7" cx="356.0396039603961" cy="242.3762376237624" r="3" fill="hsl(40, 100%, 50%, 0.9)" />
45
+ </g>
46
+ <g>
47
+ <circle data-type="point" data-label="" data-x="-0.8" data-y="0" cx="422.5742574257426" cy="320" r="3" fill="hsl(40, 100%, 50%, 0.9)" />
48
+ </g>
49
+ <g>
50
+ <circle data-type="point" data-label="" data-x="-4" data-y="0.5" cx="67.72277227722776" cy="264.55445544554453" r="3" fill="hsl(40, 100%, 50%, 0.9)" />
51
+ </g>
52
+ <g>
53
+ <circle data-type="point" data-label="" data-x="-1.4" data-y="-0.7" cx="356.0396039603961" cy="397.6237623762376" r="3" fill="hsl(40, 100%, 50%, 0.9)" />
54
+ </g>
55
+ <g>
56
+ <polyline data-points="-0.8,0.2 -2,0.5" data-type="line" data-label="" points="422.5742574257426,297.8217821782178 289.50495049504957,264.55445544554453" fill="none" stroke="hsl(190, 100%, 50%, 0.8)" stroke-width="1" />
57
+ </g>
58
+ <g>
59
+ <polyline data-points="-0.8,0 -4,0.5" data-type="line" data-label="" points="422.5742574257426,320 67.72277227722776,264.55445544554453" fill="none" stroke="hsl(57, 100%, 50%, 0.8)" stroke-width="1" />
60
+ </g>
61
+ <g>
62
+ <polyline data-points="-0.8,-0.2 -4,-0.5" data-type="line" data-label="" points="422.5742574257426,342.1782178217822 67.72277227722776,375.44554455445547" fill="none" stroke="hsl(157, 100%, 50%, 0.8)" stroke-width="1" stroke-dasharray="4 2" />
63
+ </g>
64
+ <g>
65
+ <polyline data-points="-0.8,-0.2 -2,-0.5" data-type="line" data-label="" points="422.5742574257426,342.1782178217822 289.50495049504957,375.44554455445547" fill="none" stroke="hsl(157, 100%, 50%, 0.8)" stroke-width="1" stroke-dasharray="4 2" />
66
+ </g>
67
+ <g>
68
+ <polyline data-points="-4,-0.5 -2,-0.5" data-type="line" data-label="" points="67.72277227722776,375.44554455445547 289.50495049504957,375.44554455445547" fill="none" stroke="hsl(157, 100%, 50%, 0.8)" stroke-width="1" stroke-dasharray="4 2" />
69
+ </g>
70
+ <g>
71
+ <polyline data-points="-0.8,0.20000000000000018 -1.4,0.20000000000000018 -1.4,0.7 -2,0.7 -2,0.5" data-type="line" data-label="" points="422.5742574257426,297.8217821782178 356.0396039603961,297.8217821782178 356.0396039603961,242.3762376237624 289.50495049504957,242.3762376237624 289.50495049504957,264.55445544554453" fill="none" stroke="purple" stroke-width="1" />
72
+ </g>
73
+ <g>
74
+ <polyline data-points="-0.8,-0.20000000000000018 -1.4,-0.20000000000000018 -1.4,-0.7 -2,-0.7 -2,-0.5" data-type="line" data-label="" points="422.5742574257426,342.1782178217822 356.0396039603961,342.1782178217822 356.0396039603961,397.6237623762376 289.50495049504957,397.6237623762376 289.50495049504957,375.44554455445547" fill="none" stroke="purple" stroke-width="1" />
75
+ </g>
76
+ <g>
77
+ <polyline data-points="-4,-0.5 -4,-0.7000000000000002 -2,-0.7000000000000002 -2,-0.5" data-type="line" data-label="" points="67.72277227722776,375.44554455445547 67.72277227722776,397.62376237623766 289.50495049504957,397.62376237623766 289.50495049504957,375.44554455445547" fill="none" stroke="purple" stroke-width="1" />
78
+ </g>
79
+ <g>
80
+ <rect data-type="rect" data-label="U1" data-x="0" data-y="0" x="422.5742574257426" y="286.73267326732673" width="177.4257425742574" height="66.53465346534654" fill="hsl(164, 100%, 50%, 0.8)" stroke="black" stroke-width="0.009017857142857143" />
81
+ </g>
82
+ <g>
83
+ <rect data-type="rect" data-label="C1" data-x="-2" data-y="0" x="261.7821782178218" y="264.55445544554453" width="55.445544554455466" height="110.89108910891093" fill="hsl(326, 100%, 50%, 0.8)" stroke="black" stroke-width="0.009017857142857143" />
84
+ </g>
85
+ <g>
86
+ <rect data-type="rect" data-label="C2" data-x="-4" data-y="0" x="40.00000000000006" y="264.55445544554453" width="55.44554455445541" height="110.89108910891093" fill="hsl(327, 100%, 50%, 0.8)" stroke="black" stroke-width="0.009017857142857143" />
87
+ </g>
88
+ <g>
89
+ <rect data-type="rect" data-label="" data-x="-1.4" data-y="0.8999999999999999" x="344.950495049505" y="198.01980198019805" width="22.178217821782198" height="44.35643564356434" fill="hsl(40, 100%, 50%, 0.35)" stroke="black" stroke-width="0.009017857142857143" />
90
+ </g>
91
+ <g>
92
+ <rect data-type="rect" data-label="" data-x="-1.001" data-y="0" x="378.10693069306933" y="308.91089108910893" width="44.356435643564396" height="22.17821782178214" fill="hsl(40, 100%, 50%, 0.35)" stroke="black" stroke-width="0.009017857142857143" />
93
+ </g>
94
+ <g>
95
+ <rect data-type="rect" data-label="" data-x="-4" data-y="0.701" x="56.63366336633669" y="220.08712871287128" width="22.17821782178214" height="44.356435643564396" fill="hsl(40, 100%, 50%, 0.35)" stroke="black" stroke-width="0.009017857142857143" />
96
+ </g>
97
+ <g>
98
+ <rect data-type="rect" data-label="" data-x="-1.4" data-y="-0.8999999999999999" x="344.950495049505" y="397.6237623762376" width="22.178217821782198" height="44.35643564356434" fill="hsl(40, 100%, 50%, 0.35)" stroke="black" stroke-width="0.009017857142857143" />
99
+ </g>
100
+ <g id="crosshair" style="display: none">
101
+ <line id="crosshair-h" y1="0" y2="640" stroke="#666" stroke-width="0.5" />
102
+ <line id="crosshair-v" x1="0" x2="640" stroke="#666" stroke-width="0.5" /><text id="coordinates" font-family="monospace" font-size="12" fill="#666"></text>
103
+ </g>
104
+ <script>
105
+ <![CDATA[
106
+ document.currentScript.parentElement.addEventListener('mousemove', (e) => {
107
+ const svg = e.currentTarget;
108
+ const rect = svg.getBoundingClientRect();
109
+ const x = e.clientX - rect.left;
110
+ const y = e.clientY - rect.top;
111
+ const crosshair = svg.getElementById('crosshair');
112
+ const h = svg.getElementById('crosshair-h');
113
+ const v = svg.getElementById('crosshair-v');
114
+ const coords = svg.getElementById('coordinates');
115
+
116
+ crosshair.style.display = 'block';
117
+ h.setAttribute('x1', '0');
118
+ h.setAttribute('x2', '640');
119
+ h.setAttribute('y1', y);
120
+ h.setAttribute('y2', y);
121
+ v.setAttribute('x1', x);
122
+ v.setAttribute('x2', x);
123
+ v.setAttribute('y1', '0');
124
+ v.setAttribute('y2', '640');
125
+
126
+ // Calculate real coordinates using inverse transformation
127
+ const matrix = {
128
+ "a": 110.89108910891089,
129
+ "c": 0,
130
+ "e": 511.2871287128713,
131
+ "b": 0,
132
+ "d": -110.89108910891089,
133
+ "f": 320
134
+ };
135
+ // Manually invert and apply the affine transform
136
+ // Since we only use translate and scale, we can directly compute:
137
+ // x' = (x - tx) / sx
138
+ // y' = (y - ty) / sy
139
+ const sx = matrix.a;
140
+ const sy = matrix.d;
141
+ const tx = matrix.e;
142
+ const ty = matrix.f;
143
+ const realPoint = {
144
+ x: (x - tx) / sx,
145
+ y: (y - ty) / sy // Flip y back since we used negative scale
146
+ }
147
+
148
+ coords.textContent = `(${realPoint.x.toFixed(2)}, ${realPoint.y.toFixed(2)})`;
149
+ coords.setAttribute('x', (x + 5).toString());
150
+ coords.setAttribute('y', (y - 5).toString());
151
+ });
152
+ document.currentScript.parentElement.addEventListener('mouseleave', () => {
153
+ document.currentScript.parentElement.getElementById('crosshair').style.display = 'none';
154
+ });
155
+ ]]>
156
+ </script>
157
+ </svg>