From cd55c47ef5904cfd7eb745c5134cd0475423ca15 Mon Sep 17 00:00:00 2001 From: techmannih Date: Tue, 1 Sep 2026 12:23:49 +0530 Subject: [PATCH 1/2] Fix horizontal fallback bounds for rail net labels --- .../solvePortOnlyPin.ts | 16 +- .../bug-report-20260707T134549Z.snap.svg | 16 +- .../bug-report-20260707T141421Z.snap.svg | 2 +- .../bug-report-20260707T230831Z.snap.svg | 10 +- .../bug-report-20260716T144856Z.snap.svg | 2 +- .../bug-report-20260717T022934Z.snap.svg | 44 +- .../bug-report-20260721T221026Z.snap.svg | 44 +- .../bug-report-20260804T171919Z.snap.svg | 66 +- .../bug-report-20260819T091818Z.snap.svg | 840 +++++++++--------- .../bug-report-20260825T045913Z.snap.svg | 2 +- .../bug-report-20260901T055358Z.snap.svg | 122 ++- .../bug-report-20260901T064117Z.snap.svg | 135 ++- ...core-ground-inline-label-fallback.snap.svg | 32 +- .../repro-pmp11282-isolated-dcdc.snap.svg | 56 +- .../repro-ti-power-output-section.snap.svg | 8 +- ...epro-tmp1075-ground-label-overlap.snap.svg | 8 +- ...rellis-core-gnd-net-label-overlap.snap.svg | 135 ++- ...repro-usb-power-vbus-label-detour.snap.svg | 8 +- .../repro48-555-timer-vcc-rail-label.snap.svg | 8 +- ...trellis-core-gnd-net-label-overlap.test.ts | 16 +- 20 files changed, 797 insertions(+), 773 deletions(-) diff --git a/lib/solvers/NetLabelPlacementSolver/SingleNetLabelPlacementSolver/solvePortOnlyPin.ts b/lib/solvers/NetLabelPlacementSolver/SingleNetLabelPlacementSolver/solvePortOnlyPin.ts index 19260b22a..4ad305553 100644 --- a/lib/solvers/NetLabelPlacementSolver/SingleNetLabelPlacementSolver/solvePortOnlyPin.ts +++ b/lib/solvers/NetLabelPlacementSolver/SingleNetLabelPlacementSolver/solvePortOnlyPin.ts @@ -210,9 +210,23 @@ export function solveNetLabelPlacementForPortOnlyPin(params: { // If no valid placements found, return placement using pin's facing direction const fallbackOrientation = pinFacingDirection + const requestedOnlyVerticalOrientations = orientations.every( + (orientation) => orientation === "y+" || orientation === "y-", + ) + const usesHorizontalFallback = + fallbackOrientation === "x+" || fallbackOrientation === "x-" + // Vertical rail inputs store their horizontal text extent in netLabelHeight. + // Restore that extent when the only viable fallback is a horizontal label. const { width, height } = getDimsForOrientation({ orientation: fallbackOrientation, - netLabelWidth, + netLabelWidth: + requestedOnlyVerticalOrientations && usesHorizontalFallback + ? (netLabelHeight ?? netLabelWidth) + : netLabelWidth, + netLabelHeight: + requestedOnlyVerticalOrientations && usesHorizontalFallback + ? undefined + : netLabelHeight, }) const baseCenter = getCenterFromAnchor( anchor, diff --git a/tests/bug-reports/bug-report-20260707T134549Z/__snapshots__/bug-report-20260707T134549Z.snap.svg b/tests/bug-reports/bug-report-20260707T134549Z/__snapshots__/bug-report-20260707T134549Z.snap.svg index 6160e0d03..a0b89ebf4 100644 --- a/tests/bug-reports/bug-report-20260707T134549Z/__snapshots__/bug-report-20260707T134549Z.snap.svg +++ b/tests/bug-reports/bug-report-20260707T134549Z/__snapshots__/bug-report-20260707T134549Z.snap.svg @@ -5,7 +5,7 @@ globalConnNetId: connectivity_net4" data-x="0.3789999999999996" data-y="-0.49999 globalConnNetId: connectivity_net4" data-x="-4.8700468625" data-y="-0.47399999999999975" x="40.00000000000003" y="306.266871973541" width="14.509904690087808" height="8.061058161159906" fill="hsl(40, 100%, 50%, 0.35)" stroke="black" stroke-width="0.024810638504464286"/>XXXXXXXXXXXXXXXXXXXXXXXXX - U112345678R1SJ1123R2SJ212R3C2C1SJ3123R4JP11234JP2123456U112345678R1SJ1123R2SJ212R3C2C1SJ3123R4JP11234JP2123456XXXXXXXXXXXXXXXXX - J_BAT12D_BATU_REG1234C_INC_OUTC_REGU_MCU123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657Y11234C_XINC_XOUTR_RUNC_COREC_MCU1C_MCU2C_MCU3C_MCU4C_MCU5U_FLASH12345678C_FLASHJ_RF12345678C_RFR_CH1LED_CH1R_CH2LED_CH2R_CH3LED_CH3R_CH4LED_CH4R_CH5LED_CH5R_CH6LED_CH6J_PROG123456J_BAT12D_BATU_REG1234C_INC_OUTC_REGU_MCU123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657Y11234C_XINC_XOUTR_RUNC_COREC_MCU1C_MCU2C_MCU3C_MCU4C_MCU5U_FLASH12345678C_FLASHJ_RF12345678C_RFR_CH1LED_CH1R_CH2LED_CH2R_CH3LED_CH3R_CH4LED_CH4R_CH5LED_CH5R_CH6LED_CH6J_PROG123456XXXXXXXXXXXXXXXXXXXX - XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX -