Keep an output's name readable beside a long inline value (#306)

An input and an output in the same port row were cut to fit each on
its own. The input text could reach x = 123 and the output label could
start at x = 83, so a long inline value ran under the output's name.
At Animation playing a long animation name covered "progress".

- The output label is placed first and keeps its room. The input text
  is cut with an ellipsis 6 px before it, as decided in the issue.
- The rule is a pure function in src/editor/graph/portRow.ts. A row
  without an output keeps the input's old limit of 108 px.
- The value a run shows beside an output uses the same rule. Its left
  edge can no longer lie right of its right edge.
- New test hook __gm.graph.rowSpans(nodeId) gives each row's input
  and output text as cut and placed, in node units.
- NODE_WIDTH stays as it is, as decided in the issue.

Tests:
- Gate: 230 files, 3520 tests (6 new in port-row.test.ts).
- e2e 6: all passed, 149 checks (148 + 1).
- Counter-check: with the rule switched off, the input text reaches
  x = 121.4 under "progress" at x = 114.1, and the new check fails.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
adminandClaude Opus 5.5 committed 2026-10-03 18:33:06 +02:00
1 parent a40e629fde
commit 2aa635f453
7 files changed
+105 -24

No files matched your search

+14
View File
@@ -1862,6 +1862,20 @@ export async function graph(t) {
JSON.stringify(logged) === JSON.stringify(['true', 'false']),
JSON.stringify(logged),
);
// #306: a long animation name gives way before the output label of its row.
await mutate(
`__gm.state.project.assets.find((a) => a.id === 'ap-swing').name = 'Swing with a name far too long for its row'`,
);
await shot('28b-animation-playing-long-name');
const row = (await json(`__gm.graph.rowSpans(${id})`))?.[1];
check(
'a long inline value is cut before the output label of its row, which stays whole',
row?.input?.text.endsWith('…') &&
'animation Swing with a name far too long for its row'.startsWith(row.input.text.slice(0, -1)) &&
row.output?.text === 'progress' &&
row.input.right + 6 <= row.output.left,
JSON.stringify(row),
);
await mutate(`
const p = __gm.state.project;
p.assets = p.assets.filter((a) => a.id !== 'apy' && a.id !== 'ap-swing');