@tscircuit/footprinter 0.0.206 → 0.0.207
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 +36 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -7063,6 +7063,42 @@ var m2host = (raw_params) => {
|
|
|
7063
7063
|
stroke_width: 0.05,
|
|
7064
7064
|
pcb_silkscreen_path_id: "pin_marker_1"
|
|
7065
7065
|
};
|
|
7066
|
+
let minX = Infinity;
|
|
7067
|
+
let maxX = -Infinity;
|
|
7068
|
+
let minY = Infinity;
|
|
7069
|
+
let maxY = -Infinity;
|
|
7070
|
+
const updateBounds = (x, y, w = 0, h = 0) => {
|
|
7071
|
+
minX = Math.min(minX, x - w / 2);
|
|
7072
|
+
maxX = Math.max(maxX, x + w / 2);
|
|
7073
|
+
minY = Math.min(minY, y - h / 2);
|
|
7074
|
+
maxY = Math.max(maxY, y + h / 2);
|
|
7075
|
+
};
|
|
7076
|
+
for (const pad2 of pads) {
|
|
7077
|
+
updateBounds(pad2.x, pad2.y, pad2.width, pad2.height);
|
|
7078
|
+
}
|
|
7079
|
+
updateBounds(cutout.center.x, cutout.center.y, cutout.width, cutout.height);
|
|
7080
|
+
for (const point of pin1Marker.route) {
|
|
7081
|
+
updateBounds(point.x, point.y);
|
|
7082
|
+
}
|
|
7083
|
+
const centerX = (minX + maxX) / 2;
|
|
7084
|
+
const centerY = (minY + maxY) / 2;
|
|
7085
|
+
const translate = (el) => {
|
|
7086
|
+
if (typeof el.x === "number") el.x -= centerX;
|
|
7087
|
+
if (typeof el.y === "number") el.y -= centerY;
|
|
7088
|
+
if (el.center) {
|
|
7089
|
+
el.center.x -= centerX;
|
|
7090
|
+
el.center.y -= centerY;
|
|
7091
|
+
}
|
|
7092
|
+
if (Array.isArray(el.route)) {
|
|
7093
|
+
el.route = el.route.map((p) => ({
|
|
7094
|
+
x: p.x - centerX,
|
|
7095
|
+
y: p.y - centerY
|
|
7096
|
+
}));
|
|
7097
|
+
}
|
|
7098
|
+
};
|
|
7099
|
+
for (const pad2 of pads) translate(pad2);
|
|
7100
|
+
translate(cutout);
|
|
7101
|
+
translate(pin1Marker);
|
|
7066
7102
|
return {
|
|
7067
7103
|
circuitJson: [
|
|
7068
7104
|
...pads,
|