@tscircuit/core 0.0.583 → 0.0.585

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 +31 -11
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -4958,6 +4958,21 @@ var pushEdgesOfSchematicTraceToPreventOverlap = ({
4958
4958
  }
4959
4959
  };
4960
4960
 
4961
+ // lib/utils/schematic/convertFacingDirectionToElbowDirection.ts
4962
+ var convertFacingDirectionToElbowDirection = (facingDirection) => {
4963
+ switch (facingDirection) {
4964
+ case "up":
4965
+ return "y+";
4966
+ case "down":
4967
+ return "y-";
4968
+ case "left":
4969
+ return "x-";
4970
+ case "right":
4971
+ return "x+";
4972
+ default:
4973
+ }
4974
+ };
4975
+
4961
4976
  // lib/components/primitive-components/Trace/Trace_doInitialSchematicTraceRender.ts
4962
4977
  var Trace_doInitialSchematicTraceRender = (trace) => {
4963
4978
  if (trace.root?.schematicDisabled) return;
@@ -5078,12 +5093,16 @@ var Trace_doInitialSchematicTraceRender = (trace) => {
5078
5093
  {
5079
5094
  x: start.position.x,
5080
5095
  y: start.position.y,
5081
- facingDirection: start.facingDirection
5096
+ facingDirection: convertFacingDirectionToElbowDirection(
5097
+ start.facingDirection
5098
+ )
5082
5099
  },
5083
5100
  {
5084
5101
  x: end.position.x,
5085
5102
  y: end.position.y,
5086
- facingDirection: end.facingDirection
5103
+ facingDirection: convertFacingDirectionToElbowDirection(
5104
+ end.facingDirection
5105
+ )
5087
5106
  }
5088
5107
  );
5089
5108
  for (let j = 0; j < path.length - 1; j++) {
@@ -8063,13 +8082,9 @@ import {
8063
8082
  } from "calculate-packing";
8064
8083
  import { length } from "circuit-json";
8065
8084
  import { transformPCBElements as transformPCBElements2 } from "@tscircuit/circuit-json-util";
8066
- import { translate as translate6 } from "transformation-matrix";
8085
+ import { translate as translate6, rotate as rotate2, compose as compose4 } from "transformation-matrix";
8067
8086
  import Debug6 from "debug";
8068
8087
  var debug5 = Debug6("Group_doInitialPcbLayoutPack");
8069
- var sub = (a, b) => ({
8070
- x: a.x - b.x,
8071
- y: a.y - b.y
8072
- });
8073
8088
  var Group_doInitialPcbLayoutPack = (group) => {
8074
8089
  const { db } = group.root;
8075
8090
  const { _parsedProps: props } = group;
@@ -8093,15 +8108,20 @@ var Group_doInitialPcbLayoutPack = (group) => {
8093
8108
  global.debugGraphics?.push(graphics);
8094
8109
  }
8095
8110
  for (const packedComponent of packOutput.components) {
8096
- const { center, componentId, pads, ccwRotationOffset } = packedComponent;
8111
+ const { center, componentId, ccwRotationOffset } = packedComponent;
8097
8112
  const component = db.pcb_component.get(componentId);
8098
8113
  if (!component) continue;
8099
- const delta = sub(center, component.center);
8114
+ const originalCenter = component.center;
8115
+ const transformMatrix = compose4(
8116
+ translate6(center.x, center.y),
8117
+ rotate2(ccwRotationOffset || 0),
8118
+ translate6(-originalCenter.x, -originalCenter.y)
8119
+ );
8100
8120
  transformPCBElements2(
8101
8121
  subtreeCircuitJson.filter(
8102
8122
  (elm) => "pcb_component_id" in elm && elm.pcb_component_id === componentId
8103
8123
  ),
8104
- translate6(delta.x, delta.y)
8124
+ transformMatrix
8105
8125
  );
8106
8126
  }
8107
8127
  };
@@ -11139,7 +11159,7 @@ import { identity as identity5 } from "transformation-matrix";
11139
11159
  var package_default = {
11140
11160
  name: "@tscircuit/core",
11141
11161
  type: "module",
11142
- version: "0.0.582",
11162
+ version: "0.0.584",
11143
11163
  types: "dist/index.d.ts",
11144
11164
  main: "dist/index.js",
11145
11165
  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.583",
4
+ "version": "0.0.585",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",