diff --git a/lib/sch/convert-circuit-json-to-schematic-svg.ts b/lib/sch/convert-circuit-json-to-schematic-svg.ts index 1535cb6..5ba69ae 100644 --- a/lib/sch/convert-circuit-json-to-schematic-svg.ts +++ b/lib/sch/convert-circuit-json-to-schematic-svg.ts @@ -168,7 +168,9 @@ export function convertCircuitJsonToSchematicSvg( .component { fill: none; stroke: ${colorMap.schematic.component_outline}; } .chip { fill: ${colorMap.schematic.component_body}; stroke: ${colorMap.schematic.component_outline}; } .component-pin { fill: none; stroke: ${colorMap.schematic.component_outline}; } - .trace { stroke: ${colorMap.schematic.wire}; } + .trace:hover { + filter: invert(1); + } .text { font-family: sans-serif; fill: ${colorMap.schematic.wire}; } .pin-number { fill: ${colorMap.schematic.pin_number}; } .port-label { fill: ${colorMap.schematic.reference}; } diff --git a/lib/sch/svg-object-fns/create-svg-objects-from-sch-trace.ts b/lib/sch/svg-object-fns/create-svg-objects-from-sch-trace.ts index c897350..2c0f86b 100644 --- a/lib/sch/svg-object-fns/create-svg-objects-from-sch-trace.ts +++ b/lib/sch/svg-object-fns/create-svg-objects-from-sch-trace.ts @@ -103,7 +103,6 @@ export function createSchematicTrace( name: "path", type: "element", attributes: { - class: "trace", d: path, stroke: colorMap.schematic.wire, fill: "none", @@ -137,5 +136,15 @@ export function createSchematicTrace( } } - return svgObjects + return [ + { + name: "g", + type: "element", + value: "", + attributes: { + class: "trace", + }, + children: svgObjects, + }, + ] } diff --git a/tests/sch/__snapshots__/debug-object.snap.svg b/tests/sch/__snapshots__/debug-object.snap.svg index 315906e..fcaa718 100644 --- a/tests/sch/__snapshots__/debug-object.snap.svg +++ b/tests/sch/__snapshots__/debug-object.snap.svg @@ -4,7 +4,9 @@ .component { fill: none; stroke: rgb(132, 0, 0); } .chip { fill: rgb(255, 255, 194); stroke: rgb(132, 0, 0); } .component-pin { fill: none; stroke: rgb(132, 0, 0); } - .trace { stroke: rgb(0, 150, 0); } + .trace:hover { + filter: invert(1); + } .text { font-family: sans-serif; fill: rgb(0, 150, 0); } .pin-number { fill: rgb(169, 0, 0); } .port-label { fill: rgb(0, 100, 100); } diff --git a/tests/sch/__snapshots__/grid-and-points.snap.svg b/tests/sch/__snapshots__/grid-and-points.snap.svg index 7ba6471..8456184 100644 --- a/tests/sch/__snapshots__/grid-and-points.snap.svg +++ b/tests/sch/__snapshots__/grid-and-points.snap.svg @@ -4,7 +4,9 @@ .component { fill: none; stroke: rgb(132, 0, 0); } .chip { fill: rgb(255, 255, 194); stroke: rgb(132, 0, 0); } .component-pin { fill: none; stroke: rgb(132, 0, 0); } - .trace { stroke: rgb(0, 150, 0); } + .trace:hover { + filter: invert(1); + } .text { font-family: sans-serif; fill: rgb(0, 150, 0); } .pin-number { fill: rgb(169, 0, 0); } .port-label { fill: rgb(0, 100, 100); } diff --git a/tests/sch/__snapshots__/kicad-theme-demo.snap.svg b/tests/sch/__snapshots__/kicad-theme-demo.snap.svg index 994910b..f69f9da 100644 --- a/tests/sch/__snapshots__/kicad-theme-demo.snap.svg +++ b/tests/sch/__snapshots__/kicad-theme-demo.snap.svg @@ -4,9 +4,11 @@ .component { fill: none; stroke: rgb(132, 0, 0); } .chip { fill: rgb(255, 255, 194); stroke: rgb(132, 0, 0); } .component-pin { fill: none; stroke: rgb(132, 0, 0); } - .trace { stroke: rgb(0, 150, 0); } + .trace:hover { + filter: invert(1); + } .text { font-family: sans-serif; fill: rgb(0, 150, 0); } .pin-number { fill: rgb(169, 0, 0); } .port-label { fill: rgb(0, 100, 100); } .component-name { fill: rgb(0, 100, 100); } - -2,-4-2,-3-2,-2-2,-1-2,0-2,1-2,2-2,3-2,4-1,-4-1,-3-1,-2-1,-1-1,0-1,1-1,2-1,3-1,40,-40,-30,-20,-10,00,10,20,30,41,-41,-31,-21,-11,01,11,21,31,42,-42,-32,-22,-12,02,12,22,32,43,-43,-33,-23,-13,03,13,23,33,44,-44,-34,-24,-14,04,14,24,34,45,-45,-35,-25,-15,05,15,25,35,46,-46,-36,-26,-16,06,16,26,36,47,-47,-37,-27,-17,07,17,27,37,4R110ΩC11mFATmega8-16AU229RESET782019221213GND1415161723418OSC112VCC \ No newline at end of file + -2,-4-2,-3-2,-2-2,-1-2,0-2,1-2,2-2,3-2,4-1,-4-1,-3-1,-2-1,-1-1,0-1,1-1,2-1,3-1,40,-40,-30,-20,-10,00,10,20,30,41,-41,-31,-21,-11,01,11,21,31,42,-42,-32,-22,-12,02,12,22,32,43,-43,-33,-23,-13,03,13,23,33,44,-44,-34,-24,-14,04,14,24,34,45,-45,-35,-25,-15,05,15,25,35,46,-46,-36,-26,-16,06,16,26,36,47,-47,-37,-27,-17,07,17,27,37,4R110ΩC11mFATmega8-16AU229RESET782019221213GND1415161723418OSC112VCC \ No newline at end of file diff --git a/tests/sch/__snapshots__/net-label.snap.svg b/tests/sch/__snapshots__/net-label.snap.svg index 0f8d51f..c33bbd6 100644 --- a/tests/sch/__snapshots__/net-label.snap.svg +++ b/tests/sch/__snapshots__/net-label.snap.svg @@ -4,7 +4,9 @@ .component { fill: none; stroke: rgb(132, 0, 0); } .chip { fill: rgb(255, 255, 194); stroke: rgb(132, 0, 0); } .component-pin { fill: none; stroke: rgb(132, 0, 0); } - .trace { stroke: rgb(0, 150, 0); } + .trace:hover { + filter: invert(1); + } .text { font-family: sans-serif; fill: rgb(0, 150, 0); } .pin-number { fill: rgb(169, 0, 0); } .port-label { fill: rgb(0, 100, 100); } diff --git a/tests/sch/__snapshots__/resistor.snap.svg b/tests/sch/__snapshots__/resistor.snap.svg index ee534ff..663b9d8 100644 --- a/tests/sch/__snapshots__/resistor.snap.svg +++ b/tests/sch/__snapshots__/resistor.snap.svg @@ -4,7 +4,9 @@ .component { fill: none; stroke: rgb(132, 0, 0); } .chip { fill: rgb(255, 255, 194); stroke: rgb(132, 0, 0); } .component-pin { fill: none; stroke: rgb(132, 0, 0); } - .trace { stroke: rgb(0, 150, 0); } + .trace:hover { + filter: invert(1); + } .text { font-family: sans-serif; fill: rgb(0, 150, 0); } .pin-number { fill: rgb(169, 0, 0); } .port-label { fill: rgb(0, 100, 100); } diff --git a/tests/sch/__snapshots__/rotated-resistor.snap.svg b/tests/sch/__snapshots__/rotated-resistor.snap.svg index 7c75dd4..823e357 100644 --- a/tests/sch/__snapshots__/rotated-resistor.snap.svg +++ b/tests/sch/__snapshots__/rotated-resistor.snap.svg @@ -4,7 +4,9 @@ .component { fill: none; stroke: rgb(132, 0, 0); } .chip { fill: rgb(255, 255, 194); stroke: rgb(132, 0, 0); } .component-pin { fill: none; stroke: rgb(132, 0, 0); } - .trace { stroke: rgb(0, 150, 0); } + .trace:hover { + filter: invert(1); + } .text { font-family: sans-serif; fill: rgb(0, 150, 0); } .pin-number { fill: rgb(169, 0, 0); } .port-label { fill: rgb(0, 100, 100); } diff --git a/tests/sch/__snapshots__/trace-overlap.snap.svg b/tests/sch/__snapshots__/trace-overlap.snap.svg index e96c900..4876e0c 100644 --- a/tests/sch/__snapshots__/trace-overlap.snap.svg +++ b/tests/sch/__snapshots__/trace-overlap.snap.svg @@ -4,9 +4,11 @@ .component { fill: none; stroke: rgb(132, 0, 0); } .chip { fill: rgb(255, 255, 194); stroke: rgb(132, 0, 0); } .component-pin { fill: none; stroke: rgb(132, 0, 0); } - .trace { stroke: rgb(0, 150, 0); } + .trace:hover { + filter: invert(1); + } .text { font-family: sans-serif; fill: rgb(0, 150, 0); } .pin-number { fill: rgb(169, 0, 0); } .port-label { fill: rgb(0, 100, 100); } .component-name { fill: rgb(0, 100, 100); } - R110kΩR210kΩR310kΩ \ No newline at end of file + R110kΩR210kΩR310kΩ \ No newline at end of file diff --git a/tests/sch/__snapshots__/unknown-symbol.snap.svg b/tests/sch/__snapshots__/unknown-symbol.snap.svg index 7a153ee..b3e755e 100644 --- a/tests/sch/__snapshots__/unknown-symbol.snap.svg +++ b/tests/sch/__snapshots__/unknown-symbol.snap.svg @@ -4,7 +4,9 @@ .component { fill: none; stroke: rgb(132, 0, 0); } .chip { fill: rgb(255, 255, 194); stroke: rgb(132, 0, 0); } .component-pin { fill: none; stroke: rgb(132, 0, 0); } - .trace { stroke: rgb(0, 150, 0); } + .trace:hover { + filter: invert(1); + } .text { font-family: sans-serif; fill: rgb(0, 150, 0); } .pin-number { fill: rgb(169, 0, 0); } .port-label { fill: rgb(0, 100, 100); }