@tscircuit/core 0.0.636 → 0.0.637
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 +4 -4
- package/dist/index.js +179 -120
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -7820,9 +7820,9 @@ declare const voltageSourceProps: z.ZodObject<{
|
|
|
7820
7820
|
layer?: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6" | undefined;
|
|
7821
7821
|
phase?: number | undefined;
|
|
7822
7822
|
voltage?: number | undefined;
|
|
7823
|
+
frequency?: number | undefined;
|
|
7823
7824
|
pcbX?: number | undefined;
|
|
7824
7825
|
pcbY?: number | undefined;
|
|
7825
|
-
frequency?: number | undefined;
|
|
7826
7826
|
pcbRotation?: number | undefined;
|
|
7827
7827
|
schX?: number | undefined;
|
|
7828
7828
|
schY?: number | undefined;
|
|
@@ -7906,9 +7906,9 @@ declare const voltageSourceProps: z.ZodObject<{
|
|
|
7906
7906
|
} | undefined;
|
|
7907
7907
|
phase?: string | number | undefined;
|
|
7908
7908
|
voltage?: string | number | undefined;
|
|
7909
|
+
frequency?: string | number | undefined;
|
|
7909
7910
|
pcbX?: string | number | undefined;
|
|
7910
7911
|
pcbY?: string | number | undefined;
|
|
7911
|
-
frequency?: string | number | undefined;
|
|
7912
7912
|
pcbRotation?: string | number | undefined;
|
|
7913
7913
|
schX?: string | number | undefined;
|
|
7914
7914
|
schY?: string | number | undefined;
|
|
@@ -8283,9 +8283,9 @@ declare class VoltageSource extends NormalComponent<typeof voltageSourceProps, "
|
|
|
8283
8283
|
layer?: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6" | undefined;
|
|
8284
8284
|
phase?: number | undefined;
|
|
8285
8285
|
voltage?: number | undefined;
|
|
8286
|
+
frequency?: number | undefined;
|
|
8286
8287
|
pcbX?: number | undefined;
|
|
8287
8288
|
pcbY?: number | undefined;
|
|
8288
|
-
frequency?: number | undefined;
|
|
8289
8289
|
pcbRotation?: number | undefined;
|
|
8290
8290
|
schX?: number | undefined;
|
|
8291
8291
|
schY?: number | undefined;
|
|
@@ -8369,9 +8369,9 @@ declare class VoltageSource extends NormalComponent<typeof voltageSourceProps, "
|
|
|
8369
8369
|
} | undefined;
|
|
8370
8370
|
phase?: string | number | undefined;
|
|
8371
8371
|
voltage?: string | number | undefined;
|
|
8372
|
+
frequency?: string | number | undefined;
|
|
8372
8373
|
pcbX?: string | number | undefined;
|
|
8373
8374
|
pcbY?: string | number | undefined;
|
|
8374
|
-
frequency?: string | number | undefined;
|
|
8375
8375
|
pcbRotation?: string | number | undefined;
|
|
8376
8376
|
schX?: string | number | undefined;
|
|
8377
8377
|
schY?: string | number | undefined;
|
package/dist/index.js
CHANGED
|
@@ -8889,115 +8889,178 @@ var Group_doInitialSchematicLayoutFlex = (group) => {
|
|
|
8889
8889
|
};
|
|
8890
8890
|
|
|
8891
8891
|
// lib/components/primitive-components/Group/Group_doInitialPcbLayoutGrid.ts
|
|
8892
|
-
import { translate as translate5 } from "transformation-matrix";
|
|
8893
8892
|
import {
|
|
8894
|
-
|
|
8895
|
-
|
|
8893
|
+
repositionPcbComponentTo,
|
|
8894
|
+
repositionPcbGroupTo
|
|
8896
8895
|
} from "@tscircuit/circuit-json-util";
|
|
8897
8896
|
import { length as length3 } from "circuit-json";
|
|
8898
8897
|
import { CssGrid } from "minicssgrid";
|
|
8898
|
+
var MIN_GAP = 1;
|
|
8899
8899
|
function Group_doInitialPcbLayoutGrid(group) {
|
|
8900
8900
|
const { db } = group.root;
|
|
8901
8901
|
const props = group._parsedProps;
|
|
8902
|
-
const pcbChildren = group
|
|
8903
|
-
(child) => child.pcb_component_id
|
|
8904
|
-
);
|
|
8902
|
+
const pcbChildren = getPcbChildren(group);
|
|
8905
8903
|
if (pcbChildren.length === 0) return;
|
|
8906
|
-
|
|
8907
|
-
|
|
8904
|
+
const childDimensions = calculateChildDimensions({ db, pcbChildren });
|
|
8905
|
+
const gridConfig = parseGridConfiguration(props);
|
|
8906
|
+
const gridLayout = createGridLayout({
|
|
8907
|
+
props,
|
|
8908
|
+
pcbChildren,
|
|
8909
|
+
childDimensions,
|
|
8910
|
+
gridConfig
|
|
8911
|
+
});
|
|
8912
|
+
const cssGrid = createCssGrid({
|
|
8913
|
+
pcbChildren,
|
|
8914
|
+
childDimensions,
|
|
8915
|
+
gridLayout,
|
|
8916
|
+
gridConfig
|
|
8917
|
+
});
|
|
8918
|
+
const { itemCoordinates } = cssGrid.layout();
|
|
8919
|
+
positionChildren({ db, group, pcbChildren, itemCoordinates, gridLayout });
|
|
8920
|
+
updateGroupDimensions({ db, group, props, gridLayout });
|
|
8921
|
+
}
|
|
8922
|
+
function getPcbChildren(group) {
|
|
8923
|
+
return group.children.filter(
|
|
8924
|
+
(child) => child.pcb_component_id || child.pcb_group_id
|
|
8925
|
+
);
|
|
8926
|
+
}
|
|
8927
|
+
function calculateChildDimensions(params) {
|
|
8928
|
+
const { db, pcbChildren } = params;
|
|
8929
|
+
let maxWidth = 0;
|
|
8930
|
+
let maxHeight = 0;
|
|
8908
8931
|
for (const child of pcbChildren) {
|
|
8909
|
-
|
|
8910
|
-
let
|
|
8911
|
-
|
|
8912
|
-
|
|
8913
|
-
|
|
8914
|
-
|
|
8915
|
-
|
|
8916
|
-
|
|
8917
|
-
|
|
8918
|
-
|
|
8919
|
-
|
|
8920
|
-
|
|
8921
|
-
|
|
8922
|
-
let gridColsOption = props.pcbGridCols ?? props.gridCols;
|
|
8923
|
-
let gridRowsOption = props.pcbGridRows;
|
|
8924
|
-
let gridGapOption = props.pcbGridGap ?? props.gridGap;
|
|
8925
|
-
let gridRowGapOption = props.pcbGridRowGap ?? props.gridRowGap;
|
|
8926
|
-
let gridColumnGapOption = props.pcbGridColumnGap ?? props.gridColumnGap;
|
|
8927
|
-
if (props.pcbLayout?.grid) {
|
|
8928
|
-
gridColsOption = props.pcbLayout.grid.cols ?? gridColsOption;
|
|
8929
|
-
gridRowsOption = props.pcbLayout.grid.rows;
|
|
8930
|
-
gridGapOption = props.pcbLayout.gridGap ?? gridGapOption;
|
|
8931
|
-
gridRowGapOption = props.pcbLayout.gridRowGap ?? gridRowGapOption;
|
|
8932
|
-
gridColumnGapOption = props.pcbLayout.gridColumnGap ?? gridColumnGapOption;
|
|
8932
|
+
let width = 0;
|
|
8933
|
+
let height = 0;
|
|
8934
|
+
if (child.pcb_group_id) {
|
|
8935
|
+
const pcbGroup = db.pcb_group.get(child.pcb_group_id);
|
|
8936
|
+
width = pcbGroup?.width ?? 0;
|
|
8937
|
+
height = pcbGroup?.height ?? 0;
|
|
8938
|
+
} else if (child.pcb_component_id) {
|
|
8939
|
+
const pcbComp = db.pcb_component.get(child.pcb_component_id);
|
|
8940
|
+
width = pcbComp?.width ?? 0;
|
|
8941
|
+
height = pcbComp?.height ?? 0;
|
|
8942
|
+
}
|
|
8943
|
+
maxWidth = Math.max(maxWidth, width);
|
|
8944
|
+
maxHeight = Math.max(maxHeight, height);
|
|
8933
8945
|
}
|
|
8934
|
-
|
|
8935
|
-
|
|
8936
|
-
|
|
8946
|
+
return {
|
|
8947
|
+
width: maxWidth,
|
|
8948
|
+
height: maxHeight
|
|
8937
8949
|
};
|
|
8938
|
-
|
|
8939
|
-
|
|
8940
|
-
|
|
8941
|
-
|
|
8942
|
-
|
|
8943
|
-
|
|
8944
|
-
|
|
8945
|
-
|
|
8946
|
-
|
|
8947
|
-
|
|
8948
|
-
|
|
8949
|
-
|
|
8950
|
-
|
|
8951
|
-
|
|
8950
|
+
}
|
|
8951
|
+
function parseGridConfiguration(props) {
|
|
8952
|
+
const cols = props.pcbGridCols ?? props.gridCols ?? props.pcbLayout?.grid?.cols;
|
|
8953
|
+
const rows = props.pcbGridRows ?? props.pcbLayout?.grid?.rows;
|
|
8954
|
+
const templateColumns = props.pcbGridTemplateColumns;
|
|
8955
|
+
const templateRows = props.pcbGridTemplateRows;
|
|
8956
|
+
const parseGap = (gapValue) => {
|
|
8957
|
+
if (gapValue === void 0) return MIN_GAP;
|
|
8958
|
+
return typeof gapValue === "number" ? gapValue : length3.parse(gapValue);
|
|
8959
|
+
};
|
|
8960
|
+
const gridGapOption = props.pcbGridGap ?? props.gridGap ?? props.pcbLayout?.gridGap;
|
|
8961
|
+
const rowGapOption = props.pcbGridRowGap ?? props.gridRowGap ?? props.pcbLayout?.gridRowGap;
|
|
8962
|
+
const colGapOption = props.pcbGridColumnGap ?? props.gridColumnGap ?? props.pcbLayout?.gridColumnGap;
|
|
8963
|
+
let gapX = MIN_GAP;
|
|
8964
|
+
let gapY = MIN_GAP;
|
|
8965
|
+
if (rowGapOption !== void 0 || colGapOption !== void 0) {
|
|
8966
|
+
const fallbackX = typeof gridGapOption === "object" ? gridGapOption?.x : gridGapOption;
|
|
8967
|
+
const fallbackY = typeof gridGapOption === "object" ? gridGapOption?.y : gridGapOption;
|
|
8968
|
+
gapX = parseGap(colGapOption ?? fallbackX);
|
|
8969
|
+
gapY = parseGap(rowGapOption ?? fallbackY);
|
|
8952
8970
|
} else if (typeof gridGapOption === "object" && gridGapOption !== null) {
|
|
8953
|
-
|
|
8954
|
-
|
|
8955
|
-
gridGapX = typeof xRaw === "number" ? xRaw : length3.parse(xRaw ?? "0mm");
|
|
8956
|
-
gridGapY = typeof yRaw === "number" ? yRaw : length3.parse(yRaw ?? "0mm");
|
|
8971
|
+
gapX = parseGap(gridGapOption.x);
|
|
8972
|
+
gapY = parseGap(gridGapOption.y);
|
|
8957
8973
|
} else {
|
|
8958
|
-
|
|
8959
|
-
|
|
8974
|
+
const gap = parseGap(gridGapOption);
|
|
8975
|
+
gapX = gap;
|
|
8976
|
+
gapY = gap;
|
|
8960
8977
|
}
|
|
8961
|
-
|
|
8962
|
-
|
|
8963
|
-
|
|
8964
|
-
|
|
8965
|
-
|
|
8966
|
-
|
|
8967
|
-
|
|
8978
|
+
return { cols, rows, gapX, gapY, templateColumns, templateRows };
|
|
8979
|
+
}
|
|
8980
|
+
function createGridLayout(params) {
|
|
8981
|
+
const { props, pcbChildren, childDimensions, gridConfig } = params;
|
|
8982
|
+
if (props.pcbGridTemplateColumns || props.pcbGridTemplateRows) {
|
|
8983
|
+
return createTemplateBasedLayout({
|
|
8984
|
+
props,
|
|
8985
|
+
gridConfig,
|
|
8986
|
+
pcbChildren,
|
|
8987
|
+
childDimensions
|
|
8988
|
+
});
|
|
8989
|
+
}
|
|
8990
|
+
return createDefaultLayout({ gridConfig, pcbChildren, childDimensions });
|
|
8991
|
+
}
|
|
8992
|
+
function createTemplateBasedLayout(params) {
|
|
8993
|
+
const { props, gridConfig, pcbChildren, childDimensions } = params;
|
|
8994
|
+
const gridTemplateColumns = props.pcbGridTemplateColumns ?? "";
|
|
8995
|
+
const gridTemplateRows = props.pcbGridTemplateRows ?? "";
|
|
8996
|
+
const extractRepeatCount = (template) => {
|
|
8997
|
+
const match = template.match(/repeat\((\d+),/);
|
|
8998
|
+
return match ? parseInt(match[1]) : Math.ceil(Math.sqrt(pcbChildren.length));
|
|
8999
|
+
};
|
|
9000
|
+
const numCols = props.pcbGridTemplateColumns ? extractRepeatCount(gridTemplateColumns) : Math.ceil(Math.sqrt(pcbChildren.length));
|
|
9001
|
+
const numRows = props.pcbGridTemplateRows ? extractRepeatCount(gridTemplateRows) : Math.ceil(pcbChildren.length / numCols);
|
|
9002
|
+
const containerWidth = numCols * childDimensions.width + Math.max(0, numCols - 1) * gridConfig.gapX;
|
|
9003
|
+
const containerHeight = numRows * childDimensions.height + Math.max(0, numRows - 1) * gridConfig.gapY;
|
|
9004
|
+
return {
|
|
9005
|
+
gridTemplateColumns,
|
|
9006
|
+
gridTemplateRows,
|
|
9007
|
+
containerWidth,
|
|
9008
|
+
containerHeight
|
|
9009
|
+
};
|
|
9010
|
+
}
|
|
9011
|
+
function createDefaultLayout(params) {
|
|
9012
|
+
const { gridConfig, pcbChildren, childDimensions } = params;
|
|
9013
|
+
let numCols;
|
|
9014
|
+
let numRows;
|
|
9015
|
+
if (gridConfig.cols !== void 0 && gridConfig.rows !== void 0) {
|
|
9016
|
+
numCols = gridConfig.cols;
|
|
9017
|
+
numRows = gridConfig.rows;
|
|
9018
|
+
} else if (gridConfig.cols !== void 0) {
|
|
9019
|
+
numCols = gridConfig.cols;
|
|
8968
9020
|
numRows = Math.ceil(pcbChildren.length / numCols);
|
|
8969
|
-
} else if (
|
|
8970
|
-
numRows =
|
|
9021
|
+
} else if (gridConfig.rows !== void 0) {
|
|
9022
|
+
numRows = gridConfig.rows;
|
|
8971
9023
|
numCols = Math.ceil(pcbChildren.length / numRows);
|
|
8972
9024
|
} else {
|
|
8973
9025
|
numCols = Math.ceil(Math.sqrt(pcbChildren.length));
|
|
8974
9026
|
numRows = Math.ceil(pcbChildren.length / numCols);
|
|
8975
9027
|
}
|
|
8976
|
-
|
|
8977
|
-
|
|
8978
|
-
const
|
|
8979
|
-
const
|
|
8980
|
-
const gridTemplateColumns =
|
|
8981
|
-
const gridTemplateRows =
|
|
9028
|
+
numCols = Math.max(1, numCols);
|
|
9029
|
+
numRows = Math.max(1, numRows);
|
|
9030
|
+
const containerWidth = numCols * childDimensions.width + Math.max(0, numCols - 1) * gridConfig.gapX;
|
|
9031
|
+
const containerHeight = numRows * childDimensions.height + Math.max(0, numRows - 1) * gridConfig.gapY;
|
|
9032
|
+
const gridTemplateColumns = `repeat(${numCols}, ${childDimensions.width}px)`;
|
|
9033
|
+
const gridTemplateRows = `repeat(${numRows}, ${childDimensions.height}px)`;
|
|
9034
|
+
return {
|
|
9035
|
+
gridTemplateColumns,
|
|
9036
|
+
gridTemplateRows,
|
|
9037
|
+
containerWidth,
|
|
9038
|
+
containerHeight
|
|
9039
|
+
};
|
|
9040
|
+
}
|
|
9041
|
+
function createCssGrid(params) {
|
|
9042
|
+
const { pcbChildren, childDimensions, gridLayout, gridConfig } = params;
|
|
8982
9043
|
const gridChildren = pcbChildren.map((child, index) => ({
|
|
8983
9044
|
key: child.getString() || `child-${index}`,
|
|
8984
|
-
contentWidth:
|
|
8985
|
-
contentHeight:
|
|
9045
|
+
contentWidth: childDimensions.width,
|
|
9046
|
+
contentHeight: childDimensions.height
|
|
8986
9047
|
}));
|
|
8987
|
-
|
|
8988
|
-
containerWidth:
|
|
8989
|
-
containerHeight:
|
|
8990
|
-
gridTemplateColumns,
|
|
8991
|
-
gridTemplateRows,
|
|
8992
|
-
gap: [
|
|
9048
|
+
return new CssGrid({
|
|
9049
|
+
containerWidth: gridLayout.containerWidth,
|
|
9050
|
+
containerHeight: gridLayout.containerHeight,
|
|
9051
|
+
gridTemplateColumns: gridLayout.gridTemplateColumns,
|
|
9052
|
+
gridTemplateRows: gridLayout.gridTemplateRows,
|
|
9053
|
+
gap: [gridConfig.gapY, gridConfig.gapX],
|
|
8993
9054
|
// [rowGap, columnGap]
|
|
8994
9055
|
children: gridChildren
|
|
8995
9056
|
});
|
|
8996
|
-
|
|
9057
|
+
}
|
|
9058
|
+
function positionChildren(params) {
|
|
9059
|
+
const { db, group, pcbChildren, itemCoordinates, gridLayout } = params;
|
|
8997
9060
|
const groupCenter = group._getGlobalPcbPositionBeforeLayout();
|
|
9061
|
+
const allCircuitJson = db.toArray();
|
|
8998
9062
|
for (let i = 0; i < pcbChildren.length; i++) {
|
|
8999
9063
|
const child = pcbChildren[i];
|
|
9000
|
-
if (!child.pcb_component_id) continue;
|
|
9001
9064
|
const childKey = child.getString() || `child-${i}`;
|
|
9002
9065
|
const coordinates = itemCoordinates[childKey];
|
|
9003
9066
|
if (!coordinates) {
|
|
@@ -9006,35 +9069,31 @@ function Group_doInitialPcbLayoutGrid(group) {
|
|
|
9006
9069
|
);
|
|
9007
9070
|
continue;
|
|
9008
9071
|
}
|
|
9009
|
-
const
|
|
9010
|
-
const
|
|
9011
|
-
|
|
9012
|
-
|
|
9013
|
-
|
|
9014
|
-
|
|
9015
|
-
const deltaX = newCenter.x - oldCenter.x;
|
|
9016
|
-
const deltaY = newCenter.y - oldCenter.y;
|
|
9017
|
-
const mat = translate5(deltaX, deltaY);
|
|
9018
|
-
const related = db.toArray().filter((e) => e.pcb_component_id === child.pcb_component_id);
|
|
9019
|
-
const moved = transformPCBElements(related, mat);
|
|
9020
|
-
for (const elm of moved) {
|
|
9021
|
-
const idProp = getPrimaryId(elm);
|
|
9022
|
-
db[elm.type].update(elm[idProp], elm);
|
|
9023
|
-
}
|
|
9024
|
-
db.pcb_component.update(child.pcb_component_id, {
|
|
9025
|
-
center: newCenter
|
|
9026
|
-
});
|
|
9027
|
-
child.setProps({
|
|
9028
|
-
...child.props,
|
|
9029
|
-
pcbX: (child.props.pcbX ?? 0) + deltaX,
|
|
9030
|
-
pcbY: (child.props.pcbY ?? 0) + deltaY
|
|
9072
|
+
const targetX = groupCenter.x - gridLayout.containerWidth / 2 + coordinates.x + coordinates.width / 2;
|
|
9073
|
+
const targetY = groupCenter.y + gridLayout.containerHeight / 2 - coordinates.y - coordinates.height / 2;
|
|
9074
|
+
if (child.pcb_component_id) {
|
|
9075
|
+
repositionPcbComponentTo(allCircuitJson, child.pcb_component_id, {
|
|
9076
|
+
x: targetX,
|
|
9077
|
+
y: targetY
|
|
9031
9078
|
});
|
|
9079
|
+
} else {
|
|
9080
|
+
const groupChild = child;
|
|
9081
|
+
if (groupChild.pcb_group_id && groupChild.source_group_id) {
|
|
9082
|
+
repositionPcbGroupTo(allCircuitJson, groupChild.source_group_id, {
|
|
9083
|
+
x: targetX,
|
|
9084
|
+
y: targetY
|
|
9085
|
+
});
|
|
9086
|
+
}
|
|
9032
9087
|
}
|
|
9033
9088
|
}
|
|
9089
|
+
}
|
|
9090
|
+
function updateGroupDimensions(params) {
|
|
9091
|
+
const { db, group, props, gridLayout } = params;
|
|
9034
9092
|
if (group.pcb_group_id) {
|
|
9093
|
+
const groupCenter = group._getGlobalPcbPositionBeforeLayout();
|
|
9035
9094
|
db.pcb_group.update(group.pcb_group_id, {
|
|
9036
|
-
width: props.width ??
|
|
9037
|
-
height: props.height ??
|
|
9095
|
+
width: props.width ?? gridLayout.containerWidth,
|
|
9096
|
+
height: props.height ?? gridLayout.containerHeight,
|
|
9038
9097
|
center: groupCenter
|
|
9039
9098
|
});
|
|
9040
9099
|
}
|
|
@@ -9104,9 +9163,9 @@ import {
|
|
|
9104
9163
|
} from "calculate-packing";
|
|
9105
9164
|
import { length as length4 } from "circuit-json";
|
|
9106
9165
|
import {
|
|
9107
|
-
transformPCBElements
|
|
9166
|
+
transformPCBElements
|
|
9108
9167
|
} from "@tscircuit/circuit-json-util";
|
|
9109
|
-
import { translate as
|
|
9168
|
+
import { translate as translate5, rotate as rotate2, compose as compose4 } from "transformation-matrix";
|
|
9110
9169
|
import Debug7 from "debug";
|
|
9111
9170
|
var debug6 = Debug7("Group_doInitialPcbLayoutPack");
|
|
9112
9171
|
var isDescendantGroup = (db, groupId, ancestorId) => {
|
|
@@ -9161,14 +9220,14 @@ var Group_doInitialPcbLayoutPack = (group) => {
|
|
|
9161
9220
|
const rotationDegrees2 = ccwRotationDegrees ?? ccwRotationOffset ?? 0;
|
|
9162
9221
|
const transformMatrix2 = compose4(
|
|
9163
9222
|
group._computePcbGlobalTransformBeforeLayout(),
|
|
9164
|
-
|
|
9223
|
+
translate5(center.x, center.y),
|
|
9165
9224
|
rotate2(rotationDegrees2 * Math.PI / 180),
|
|
9166
|
-
|
|
9225
|
+
translate5(-originalCenter2.x, -originalCenter2.y)
|
|
9167
9226
|
);
|
|
9168
9227
|
const related = db.toArray().filter(
|
|
9169
9228
|
(elm) => "pcb_component_id" in elm && elm.pcb_component_id === componentId
|
|
9170
9229
|
);
|
|
9171
|
-
|
|
9230
|
+
transformPCBElements(related, transformMatrix2);
|
|
9172
9231
|
continue;
|
|
9173
9232
|
}
|
|
9174
9233
|
const pcbGroup = db.pcb_group.list().find((g) => g.source_group_id === componentId);
|
|
@@ -9177,9 +9236,9 @@ var Group_doInitialPcbLayoutPack = (group) => {
|
|
|
9177
9236
|
const rotationDegrees = ccwRotationDegrees ?? ccwRotationOffset ?? 0;
|
|
9178
9237
|
const transformMatrix = compose4(
|
|
9179
9238
|
group._computePcbGlobalTransformBeforeLayout(),
|
|
9180
|
-
|
|
9239
|
+
translate5(center.x, center.y),
|
|
9181
9240
|
rotate2(rotationDegrees * Math.PI / 180),
|
|
9182
|
-
|
|
9241
|
+
translate5(-originalCenter.x, -originalCenter.y)
|
|
9183
9242
|
);
|
|
9184
9243
|
const relatedElements = db.toArray().filter((elm) => {
|
|
9185
9244
|
if ("source_group_id" in elm && elm.source_group_id) {
|
|
@@ -9223,7 +9282,7 @@ var Group_doInitialPcbLayoutPack = (group) => {
|
|
|
9223
9282
|
}
|
|
9224
9283
|
return false;
|
|
9225
9284
|
});
|
|
9226
|
-
|
|
9285
|
+
transformPCBElements(relatedElements, transformMatrix);
|
|
9227
9286
|
db.pcb_group.update(pcbGroup.pcb_group_id, { center });
|
|
9228
9287
|
}
|
|
9229
9288
|
};
|
|
@@ -9231,8 +9290,8 @@ var Group_doInitialPcbLayoutPack = (group) => {
|
|
|
9231
9290
|
// lib/components/primitive-components/Group/Group_doInitialPcbLayoutFlex.ts
|
|
9232
9291
|
import {
|
|
9233
9292
|
getCircuitJsonTree as getCircuitJsonTree3,
|
|
9234
|
-
repositionPcbComponentTo,
|
|
9235
|
-
repositionPcbGroupTo,
|
|
9293
|
+
repositionPcbComponentTo as repositionPcbComponentTo2,
|
|
9294
|
+
repositionPcbGroupTo as repositionPcbGroupTo2,
|
|
9236
9295
|
getMinimumFlexContainer as getMinimumFlexContainer2
|
|
9237
9296
|
} from "@tscircuit/circuit-json-util";
|
|
9238
9297
|
import { RootFlexBox as RootFlexBox2 } from "@tscircuit/miniflex";
|
|
@@ -9374,7 +9433,7 @@ var Group_doInitialPcbLayoutFlex = (group) => {
|
|
|
9374
9433
|
source_component_id: sourceComponent.source_component_id
|
|
9375
9434
|
});
|
|
9376
9435
|
if (!pcbComponent) continue;
|
|
9377
|
-
|
|
9436
|
+
repositionPcbComponentTo2(allCircuitJson, pcbComponent.pcb_component_id, {
|
|
9378
9437
|
x: child.position.x + child.size.width / 2 + offset.x,
|
|
9379
9438
|
y: child.position.y + child.size.height / 2 + offset.y
|
|
9380
9439
|
});
|
|
@@ -9384,7 +9443,7 @@ var Group_doInitialPcbLayoutFlex = (group) => {
|
|
|
9384
9443
|
source_group_id: sourceGroup.source_group_id
|
|
9385
9444
|
});
|
|
9386
9445
|
if (!pcbGroup) continue;
|
|
9387
|
-
|
|
9446
|
+
repositionPcbGroupTo2(allCircuitJson, sourceGroup.source_group_id, {
|
|
9388
9447
|
x: child.position.x + child.size.width / 2 + offset.x,
|
|
9389
9448
|
y: child.position.y + child.size.height / 2 + offset.y
|
|
9390
9449
|
});
|
|
@@ -11402,7 +11461,7 @@ import { netLabelProps } from "@tscircuit/props";
|
|
|
11402
11461
|
import {
|
|
11403
11462
|
applyToPoint as applyToPoint8,
|
|
11404
11463
|
identity as identity4,
|
|
11405
|
-
translate as
|
|
11464
|
+
translate as translate6
|
|
11406
11465
|
} from "transformation-matrix";
|
|
11407
11466
|
var NetLabel = class extends PrimitiveComponent2 {
|
|
11408
11467
|
source_net_label_id;
|
|
@@ -11454,7 +11513,7 @@ var NetLabel = class extends PrimitiveComponent2 {
|
|
|
11454
11513
|
this.parent?.computeSchematicGlobalTransform?.() ?? identity4(),
|
|
11455
11514
|
{ x: 0, y: 0 }
|
|
11456
11515
|
);
|
|
11457
|
-
return
|
|
11516
|
+
return translate6(portPos.x - parentCenter.x, portPos.y - parentCenter.y);
|
|
11458
11517
|
}
|
|
11459
11518
|
}
|
|
11460
11519
|
return super.computeSchematicPropsTransform();
|
|
@@ -12684,7 +12743,7 @@ import { identity as identity5 } from "transformation-matrix";
|
|
|
12684
12743
|
var package_default = {
|
|
12685
12744
|
name: "@tscircuit/core",
|
|
12686
12745
|
type: "module",
|
|
12687
|
-
version: "0.0.
|
|
12746
|
+
version: "0.0.636",
|
|
12688
12747
|
types: "dist/index.d.ts",
|
|
12689
12748
|
main: "dist/index.js",
|
|
12690
12749
|
module: "dist/index.js",
|
|
@@ -12742,7 +12801,7 @@ var package_default = {
|
|
|
12742
12801
|
howfat: "^0.3.8",
|
|
12743
12802
|
"live-server": "^1.2.2",
|
|
12744
12803
|
"looks-same": "^9.0.1",
|
|
12745
|
-
minicssgrid: "^0.0.
|
|
12804
|
+
minicssgrid: "^0.0.8",
|
|
12746
12805
|
"pkg-pr-new": "^0.0.37",
|
|
12747
12806
|
react: "^19.1.0",
|
|
12748
12807
|
"react-dom": "^19.1.0",
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tscircuit/core",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.637",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"howfat": "^0.3.8",
|
|
60
60
|
"live-server": "^1.2.2",
|
|
61
61
|
"looks-same": "^9.0.1",
|
|
62
|
-
"minicssgrid": "^0.0.
|
|
62
|
+
"minicssgrid": "^0.0.8",
|
|
63
63
|
"pkg-pr-new": "^0.0.37",
|
|
64
64
|
"react": "^19.1.0",
|
|
65
65
|
"react-dom": "^19.1.0",
|