circuit-to-svg 0.0.142 → 0.0.143

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
@@ -913,11 +913,11 @@ function createSvgObjectsFromPcbTrace(trace, ctx) {
913
913
  import { applyToPoint as applyToPoint11 } from "transformation-matrix";
914
914
  function createSvgObjectsFromSmtPad(pad, ctx) {
915
915
  const { transform, layer: layerFilter, colorMap: colorMap2 } = ctx;
916
- const [x, y] = applyToPoint11(transform, [pad.x, pad.y]);
917
916
  if (layerFilter && pad.layer !== layerFilter) return [];
918
917
  if (pad.shape === "rect" || pad.shape === "rotated_rect") {
919
918
  const width = pad.width * Math.abs(transform.a);
920
919
  const height = pad.height * Math.abs(transform.d);
920
+ const [x, y] = applyToPoint11(transform, [pad.x, pad.y]);
921
921
  if (pad.shape === "rotated_rect" && pad.ccw_rotation) {
922
922
  return [
923
923
  {
@@ -954,6 +954,7 @@ function createSvgObjectsFromSmtPad(pad, ctx) {
954
954
  const width = pad.width * Math.abs(transform.a);
955
955
  const height = pad.height * Math.abs(transform.d);
956
956
  const radius = pad.radius * Math.abs(transform.a);
957
+ const [x, y] = applyToPoint11(transform, [pad.x, pad.y]);
957
958
  return [
958
959
  {
959
960
  name: "rect",
@@ -971,6 +972,22 @@ function createSvgObjectsFromSmtPad(pad, ctx) {
971
972
  }
972
973
  ];
973
974
  }
975
+ if (pad.shape === "polygon") {
976
+ const points = (pad.points ?? []).map(
977
+ (point) => applyToPoint11(transform, [point.x, point.y])
978
+ );
979
+ return [
980
+ {
981
+ name: "polygon",
982
+ type: "element",
983
+ attributes: {
984
+ class: "pcb-pad",
985
+ fill: layerNameToColor(pad.layer),
986
+ points
987
+ }
988
+ }
989
+ ];
990
+ }
974
991
  return [];
975
992
  }
976
993