@tscircuit/core 0.0.956 → 0.0.958
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 +2 -0
- package/dist/index.js +47 -41
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1362,6 +1362,8 @@ declare class Group<Props extends z.ZodType<any, any, any> = typeof groupProps>
|
|
|
1362
1362
|
doInitialSourceParentAttachment(): void;
|
|
1363
1363
|
doInitialPcbComponentRender(): void;
|
|
1364
1364
|
doInitialPcbPrimitiveRender(): void;
|
|
1365
|
+
calculatePcbGroupBounds(): void;
|
|
1366
|
+
updatePcbPrimitiveRender(): void;
|
|
1365
1367
|
unnamedElementCounter: Record<string, number>;
|
|
1366
1368
|
getNextAvailableName(elm: PrimitiveComponent): string;
|
|
1367
1369
|
_resolvePcbPadding(): {
|
package/dist/index.js
CHANGED
|
@@ -177,7 +177,8 @@ var asyncPhaseDependencies = {
|
|
|
177
177
|
SilkscreenOverlapAdjustment: ["PcbFootprintStringRender"],
|
|
178
178
|
CadModelRender: ["PcbFootprintStringRender"],
|
|
179
179
|
PartsEngineRender: ["PcbFootprintStringRender"],
|
|
180
|
-
PcbComponentAnchorAlignment: ["PcbFootprintStringRender"]
|
|
180
|
+
PcbComponentAnchorAlignment: ["PcbFootprintStringRender"],
|
|
181
|
+
PanelLayout: ["PcbFootprintStringRender"]
|
|
181
182
|
};
|
|
182
183
|
var globalRenderCounter = 0;
|
|
183
184
|
var Renderable = class _Renderable {
|
|
@@ -14060,52 +14061,57 @@ var Group6 = class extends NormalComponent3 {
|
|
|
14060
14061
|
}
|
|
14061
14062
|
}
|
|
14062
14063
|
doInitialPcbPrimitiveRender() {
|
|
14064
|
+
this.calculatePcbGroupBounds();
|
|
14065
|
+
}
|
|
14066
|
+
calculatePcbGroupBounds() {
|
|
14067
|
+
if (!this.pcb_group_id) return;
|
|
14063
14068
|
if (this.root?.pcbDisabled) return;
|
|
14064
14069
|
const { db } = this.root;
|
|
14065
14070
|
const props = this._parsedProps;
|
|
14066
14071
|
const hasOutline = props.outline && props.outline.length > 0;
|
|
14067
|
-
|
|
14068
|
-
|
|
14069
|
-
|
|
14070
|
-
|
|
14071
|
-
|
|
14072
|
-
|
|
14073
|
-
|
|
14074
|
-
|
|
14075
|
-
|
|
14076
|
-
|
|
14077
|
-
|
|
14078
|
-
|
|
14079
|
-
|
|
14080
|
-
|
|
14081
|
-
} : { x: centerX2, y: centerY2 };
|
|
14082
|
-
db.pcb_group.update(this.pcb_group_id, {
|
|
14083
|
-
center: center2
|
|
14084
|
-
});
|
|
14085
|
-
return;
|
|
14086
|
-
}
|
|
14087
|
-
const bounds = getBoundsOfPcbComponents(this.children);
|
|
14088
|
-
let width = bounds.width;
|
|
14089
|
-
let height = bounds.height;
|
|
14090
|
-
let centerX = (bounds.minX + bounds.maxX) / 2;
|
|
14091
|
-
let centerY = (bounds.minY + bounds.maxY) / 2;
|
|
14092
|
-
if (this.isSubcircuit) {
|
|
14093
|
-
const { padLeft, padRight, padTop, padBottom } = this._resolvePcbPadding();
|
|
14094
|
-
width += padLeft + padRight;
|
|
14095
|
-
height += padTop + padBottom;
|
|
14096
|
-
centerX += (padRight - padLeft) / 2;
|
|
14097
|
-
centerY += (padTop - padBottom) / 2;
|
|
14098
|
-
}
|
|
14099
|
-
const center = hasExplicitPositioning ? db.pcb_group.get(this.pcb_group_id)?.center ?? {
|
|
14100
|
-
x: centerX,
|
|
14101
|
-
y: centerY
|
|
14102
|
-
} : { x: centerX, y: centerY };
|
|
14072
|
+
const hasExplicitPositioning = this._parsedProps.pcbX !== void 0 || this._parsedProps.pcbY !== void 0;
|
|
14073
|
+
if (hasOutline) {
|
|
14074
|
+
const numericOutline = props.outline.map((point2) => ({
|
|
14075
|
+
x: distance8.parse(point2.x),
|
|
14076
|
+
y: distance8.parse(point2.y)
|
|
14077
|
+
}));
|
|
14078
|
+
const outlineBounds = getBoundsFromPoints3(numericOutline);
|
|
14079
|
+
if (!outlineBounds) return;
|
|
14080
|
+
const centerX2 = (outlineBounds.minX + outlineBounds.maxX) / 2;
|
|
14081
|
+
const centerY2 = (outlineBounds.minY + outlineBounds.maxY) / 2;
|
|
14082
|
+
const center2 = hasExplicitPositioning ? db.pcb_group.get(this.pcb_group_id)?.center ?? {
|
|
14083
|
+
x: centerX2,
|
|
14084
|
+
y: centerY2
|
|
14085
|
+
} : { x: centerX2, y: centerY2 };
|
|
14103
14086
|
db.pcb_group.update(this.pcb_group_id, {
|
|
14104
|
-
|
|
14105
|
-
height: Number(props.height ?? height),
|
|
14106
|
-
center
|
|
14087
|
+
center: center2
|
|
14107
14088
|
});
|
|
14089
|
+
return;
|
|
14108
14090
|
}
|
|
14091
|
+
const bounds = getBoundsOfPcbComponents(this.children);
|
|
14092
|
+
let width = bounds.width;
|
|
14093
|
+
let height = bounds.height;
|
|
14094
|
+
let centerX = (bounds.minX + bounds.maxX) / 2;
|
|
14095
|
+
let centerY = (bounds.minY + bounds.maxY) / 2;
|
|
14096
|
+
if (this.isSubcircuit) {
|
|
14097
|
+
const { padLeft, padRight, padTop, padBottom } = this._resolvePcbPadding();
|
|
14098
|
+
width += padLeft + padRight;
|
|
14099
|
+
height += padTop + padBottom;
|
|
14100
|
+
centerX += (padRight - padLeft) / 2;
|
|
14101
|
+
centerY += (padTop - padBottom) / 2;
|
|
14102
|
+
}
|
|
14103
|
+
const center = hasExplicitPositioning ? db.pcb_group.get(this.pcb_group_id)?.center ?? {
|
|
14104
|
+
x: centerX,
|
|
14105
|
+
y: centerY
|
|
14106
|
+
} : { x: centerX, y: centerY };
|
|
14107
|
+
db.pcb_group.update(this.pcb_group_id, {
|
|
14108
|
+
width: Number(props.width ?? width),
|
|
14109
|
+
height: Number(props.height ?? height),
|
|
14110
|
+
center
|
|
14111
|
+
});
|
|
14112
|
+
}
|
|
14113
|
+
updatePcbPrimitiveRender() {
|
|
14114
|
+
this.calculatePcbGroupBounds();
|
|
14109
14115
|
}
|
|
14110
14116
|
unnamedElementCounter = {};
|
|
14111
14117
|
getNextAvailableName(elm) {
|
|
@@ -20370,7 +20376,7 @@ import { identity as identity5 } from "transformation-matrix";
|
|
|
20370
20376
|
var package_default = {
|
|
20371
20377
|
name: "@tscircuit/core",
|
|
20372
20378
|
type: "module",
|
|
20373
|
-
version: "0.0.
|
|
20379
|
+
version: "0.0.957",
|
|
20374
20380
|
types: "dist/index.d.ts",
|
|
20375
20381
|
main: "dist/index.js",
|
|
20376
20382
|
module: "dist/index.js",
|