jscad-electronics 0.0.148 → 0.0.149

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/vanilla.js CHANGED
@@ -43,16 +43,23 @@ var jsx = (type, props, _key) => h(type, props);
43
43
  var jsxs = (type, props, _key) => h(type, props);
44
44
 
45
45
  // lib/FootprintPad.tsx
46
+ var PAD_THICKNESS = 0.01;
46
47
  var FootprintPad = ({
47
48
  pad,
48
49
  isPin1
49
50
  }) => {
51
+ const color = isPin1 ? [0, 255, 0] : [255, 0, 0];
50
52
  if (pad.shape === "rect") {
51
- const color = isPin1 ? [0, 255, 0] : [255, 0, 0];
52
- return /* @__PURE__ */ jsx(Colorize, { color, children: /* @__PURE__ */ jsx(Translate, { offset: [pad.x, pad.y, -5e-3], children: /* @__PURE__ */ jsx(Cuboid, { size: [pad.width, pad.height, 0.01] }) }) });
53
- } else {
54
- throw new Error("Shape not supported: " + pad.shape);
53
+ return /* @__PURE__ */ jsx(Colorize, { color, children: /* @__PURE__ */ jsx(Translate, { offset: [pad.x, pad.y, -5e-3], children: /* @__PURE__ */ jsx(Cuboid, { size: [pad.width, pad.height, PAD_THICKNESS] }) }) });
54
+ }
55
+ if (pad.shape === "polygon") {
56
+ const points = (pad.points ?? []).map(
57
+ ({ x, y }) => [x, y]
58
+ );
59
+ if (points.length < 3) return null;
60
+ return /* @__PURE__ */ jsx(Colorize, { color, children: /* @__PURE__ */ jsx(Translate, { offset: [0, 0, -5e-3], children: /* @__PURE__ */ jsx(ExtrudeLinear, { height: PAD_THICKNESS, children: /* @__PURE__ */ jsx(Polygon, { points }) }) }) });
55
61
  }
62
+ throw new Error("Shape not supported: " + pad.shape);
56
63
  };
57
64
 
58
65
  // lib/FootprintPlatedHole.tsx