feat(ui): D.2b inventory finish — UiItemList mouse-wheel scroll

OnEvent handles the Scroll wheel in grid mode (mirrors UiText's sign), driving
the shared UiScrollable. The bound gutter scrollbar (next task) is the primary
scroll affordance; the wheel is the convenience path.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Erik 2026-06-21 20:26:57 +02:00
parent 366af0c34f
commit 0d3117596c
2 changed files with 22 additions and 0 deletions

View file

@ -51,4 +51,15 @@ public sealed class UiItemListScrollTests
Assert.Equal(0f, list.GetItem(6)!.Top); // row 1 now at the view top
Assert.True(list.GetItem(18)!.Visible); // row 3 now visible
}
[Fact]
public void Wheel_down_scrolls_toward_the_bottom()
{
var list = Grid(30); // max scroll 64, LineHeight 32
// Silk wheel +Y = up/older; UiText negates Data0. Wheel DOWN (Data0 < 0) → +ScrollY.
var e = new UiEvent(0u, null, UiEventType.Scroll, Data0: -1);
bool handled = list.OnEvent(e);
Assert.True(handled);
Assert.Equal(32, list.Scroll.ScrollY); // one line (32px) down
}
}