circuit-to-svg 0.0.170 → 0.0.172

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
@@ -1031,7 +1031,7 @@ function createSvgObjectsFromSmtPad(pad, ctx) {
1031
1031
  attributes: {
1032
1032
  class: "pcb-pad",
1033
1033
  fill: layerNameToColor(pad.layer),
1034
- points,
1034
+ points: points.map((p) => p.join(",")).join(" "),
1035
1035
  "data-layer": pad.layer
1036
1036
  }
1037
1037
  }
@@ -1446,7 +1446,7 @@ function getSoftwareUsedString(circuitJson) {
1446
1446
  var package_default = {
1447
1447
  name: "circuit-to-svg",
1448
1448
  type: "module",
1449
- version: "0.0.169",
1449
+ version: "0.0.171",
1450
1450
  description: "Convert Circuit JSON to SVG",
1451
1451
  main: "dist/index.js",
1452
1452
  files: [
@@ -1575,6 +1575,15 @@ function convertCircuitJsonToPcbSvg(circuitJson, options) {
1575
1575
  }
1576
1576
  } else if ("x" in circuitJsonElm && "y" in circuitJsonElm) {
1577
1577
  updateBounds({ x: circuitJsonElm.x, y: circuitJsonElm.y }, 0, 0);
1578
+ } else if (circuitJsonElm.type === "pcb_smtpad") {
1579
+ const pad = circuitJsonElm;
1580
+ if (pad.shape === "rect" || pad.shape === "rotated_rect" || pad.shape === "pill") {
1581
+ updateBounds({ x: pad.x, y: pad.y }, pad.width, pad.height);
1582
+ } else if (pad.shape === "circle") {
1583
+ updateBounds({ x: pad.x, y: pad.y }, pad.radius * 2, pad.radius * 2);
1584
+ } else if (pad.shape === "polygon") {
1585
+ updateTraceBounds(pad.points);
1586
+ }
1578
1587
  } else if ("route" in circuitJsonElm) {
1579
1588
  updateTraceBounds(circuitJsonElm.route);
1580
1589
  } else if (circuitJsonElm.type === "pcb_silkscreen_text" || circuitJsonElm.type === "pcb_silkscreen_rect" || circuitJsonElm.type === "pcb_silkscreen_circle" || circuitJsonElm.type === "pcb_silkscreen_line") {
@@ -5590,19 +5599,21 @@ var createSvgObjectsFromSchematicBox = ({
5590
5599
  const yBottom = Math.max(topLeft.y, bottomRight.y);
5591
5600
  const xLeft = Math.min(topLeft.x, bottomRight.x);
5592
5601
  const xRight = Math.max(topLeft.x, bottomRight.x);
5602
+ const strokeWidthPx = getSchStrokeSize(transform);
5593
5603
  const attributes = {
5594
5604
  class: "schematic-box",
5595
5605
  x: xLeft.toString(),
5596
5606
  y: yTop.toString(),
5597
5607
  width: (xRight - xLeft).toString(),
5598
5608
  height: (yBottom - yTop).toString(),
5599
- "stroke-width": `${getSchStrokeSize(transform)}px`,
5600
- "vector-effect": "non-scaling-stroke",
5609
+ "stroke-width": `${strokeWidthPx}px`,
5601
5610
  stroke: colorMap2.schematic.component_outline || "black",
5602
5611
  fill: "transparent"
5603
5612
  };
5604
5613
  if (schematicBox.is_dashed) {
5605
- attributes["stroke-dasharray"] = "20 8";
5614
+ const dashLength = 8 * strokeWidthPx;
5615
+ const gapLength = 4 * strokeWidthPx;
5616
+ attributes["stroke-dasharray"] = `${dashLength} ${gapLength}`;
5606
5617
  }
5607
5618
  return [
5608
5619
  {