@tscircuit/core 0.0.1980 → 0.0.1981

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 +10 -16
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -5466,21 +5466,15 @@ import {
5466
5466
 
5467
5467
  // lib/components/primitive-components/Trace/trace-utils/compute-trace-length.ts
5468
5468
  function getTraceLength(route) {
5469
- let totalLength = 0;
5470
- for (let i = 0; i < route.length; i++) {
5471
- const point6 = route[i];
5472
- if (point6.route_type === "wire") {
5473
- const nextPoint = route[i + 1];
5474
- if (nextPoint) {
5475
- const nextPosition = getRoutePointPosition(nextPoint);
5476
- const position = getRoutePointPosition(point6);
5477
- const dx = nextPosition.x - position.x;
5478
- const dy = nextPosition.y - position.y;
5479
- totalLength += Math.sqrt(dx * dx + dy * dy);
5480
- }
5481
- } else if (point6.route_type === "via") {
5482
- totalLength += 1.6;
5483
- }
5469
+ const routePositions = route.flatMap(getRoutePointPositions);
5470
+ let totalLength = route.filter(({ route_type }) => route_type === "via").length * 1.6;
5471
+ for (let i = 1; i < routePositions.length; i++) {
5472
+ const previousPosition = routePositions[i - 1];
5473
+ const position = routePositions[i];
5474
+ totalLength += Math.hypot(
5475
+ position.x - previousPosition.x,
5476
+ position.y - previousPosition.y
5477
+ );
5484
5478
  }
5485
5479
  return totalLength;
5486
5480
  }
@@ -64021,7 +64015,7 @@ function Group_getRoutingPhasePlans(group) {
64021
64015
  var package_default = {
64022
64016
  name: "@tscircuit/core",
64023
64017
  type: "module",
64024
- version: "0.0.1979",
64018
+ version: "0.0.1980",
64025
64019
  types: "dist/index.d.ts",
64026
64020
  main: "dist/index.js",
64027
64021
  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.1980",
4
+ "version": "0.0.1981",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",