@tscircuit/core 0.0.86 → 0.0.87

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 +18 -2
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -2344,6 +2344,21 @@ var mergeRoutes = (routes) => {
2344
2344
  merged.push(...next_route.reverse());
2345
2345
  }
2346
2346
  }
2347
+ for (let i = 1; i < merged.length - 1; i++) {
2348
+ const lastPoint = merged[i - 1];
2349
+ const currentPoint = merged[i];
2350
+ if (lastPoint.route_type !== "wire") continue;
2351
+ if (currentPoint.route_type !== "wire") continue;
2352
+ if (lastPoint.layer !== currentPoint.layer) {
2353
+ merged.splice(i, 0, {
2354
+ x: lastPoint.x,
2355
+ y: lastPoint.y,
2356
+ from_layer: lastPoint.layer,
2357
+ to_layer: currentPoint.layer,
2358
+ route_type: "via"
2359
+ });
2360
+ }
2361
+ }
2347
2362
  return merged;
2348
2363
  };
2349
2364
 
@@ -2732,8 +2747,9 @@ searched component ${targetComponent.getString()}, which has ports: ${targetComp
2732
2747
  if (pcbPortA && trace.route[0].route_type === "wire") {
2733
2748
  trace.route[0].start_pcb_port_id = pcbPortA;
2734
2749
  }
2735
- if (pcbPortB && trace.route[0].route_type === "wire") {
2736
- trace.route[0].end_pcb_port_id = pcbPortB;
2750
+ const lastRoutePoint = trace.route[trace.route.length - 1];
2751
+ if (pcbPortB && lastRoutePoint.route_type === "wire") {
2752
+ lastRoutePoint.end_pcb_port_id = pcbPortB;
2737
2753
  }
2738
2754
  routes.push(trace.route);
2739
2755
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.86",
4
+ "version": "0.0.87",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",