feat(ui): D.2b inventory finish — bind contents-grid gutter scrollbar
InventoryController binds 0x100001C7 (factory Type-11 UiScrollbar) to the contents grid's UiScrollable + the shared 0x2100003E scrollbar sprites, mirroring ChatWindowController. The grid now scrolls instead of overflowing. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
0d3117596c
commit
fad807587d
2 changed files with 38 additions and 2 deletions
|
|
@ -22,6 +22,7 @@ public class InventoryControllerTests
|
|||
private const uint BurdenText = 0x100001D8u;
|
||||
private const uint BurdenCaption = 0x100001D7u;
|
||||
private const uint ContentsCaption = 0x100001C5u;
|
||||
private const uint ContentsScrollbar = 0x100001C7u;
|
||||
|
||||
private static (ImportedLayout layout, UiItemList grid, UiItemList containers,
|
||||
UiItemList top, UiMeter meter, UiElement burdenText,
|
||||
|
|
@ -34,15 +35,16 @@ public class InventoryControllerTests
|
|||
var burdenText = new TestElement { Width = 36, Height = 15 };
|
||||
var burdenCap = new TestElement { Width = 36, Height = 15 };
|
||||
var contentsCap = new TestElement { Width = 192, Height = 15 };
|
||||
var scrollbar = new UiScrollbar { Width = 16, Height = 96 };
|
||||
var root = new TestElement { Width = 300, Height = 362 };
|
||||
root.AddChild(grid); root.AddChild(containers); root.AddChild(top);
|
||||
root.AddChild(meter); root.AddChild(burdenText); root.AddChild(burdenCap);
|
||||
root.AddChild(contentsCap);
|
||||
root.AddChild(contentsCap); root.AddChild(scrollbar);
|
||||
var byId = new Dictionary<uint, UiElement>
|
||||
{
|
||||
[ContentsGrid] = grid, [ContainerList] = containers, [TopContainer] = top,
|
||||
[BurdenMeter] = meter, [BurdenText] = burdenText, [BurdenCaption] = burdenCap,
|
||||
[ContentsCaption] = contentsCap,
|
||||
[ContentsCaption] = contentsCap, [ContentsScrollbar] = scrollbar,
|
||||
};
|
||||
return (new ImportedLayout(root, byId), grid, containers, top, meter,
|
||||
burdenText, burdenCap, contentsCap);
|
||||
|
|
@ -192,6 +194,15 @@ public class InventoryControllerTests
|
|||
Assert.Equal(0.2f, meter.Fill() ?? -1f, 3); // 9000/15000/3
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Contents_grid_scrollbar_binds_to_the_grid_scroll_model()
|
||||
{
|
||||
var (layout, grid, _, _, _, _, _, _) = BuildLayout();
|
||||
Bind(layout, new ClientObjectTable());
|
||||
var bar = (UiScrollbar)layout.FindElement(ContentsScrollbar)!;
|
||||
Assert.Same(grid.Scroll, bar.Model); // the bar drives the grid's scroll
|
||||
}
|
||||
|
||||
// Reads the text of the UiText caption child attached by the controller.
|
||||
private static string CaptionText(UiElement host)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue