@tscircuit/core 0.0.287 → 0.0.288
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 +15 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4029,9 +4029,21 @@ var Board = class extends Group {
|
|
|
4029
4029
|
if (this.root?.pcbDisabled) return;
|
|
4030
4030
|
const { db } = this.root;
|
|
4031
4031
|
const { _parsedProps: props } = this;
|
|
4032
|
-
if (!props.width || !props.height) {
|
|
4032
|
+
if (!props.outline && (!props.width || !props.height)) {
|
|
4033
4033
|
throw new Error("Board width and height or an outline are required");
|
|
4034
4034
|
}
|
|
4035
|
+
let computedWidth = props.width;
|
|
4036
|
+
let computedHeight = props.height;
|
|
4037
|
+
if (props.outline) {
|
|
4038
|
+
const xValues = props.outline.map((point) => point.x);
|
|
4039
|
+
const yValues = props.outline.map((point) => point.y);
|
|
4040
|
+
const minX = Math.min(...xValues);
|
|
4041
|
+
const maxX = Math.max(...xValues);
|
|
4042
|
+
const minY = Math.min(...yValues);
|
|
4043
|
+
const maxY = Math.max(...yValues);
|
|
4044
|
+
computedWidth = maxX - minX;
|
|
4045
|
+
computedHeight = maxY - minY;
|
|
4046
|
+
}
|
|
4035
4047
|
const pcb_board = db.pcb_board.insert({
|
|
4036
4048
|
center: {
|
|
4037
4049
|
x: (props.pcbX ?? 0) + (props.outlineOffsetX ?? 0),
|
|
@@ -4039,8 +4051,8 @@ var Board = class extends Group {
|
|
|
4039
4051
|
},
|
|
4040
4052
|
thickness: this.boardThickness,
|
|
4041
4053
|
num_layers: this.allLayers.length,
|
|
4042
|
-
width:
|
|
4043
|
-
height:
|
|
4054
|
+
width: computedWidth,
|
|
4055
|
+
height: computedHeight,
|
|
4044
4056
|
outline: props.outline?.map((point) => ({
|
|
4045
4057
|
x: point.x + (props.outlineOffsetX ?? 0),
|
|
4046
4058
|
y: point.y + (props.outlineOffsetY ?? 0)
|