diff --git a/examples/stampboard.example.tsx b/examples/stampboard.example.tsx index d4293ca..326787e 100644 --- a/examples/stampboard.example.tsx +++ b/examples/stampboard.example.tsx @@ -8,13 +8,13 @@ export default () => { ) diff --git a/lib/stampboard.tsx b/lib/stampboard.tsx index efd4b0c..5b33453 100644 --- a/lib/stampboard.tsx +++ b/lib/stampboard.tsx @@ -43,15 +43,15 @@ export const StampBoard = ({ for (let i = 0; i < leadsRight; i++) { const y = yOffset + i * leadsPitch pads.push({ - x: -halfBoardWidth + leadLength / 2, + x: halfBoardWidth - leadLength / 2, y: -y, // Flip y pl: leadLength, pw: leadWidth, }) if (innerHoles) { holes.push( - { x: -halfBoardWidth, y: -y }, - { x: -halfBoardWidth + innerHoleEdgeDistance, y: -y }, + { x: halfBoardWidth, y: -y }, + { x: halfBoardWidth - innerHoleEdgeDistance, y: -y }, ) } } @@ -62,15 +62,15 @@ export const StampBoard = ({ for (let i = 0; i < leadsLeft; i++) { const y = yOffset + i * leadsPitch pads.push({ - x: halfBoardWidth - leadLength / 2, + x: -halfBoardWidth + leadLength / 2, y: -y, // Flip y pl: leadLength, pw: leadWidth, }) if (innerHoles) { holes.push( - { x: halfBoardWidth, y: -y }, - { x: halfBoardWidth - innerHoleEdgeDistance, y: -y }, + { x: -halfBoardWidth, y: -y }, + { x: -halfBoardWidth + innerHoleEdgeDistance, y: -y }, ) } } @@ -82,14 +82,14 @@ export const StampBoard = ({ const x = xOffset + i * leadsPitch pads.push({ x: -x, // Flip x - y: -bodyLength / 2 + leadLength / 2, + y: bodyLength / 2 - leadLength / 2, pl: leadWidth, pw: leadLength, }) if (innerHoles) { holes.push( - { x: -x, y: -bodyLength / 2 }, - { x: -x, y: -bodyLength / 2 + innerHoleEdgeDistance }, + { x: -x, y: bodyLength / 2 }, + { x: -x, y: bodyLength / 2 - innerHoleEdgeDistance }, ) } } @@ -101,14 +101,14 @@ export const StampBoard = ({ const x = xOffset + i * leadsPitch pads.push({ x: -x, // Flip x - y: bodyLength / 2 - leadLength / 2, + y: -bodyLength / 2 + leadLength / 2, pl: leadWidth, pw: leadLength, }) if (innerHoles) { holes.push( - { x: -x, y: bodyLength / 2 }, - { x: -x, y: bodyLength / 2 - innerHoleEdgeDistance }, + { x: -x, y: -bodyLength / 2 }, + { x: -x, y: -bodyLength / 2 + innerHoleEdgeDistance }, ) } } diff --git a/tests/snapshots/__snapshots__/stampboard.snap.png b/tests/snapshots/__snapshots__/stampboard.snap.png index f28be67..9cd5398 100644 Binary files a/tests/snapshots/__snapshots__/stampboard.snap.png and b/tests/snapshots/__snapshots__/stampboard.snap.png differ diff --git a/tests/snapshots/__snapshots__/stampboard2.snap.png b/tests/snapshots/__snapshots__/stampboard2.snap.png new file mode 100644 index 0000000..fc8531f Binary files /dev/null and b/tests/snapshots/__snapshots__/stampboard2.snap.png differ diff --git a/tests/snapshots/stampboard2.test.ts b/tests/snapshots/stampboard2.test.ts new file mode 100644 index 0000000..ad0e27f --- /dev/null +++ b/tests/snapshots/stampboard2.test.ts @@ -0,0 +1,10 @@ +import { test, expect } from "bun:test" +import "../fixtures/png-matcher" +import { renderFootprint } from "../helpers/render-footprint" + +test("stampboard receiver with inner holes", async () => { + const pngBuffer = await renderFootprint( + "stampreceiver_left10_right20_bottom6_top3_w21mm_innerhole", + ) + await expect(pngBuffer).toMatchPngSnapshot(import.meta.path) +}, 10000)