@tscircuit/core 0.0.419 → 0.0.420
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.d.ts +1 -0
- package/dist/index.js +36 -6
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1024,6 +1024,7 @@ declare class Group<Props extends z.ZodType<any, any, any> = typeof groupProps>
|
|
|
1024
1024
|
doInitialSourceRender(): void;
|
|
1025
1025
|
doInitialSourceParentAttachment(): void;
|
|
1026
1026
|
doInitialPcbComponentRender(): void;
|
|
1027
|
+
doInitialPcbPrimitiveRender(): void;
|
|
1027
1028
|
doInitialCreateTraceHintsFromProps(): void;
|
|
1028
1029
|
doInitialSourceAddConnectivityMapKey(): void;
|
|
1029
1030
|
_areChildSubcircuitsRouted(): boolean;
|
package/dist/index.js
CHANGED
|
@@ -2427,6 +2427,7 @@ function getBoundsOfPcbComponents(components) {
|
|
|
2427
2427
|
let minY = Infinity;
|
|
2428
2428
|
let maxX = -Infinity;
|
|
2429
2429
|
let maxY = -Infinity;
|
|
2430
|
+
let hasValidComponents = false;
|
|
2430
2431
|
for (const child of components) {
|
|
2431
2432
|
if (child.isPcbPrimitive && !child.componentName.startsWith("Silkscreen")) {
|
|
2432
2433
|
const { x, y } = child._getGlobalPcbPositionBeforeLayout();
|
|
@@ -2435,14 +2436,28 @@ function getBoundsOfPcbComponents(components) {
|
|
|
2435
2436
|
minY = Math.min(minY, y - height2 / 2);
|
|
2436
2437
|
maxX = Math.max(maxX, x + width2 / 2);
|
|
2437
2438
|
maxY = Math.max(maxY, y + height2 / 2);
|
|
2438
|
-
|
|
2439
|
+
hasValidComponents = true;
|
|
2440
|
+
} else if (child.children.length > 0) {
|
|
2439
2441
|
const childBounds = getBoundsOfPcbComponents(child.children);
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2442
|
+
if (childBounds.width > 0 || childBounds.height > 0) {
|
|
2443
|
+
minX = Math.min(minX, childBounds.minX);
|
|
2444
|
+
minY = Math.min(minY, childBounds.minY);
|
|
2445
|
+
maxX = Math.max(maxX, childBounds.maxX);
|
|
2446
|
+
maxY = Math.max(maxY, childBounds.maxY);
|
|
2447
|
+
hasValidComponents = true;
|
|
2448
|
+
}
|
|
2444
2449
|
}
|
|
2445
2450
|
}
|
|
2451
|
+
if (!hasValidComponents) {
|
|
2452
|
+
return {
|
|
2453
|
+
minX: 0,
|
|
2454
|
+
minY: 0,
|
|
2455
|
+
maxX: 0,
|
|
2456
|
+
maxY: 0,
|
|
2457
|
+
width: 0,
|
|
2458
|
+
height: 0
|
|
2459
|
+
};
|
|
2460
|
+
}
|
|
2446
2461
|
let width = maxX - minX;
|
|
2447
2462
|
let height = maxY - minY;
|
|
2448
2463
|
if (width < 0) width = 0;
|
|
@@ -6427,6 +6442,21 @@ var Group = class extends NormalComponent {
|
|
|
6427
6442
|
});
|
|
6428
6443
|
}
|
|
6429
6444
|
}
|
|
6445
|
+
doInitialPcbPrimitiveRender() {
|
|
6446
|
+
if (this.root?.pcbDisabled) return;
|
|
6447
|
+
const { db } = this.root;
|
|
6448
|
+
const bounds = getBoundsOfPcbComponents(this.children);
|
|
6449
|
+
if (this.pcb_group_id) {
|
|
6450
|
+
db.pcb_group.update(this.pcb_group_id, {
|
|
6451
|
+
width: bounds.width,
|
|
6452
|
+
height: bounds.height,
|
|
6453
|
+
center: {
|
|
6454
|
+
x: (bounds.minX + bounds.maxX) / 2,
|
|
6455
|
+
y: (bounds.minY + bounds.maxY) / 2
|
|
6456
|
+
}
|
|
6457
|
+
});
|
|
6458
|
+
}
|
|
6459
|
+
}
|
|
6430
6460
|
doInitialCreateTraceHintsFromProps() {
|
|
6431
6461
|
const { _parsedProps: props } = this;
|
|
6432
6462
|
const { db } = this.root;
|
|
@@ -8441,7 +8471,7 @@ import { identity as identity4 } from "transformation-matrix";
|
|
|
8441
8471
|
var package_default = {
|
|
8442
8472
|
name: "@tscircuit/core",
|
|
8443
8473
|
type: "module",
|
|
8444
|
-
version: "0.0.
|
|
8474
|
+
version: "0.0.419",
|
|
8445
8475
|
types: "dist/index.d.ts",
|
|
8446
8476
|
main: "dist/index.js",
|
|
8447
8477
|
module: "dist/index.js",
|