fix(ui): complete retail inventory scroll polish

Preserve pixel scroll offsets across inventory rebuilds, crop partially visible rows with nested geometry/UV clips, and replace the obsolete 560px resize ceiling with available screen height. Keep retail's row-sized wheel step while allowing continuous scrollbar thumb positions.

Co-Authored-By: Codex <codex@openai.com>
This commit is contained in:
Erik 2026-07-11 10:56:33 +02:00
parent ea72c395c9
commit 15aa3b9aff
15 changed files with 379 additions and 34 deletions

View file

@ -52,6 +52,40 @@ public sealed class UiItemListScrollTests
Assert.True(list.GetItem(18)!.Visible); // row 3 now visible
}
[Fact]
public void Pixel_scroll_keeps_partiallyVisible_edge_rows()
{
var list = Grid(30);
list.Scroll.SetScrollY(8);
list.LayoutCells();
Assert.True(list.GetItem(0)!.Visible);
Assert.Equal(-8f, list.GetItem(0)!.Top);
Assert.True(list.GetItem(18)!.Visible);
Assert.Equal(88f, list.GetItem(18)!.Top);
Assert.False(list.GetItem(24)!.Visible);
Assert.Null(list.HitTest(5f, -1f));
Assert.IsType<UiItemSlot>(list.HitTest(5f, 1f));
}
[Fact]
public void Deferred_rebuild_preserves_pixel_scroll_offset()
{
var list = Grid(30);
list.Scroll.SetScrollY(40);
using (list.DeferLayout())
{
list.Flush();
for (int i = 0; i < 30; i++)
list.AddItem(new UiItemSlot());
}
Assert.Equal(40, list.Scroll.ScrollY);
Assert.Equal(-8f, list.GetItem(6)!.Top);
}
[Fact]
public void Scroll_survives_the_per_frame_anchor_pass()
{