@tscircuit/core 0.0.582 → 0.0.584

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.
Files changed (2) hide show
  1. package/dist/index.js +17 -9
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -8063,13 +8063,9 @@ import {
8063
8063
  } from "calculate-packing";
8064
8064
  import { length } from "circuit-json";
8065
8065
  import { transformPCBElements as transformPCBElements2 } from "@tscircuit/circuit-json-util";
8066
- import { translate as translate6 } from "transformation-matrix";
8066
+ import { translate as translate6, rotate as rotate2, compose as compose4 } from "transformation-matrix";
8067
8067
  import Debug6 from "debug";
8068
8068
  var debug5 = Debug6("Group_doInitialPcbLayoutPack");
8069
- var sub = (a, b) => ({
8070
- x: a.x - b.x,
8071
- y: a.y - b.y
8072
- });
8073
8069
  var Group_doInitialPcbLayoutPack = (group) => {
8074
8070
  const { db } = group.root;
8075
8071
  const { _parsedProps: props } = group;
@@ -8093,15 +8089,20 @@ var Group_doInitialPcbLayoutPack = (group) => {
8093
8089
  global.debugGraphics?.push(graphics);
8094
8090
  }
8095
8091
  for (const packedComponent of packOutput.components) {
8096
- const { center, componentId, pads, ccwRotationOffset } = packedComponent;
8092
+ const { center, componentId, ccwRotationOffset } = packedComponent;
8097
8093
  const component = db.pcb_component.get(componentId);
8098
8094
  if (!component) continue;
8099
- const delta = sub(center, component.center);
8095
+ const originalCenter = component.center;
8096
+ const transformMatrix = compose4(
8097
+ translate6(center.x, center.y),
8098
+ rotate2(ccwRotationOffset || 0),
8099
+ translate6(-originalCenter.x, -originalCenter.y)
8100
+ );
8100
8101
  transformPCBElements2(
8101
8102
  subtreeCircuitJson.filter(
8102
8103
  (elm) => "pcb_component_id" in elm && elm.pcb_component_id === componentId
8103
8104
  ),
8104
- translate6(delta.x, delta.y)
8105
+ transformMatrix
8105
8106
  );
8106
8107
  }
8107
8108
  };
@@ -8638,12 +8639,19 @@ var Group = class extends NormalComponent {
8638
8639
  }
8639
8640
  _getSchematicLayoutMode() {
8640
8641
  const props = this._parsedProps;
8642
+ if (props.schLayout?.layoutMode === "none") return "none";
8641
8643
  if (props.schLayout?.matchAdapt) return "match-adapt";
8642
8644
  if (props.schLayout?.flex) return "flex";
8643
8645
  if (props.schLayout?.grid) return "grid";
8644
8646
  if (props.matchAdapt) return "match-adapt";
8645
8647
  if (props.flex) return "flex";
8646
8648
  if (props.grid) return "grid";
8649
+ const anyChildHasSchCoords = this.children.some((child) => {
8650
+ const cProps = child._parsedProps;
8651
+ return cProps?.schX !== void 0 || cProps?.schY !== void 0;
8652
+ });
8653
+ const hasManualEdits = (props.manualEdits?.schematic_placements?.length ?? 0) > 0;
8654
+ if (!anyChildHasSchCoords && !hasManualEdits) return "match-adapt";
8647
8655
  return "none";
8648
8656
  }
8649
8657
  doInitialSchematicLayout() {
@@ -11132,7 +11140,7 @@ import { identity as identity5 } from "transformation-matrix";
11132
11140
  var package_default = {
11133
11141
  name: "@tscircuit/core",
11134
11142
  type: "module",
11135
- version: "0.0.581",
11143
+ version: "0.0.583",
11136
11144
  types: "dist/index.d.ts",
11137
11145
  main: "dist/index.js",
11138
11146
  module: "dist/index.js",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.582",
4
+ "version": "0.0.584",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",