circuit-to-svg 0.0.304 → 0.0.305

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
@@ -2646,7 +2646,8 @@ function createSvgObjectsFromPcbSilkscreenRect(pcbSilkscreenRect, ctx) {
2646
2646
  is_filled,
2647
2647
  has_stroke,
2648
2648
  is_stroke_dashed,
2649
- corner_radius
2649
+ corner_radius,
2650
+ ccw_rotation = 0
2650
2651
  } = pcbSilkscreenRect;
2651
2652
  if (layerFilter && layer !== layerFilter) return [];
2652
2653
  if (!center || typeof center.x !== "number" || typeof center.y !== "number" || typeof width !== "number" || typeof height !== "number") {
@@ -2665,8 +2666,8 @@ function createSvgObjectsFromPcbSilkscreenRect(pcbSilkscreenRect, ctx) {
2665
2666
  const transformedStrokeWidth = stroke_width * Math.abs(transform.a);
2666
2667
  const color = layer === "bottom" ? colorMap2.silkscreen.bottom : colorMap2.silkscreen.top;
2667
2668
  const attributes = {
2668
- x: (transformedX - transformedWidth / 2).toString(),
2669
- y: (transformedY - transformedHeight / 2).toString(),
2669
+ x: (-transformedWidth / 2).toString(),
2670
+ y: (-transformedHeight / 2).toString(),
2670
2671
  width: transformedWidth.toString(),
2671
2672
  height: transformedHeight.toString(),
2672
2673
  class: `pcb-silkscreen-rect pcb-silkscreen-${layer}`,
@@ -2674,6 +2675,12 @@ function createSvgObjectsFromPcbSilkscreenRect(pcbSilkscreenRect, ctx) {
2674
2675
  "data-type": "pcb_silkscreen_rect",
2675
2676
  "data-pcb-layer": layer
2676
2677
  };
2678
+ if (typeof ccw_rotation === "number" && ccw_rotation !== 0) {
2679
+ attributes.transform = `translate(${transformedX} ${transformedY}) rotate(${-ccw_rotation})`;
2680
+ } else {
2681
+ attributes.x = (transformedX - transformedWidth / 2).toString();
2682
+ attributes.y = (transformedY - transformedHeight / 2).toString();
2683
+ }
2677
2684
  if (transformedCornerRadiusX > 0) {
2678
2685
  attributes.rx = transformedCornerRadiusX.toString();
2679
2686
  }
@@ -5877,7 +5884,7 @@ function getSoftwareUsedString(circuitJson) {
5877
5884
  var package_default = {
5878
5885
  name: "circuit-to-svg",
5879
5886
  type: "module",
5880
- version: "0.0.303",
5887
+ version: "0.0.304",
5881
5888
  description: "Convert Circuit JSON to SVG",
5882
5889
  main: "dist/index.js",
5883
5890
  files: [