fix(ui): render live component counts

Port retail text-surface clipping so the 15px component count field remains visible under the 16px DAT font. Cover SetStackSize decrements and final component removal while preserving desired restock values.

Co-authored-by: OpenAI Codex <codex@openai.com>
This commit is contained in:
Erik 2026-07-15 18:11:02 +02:00
parent a1175e6aac
commit 0527325b25
7 changed files with 217 additions and 36 deletions

View file

@ -277,4 +277,36 @@ public class UiTextTests
Assert.Equal(9f, y);
}
[Fact]
public void LineIntersectsViewport_PartialLineRemainsDrawable()
{
// Component owned-count boxes are 15px tall while Font 0x40000000
// advances 16px. Retail clips the final pixel instead of dropping the line.
Assert.True(UiText.LineIntersectsViewport(
lineTop: 0f,
lineHeight: 16f,
viewportTop: 0f,
viewportBottom: 15f));
Assert.True(UiText.LineIntersectsViewport(
lineTop: -1f,
lineHeight: 16f,
viewportTop: 0f,
viewportBottom: 15f));
}
[Theory]
[InlineData(-16f, 16f)]
[InlineData(15f, 16f)]
public void LineIntersectsViewport_FullyClippedLineIsSkipped(
float lineTop,
float lineHeight)
{
Assert.False(UiText.LineIntersectsViewport(
lineTop,
lineHeight,
viewportTop: 0f,
viewportBottom: 15f));
}
}