@tscircuit/circuit-json-util 0.0.125 → 0.0.126

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
@@ -1081,19 +1081,26 @@ var transformPCBElement = (elm, matrix) => {
1081
1081
  });
1082
1082
  elm.x = x;
1083
1083
  elm.y = y;
1084
+ if (elm.type === "pcb_smtpad" && (elm.shape === "rotated_rect" || elm.shape === "rotated_pill")) {
1085
+ elm.ccw_rotation = getTransformedRectRotation(elm.ccw_rotation, matrix);
1086
+ }
1084
1087
  } else if (elm.type === "pcb_keepout" && elm.shape === "outline") {
1085
1088
  elm.outline = elm.outline.map((point) => applyToPoint(matrix, point));
1086
1089
  } else if (elm.type === "pcb_keepout" || elm.type === "pcb_board") {
1087
1090
  elm.center = applyToPoint(matrix, elm.center);
1088
1091
  } else if (elm.type === "pcb_silkscreen_text" || elm.type === "pcb_fabrication_note_text" || elm.type === "pcb_note_text") {
1089
1092
  elm.anchor_position = applyToPoint(matrix, elm.anchor_position);
1093
+ if (elm.type === "pcb_silkscreen_text") {
1094
+ const textTransform = compose(matrix, rotateDEG(elm.ccw_rotation ?? 0));
1095
+ elm.ccw_rotation = Math.atan2(textTransform.b, textTransform.a) * 180 / Math.PI;
1096
+ }
1090
1097
  } else if (elm.type === "pcb_copper_text") {
1091
1098
  if (elm.anchor_position) {
1092
1099
  elm.anchor_position = applyToPoint(matrix, elm.anchor_position);
1093
1100
  }
1094
1101
  } else if (elm.type === "pcb_courtyard_rect") {
1095
1102
  elm.center = applyToPoint(matrix, elm.center);
1096
- elm.ccw_rotation = ((elm.ccw_rotation ?? 0) + rotationDegrees) % 360;
1103
+ elm.ccw_rotation = getTransformedRectRotation(elm.ccw_rotation ?? 0, matrix);
1097
1104
  } else if (elm.type === "pcb_silkscreen_circle" || elm.type === "pcb_silkscreen_rect" || elm.type === "pcb_silkscreen_pill" || elm.type === "pcb_silkscreen_oval" || elm.type === "pcb_note_rect" || elm.type === "pcb_courtyard_circle") {
1098
1105
  elm.center = applyToPoint(matrix, elm.center);
1099
1106
  } else if (elm.type === "pcb_component") {