circuit-to-svg 0.0.161 → 0.0.162

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.
package/dist/index.js CHANGED
@@ -637,6 +637,33 @@ function createSvgObjectsFromPcbSilkscreenText(pcbSilkscreenText, ctx) {
637
637
  ...layer === "bottom" ? [scale(-1, 1)] : []
638
638
  );
639
639
  const color = layer === "bottom" ? colorMap2.silkscreen.bottom : colorMap2.silkscreen.top;
640
+ const lines = text.split("\n");
641
+ const children = lines.length === 1 ? [
642
+ {
643
+ type: "text",
644
+ value: text,
645
+ name: "",
646
+ attributes: {},
647
+ children: []
648
+ }
649
+ ] : lines.map((line, idx) => ({
650
+ type: "element",
651
+ name: "tspan",
652
+ value: "",
653
+ attributes: {
654
+ x: "0",
655
+ ...idx > 0 ? { dy: transformedFontSize.toString() } : {}
656
+ },
657
+ children: [
658
+ {
659
+ type: "text",
660
+ value: line,
661
+ name: "",
662
+ attributes: {},
663
+ children: []
664
+ }
665
+ ]
666
+ }));
640
667
  const svgObject = {
641
668
  name: "text",
642
669
  type: "element",
@@ -655,15 +682,7 @@ function createSvgObjectsFromPcbSilkscreenText(pcbSilkscreenText, ctx) {
655
682
  "data-pcb-silkscreen-text-id": pcbSilkscreenText.pcb_component_id,
656
683
  stroke: "none"
657
684
  },
658
- children: [
659
- {
660
- type: "text",
661
- value: text,
662
- name: "",
663
- attributes: {},
664
- children: []
665
- }
666
- ],
685
+ children,
667
686
  value: ""
668
687
  };
669
688
  return [svgObject];