@tscircuit/fanout-solver 0.0.27 → 0.0.28
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/lib/route-bus.ts +14 -1
- package/package.json +1 -1
package/lib/route-bus.ts
CHANGED
|
@@ -293,11 +293,23 @@ function getTrackCandidates(params: {
|
|
|
293
293
|
function getPreferredTrack(params: {
|
|
294
294
|
bus: PreparedBus
|
|
295
295
|
connection: PreparedConnection
|
|
296
|
+
traceWidth: number
|
|
296
297
|
}): number {
|
|
297
|
-
|
|
298
|
+
const preferredTrack = getPerpendicularAxis(
|
|
298
299
|
params.connection.exitTargetPoint ?? params.connection.targetPoint,
|
|
299
300
|
params.bus.direction,
|
|
300
301
|
)
|
|
302
|
+
const boundaryMinimum = isHorizontal(params.bus.direction)
|
|
303
|
+
? params.bus.sharedBoundary.minY
|
|
304
|
+
: params.bus.sharedBoundary.minX
|
|
305
|
+
const boundaryMaximum = isHorizontal(params.bus.direction)
|
|
306
|
+
? params.bus.sharedBoundary.maxY
|
|
307
|
+
: params.bus.sharedBoundary.maxX
|
|
308
|
+
|
|
309
|
+
return Math.max(
|
|
310
|
+
boundaryMinimum + params.traceWidth / 2,
|
|
311
|
+
Math.min(boundaryMaximum - params.traceWidth / 2, preferredTrack),
|
|
312
|
+
)
|
|
301
313
|
}
|
|
302
314
|
|
|
303
315
|
function getLegacyPreferredTrack(params: {
|
|
@@ -1373,6 +1385,7 @@ export function routeBusAlternatives(
|
|
|
1373
1385
|
getPreferredTrack({
|
|
1374
1386
|
bus,
|
|
1375
1387
|
connection: preparedConnection,
|
|
1388
|
+
traceWidth,
|
|
1376
1389
|
}),
|
|
1377
1390
|
getLegacyPreferredTrack({
|
|
1378
1391
|
bus,
|