Skip to content

Commit d9f996a

Browse files
committed
Increase character width estimates for node dimension calculation
1 parent bed47e6 commit d9f996a

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

src/lib/constants/dimensions.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,10 @@ export function calculateNodeDimensions(
9292
const pinnedParamsHeight = pinnedParamCount > 0 ? 7 + 24 * pinnedParamCount : 0;
9393

9494
// Width: base, name estimate, type name estimate, pinned params minimum, port dimension (if vertical)
95-
// Name uses 10px font (~5px per char), type uses 8px font (~4px per char), plus padding for node margins
96-
const nameWidth = name.length * 5 + 20;
97-
const typeWidth = typeName ? typeName.length * 4 + 20 : 0;
95+
// Name uses 10px font (~6px per char), type uses 8px font (~5px per char), plus padding for node margins
96+
// Use slightly larger estimates to ensure text fits (ceil behavior)
97+
const nameWidth = name.length * 6 + 20;
98+
const typeWidth = typeName ? typeName.length * 5 + 20 : 0;
9899
const pinnedParamsWidth = pinnedParamCount > 0 ? 160 : 0;
99100
const width = snapTo2G(Math.max(
100101
NODE.baseWidth,

0 commit comments

Comments
 (0)