@tscircuit/core 0.0.637 → 0.0.638
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 +28 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -8742,10 +8742,34 @@ var getSizeOfTreeNodeChild = (db, child) => {
|
|
|
8742
8742
|
const schGroup = db.schematic_group.getWhere({
|
|
8743
8743
|
source_group_id: sourceGroup?.source_group_id
|
|
8744
8744
|
});
|
|
8745
|
-
if (
|
|
8745
|
+
if (schGroup?.width && schGroup?.height) {
|
|
8746
|
+
return {
|
|
8747
|
+
width: schGroup.width,
|
|
8748
|
+
height: schGroup.height
|
|
8749
|
+
};
|
|
8750
|
+
}
|
|
8751
|
+
const groupComponents = db.schematic_component.list({
|
|
8752
|
+
schematic_group_id: schGroup?.schematic_group_id
|
|
8753
|
+
});
|
|
8754
|
+
let minX = Infinity;
|
|
8755
|
+
let maxX = -Infinity;
|
|
8756
|
+
let minY = Infinity;
|
|
8757
|
+
let maxY = -Infinity;
|
|
8758
|
+
for (const comp of groupComponents) {
|
|
8759
|
+
if (comp.center && comp.size) {
|
|
8760
|
+
const halfWidth = comp.size.width / 2;
|
|
8761
|
+
const halfHeight = comp.size.height / 2;
|
|
8762
|
+
minX = Math.min(minX, comp.center.x - halfWidth);
|
|
8763
|
+
maxX = Math.max(maxX, comp.center.x + halfWidth);
|
|
8764
|
+
minY = Math.min(minY, comp.center.y - halfHeight);
|
|
8765
|
+
maxY = Math.max(maxY, comp.center.y + halfHeight);
|
|
8766
|
+
}
|
|
8767
|
+
}
|
|
8768
|
+
const groupWidth = maxX - minX;
|
|
8769
|
+
const groupHeight = maxY - minY;
|
|
8746
8770
|
return {
|
|
8747
|
-
width:
|
|
8748
|
-
height:
|
|
8771
|
+
width: groupWidth,
|
|
8772
|
+
height: groupHeight
|
|
8749
8773
|
};
|
|
8750
8774
|
}
|
|
8751
8775
|
return null;
|
|
@@ -12743,7 +12767,7 @@ import { identity as identity5 } from "transformation-matrix";
|
|
|
12743
12767
|
var package_default = {
|
|
12744
12768
|
name: "@tscircuit/core",
|
|
12745
12769
|
type: "module",
|
|
12746
|
-
version: "0.0.
|
|
12770
|
+
version: "0.0.637",
|
|
12747
12771
|
types: "dist/index.d.ts",
|
|
12748
12772
|
main: "dist/index.js",
|
|
12749
12773
|
module: "dist/index.js",
|