@tscircuit/core 0.0.350 → 0.0.351
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 +10 -10
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6147,23 +6147,23 @@ var Board = class extends Group {
|
|
|
6147
6147
|
let minY = Infinity;
|
|
6148
6148
|
let maxX = -Infinity;
|
|
6149
6149
|
let maxY = -Infinity;
|
|
6150
|
-
|
|
6151
|
-
|
|
6152
|
-
|
|
6153
|
-
|
|
6154
|
-
const { width, height, center: center2 } = pcb_component;
|
|
6150
|
+
const allPcbComponents = db.pcb_component.list();
|
|
6151
|
+
let hasComponents = false;
|
|
6152
|
+
for (const pcbComponent of allPcbComponents) {
|
|
6153
|
+
const { width, height, center: center2 } = pcbComponent;
|
|
6155
6154
|
if (width === 0 || height === 0) continue;
|
|
6155
|
+
hasComponents = true;
|
|
6156
6156
|
minX = Math.min(minX, center2.x - width / 2);
|
|
6157
6157
|
minY = Math.min(minY, center2.y - height / 2);
|
|
6158
6158
|
maxX = Math.max(maxX, center2.x + width / 2);
|
|
6159
6159
|
maxY = Math.max(maxY, center2.y + height / 2);
|
|
6160
6160
|
}
|
|
6161
6161
|
const padding = 2;
|
|
6162
|
-
const computedWidth = maxX - minX + padding * 2;
|
|
6163
|
-
const computedHeight = maxY - minY + padding * 2;
|
|
6162
|
+
const computedWidth = hasComponents ? maxX - minX + padding * 2 : 0;
|
|
6163
|
+
const computedHeight = hasComponents ? maxY - minY + padding * 2 : 0;
|
|
6164
6164
|
const center = {
|
|
6165
|
-
x: (minX + maxX) / 2 + (props.outlineOffsetX ?? 0),
|
|
6166
|
-
y: (minY + maxY) / 2 + (props.outlineOffsetY ?? 0)
|
|
6165
|
+
x: hasComponents ? (minX + maxX) / 2 + (props.outlineOffsetX ?? 0) : props.outlineOffsetX ?? 0,
|
|
6166
|
+
y: hasComponents ? (minY + maxY) / 2 + (props.outlineOffsetY ?? 0) : props.outlineOffsetY ?? 0
|
|
6167
6167
|
};
|
|
6168
6168
|
db.pcb_board.update(this.pcb_board_id, {
|
|
6169
6169
|
width: computedWidth,
|
|
@@ -7305,7 +7305,7 @@ import { identity as identity4 } from "transformation-matrix";
|
|
|
7305
7305
|
var package_default = {
|
|
7306
7306
|
name: "@tscircuit/core",
|
|
7307
7307
|
type: "module",
|
|
7308
|
-
version: "0.0.
|
|
7308
|
+
version: "0.0.350",
|
|
7309
7309
|
types: "dist/index.d.ts",
|
|
7310
7310
|
main: "dist/index.js",
|
|
7311
7311
|
module: "dist/index.js",
|