Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions examples/stampboard.example.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ export default () => {
<StampBoard
bodyWidth={21}
leadsTop={3}
leadsBottom={3}
leadsLeft={20}
leadsBottom={6}
leadsLeft={10}
leadsRight={20}
innerHoles={true}
/>
<ExtrudedPads
footprint={"stampreceiver_left20_right20_bottom3_top3_w21mm_innerhole"}
footprint={"stampreceiver_left10_right20_bottom6_top3_w21mm_innerhole"}
/>
</JsCadView>
)
Expand Down
24 changes: 12 additions & 12 deletions lib/stampboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
)
}
}
Expand All @@ -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 },
)
}
}
Expand All @@ -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 },
)
}
}
Expand All @@ -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 },
)
}
}
Expand Down
Binary file modified tests/snapshots/__snapshots__/stampboard.snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions tests/snapshots/stampboard2.test.ts
Original file line number Diff line number Diff line change
@@ -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)