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

@ -129,6 +129,17 @@ public sealed class UiItemList : UiElement
_cells.Clear();
}
public override bool OnEvent(in UiEvent e)
{
if (e.Type == UiEventType.Scroll && CellWidth > 0f)
{
// Mirror UiText: Silk +Y wheel = up/older = decrease ScrollY; negate Data0.
Scroll.ScrollByLines(-e.Data0);
return true;
}
return base.OnEvent(e);
}
protected override void OnDraw(UiRenderContext ctx)
{
// The factory sets Width/Height AFTER construction, so re-layout each frame: