circuit-to-svg 0.0.158 → 0.0.159
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 +28 -9
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4079,6 +4079,33 @@ var createSvgSchText = ({
|
|
|
4079
4079
|
top_right: "hanging",
|
|
4080
4080
|
center_left: "middle"
|
|
4081
4081
|
};
|
|
4082
|
+
const lines = elm.text.split("\n");
|
|
4083
|
+
const children = lines.length === 1 ? [
|
|
4084
|
+
{
|
|
4085
|
+
type: "text",
|
|
4086
|
+
value: elm.text,
|
|
4087
|
+
name: elm.schematic_text_id,
|
|
4088
|
+
attributes: {},
|
|
4089
|
+
children: []
|
|
4090
|
+
}
|
|
4091
|
+
] : lines.map((line, idx) => ({
|
|
4092
|
+
type: "element",
|
|
4093
|
+
name: "tspan",
|
|
4094
|
+
value: "",
|
|
4095
|
+
attributes: {
|
|
4096
|
+
x: center.x.toString(),
|
|
4097
|
+
...idx > 0 ? { dy: "1em" } : {}
|
|
4098
|
+
},
|
|
4099
|
+
children: [
|
|
4100
|
+
{
|
|
4101
|
+
type: "text",
|
|
4102
|
+
value: line,
|
|
4103
|
+
name: idx === 0 ? elm.schematic_text_id : "",
|
|
4104
|
+
attributes: {},
|
|
4105
|
+
children: []
|
|
4106
|
+
}
|
|
4107
|
+
]
|
|
4108
|
+
}));
|
|
4082
4109
|
return {
|
|
4083
4110
|
type: "element",
|
|
4084
4111
|
name: "text",
|
|
@@ -4093,15 +4120,7 @@ var createSvgSchText = ({
|
|
|
4093
4120
|
"font-size": `${getSchScreenFontSize(transform, "reference_designator", elm.font_size)}px`,
|
|
4094
4121
|
transform: `rotate(${elm.rotation}, ${center.x}, ${center.y})`
|
|
4095
4122
|
},
|
|
4096
|
-
children
|
|
4097
|
-
{
|
|
4098
|
-
type: "text",
|
|
4099
|
-
value: elm.text,
|
|
4100
|
-
name: elm.schematic_text_id,
|
|
4101
|
-
attributes: {},
|
|
4102
|
-
children: []
|
|
4103
|
-
}
|
|
4104
|
-
]
|
|
4123
|
+
children
|
|
4105
4124
|
};
|
|
4106
4125
|
};
|
|
4107
4126
|
|