circuit-to-svg 0.0.292 → 0.0.294

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
@@ -5562,7 +5562,7 @@ function getSoftwareUsedString(circuitJson) {
5562
5562
  var package_default = {
5563
5563
  name: "circuit-to-svg",
5564
5564
  type: "module",
5565
- version: "0.0.291",
5565
+ version: "0.0.293",
5566
5566
  description: "Convert Circuit JSON to SVG",
5567
5567
  main: "dist/index.js",
5568
5568
  files: [
@@ -9564,6 +9564,30 @@ function getSchematicBoundsFromCircuitJson(soup, padding = 0.5) {
9564
9564
  updateBounds(item.position, { width, height }, item.rotation ?? 0);
9565
9565
  } else if (item.type === "schematic_voltage_probe") {
9566
9566
  updateBounds(item.position, { width: 0.2, height: 0.4 }, 0);
9567
+ if (item.name) {
9568
+ const fontSize = getSchMmFontSize("net_label");
9569
+ const textWidth = estimateTextWidth(item.name) * fontSize;
9570
+ const textHeight = fontSize;
9571
+ const labelOffset = 0.3;
9572
+ const alignment = item.label_alignment ?? "top_right";
9573
+ let labelCenterX = item.position.x;
9574
+ let labelCenterY = item.position.y;
9575
+ if (alignment.includes("top")) {
9576
+ labelCenterY += labelOffset + textHeight / 2;
9577
+ } else if (alignment.includes("bottom")) {
9578
+ labelCenterY -= labelOffset + textHeight / 2;
9579
+ }
9580
+ if (alignment.includes("right")) {
9581
+ labelCenterX += labelOffset + textWidth / 2;
9582
+ } else if (alignment.includes("left")) {
9583
+ labelCenterX -= labelOffset + textWidth / 2;
9584
+ }
9585
+ updateBounds(
9586
+ { x: labelCenterX, y: labelCenterY },
9587
+ { width: textWidth, height: textHeight },
9588
+ 0
9589
+ );
9590
+ }
9567
9591
  } else if (item.type === "schematic_box") {
9568
9592
  updateBounds(
9569
9593
  {