feat(ui): D.2b inventory finish — vertical-only window resize

Drag the bottom edge to expand the inventory and see more of the pack
(ResizeX=false + ResizableEdges=Bottom blocks horizontal resize). The contents
grid + its gm3DItemsUI sub-window + scrollbar + the backdrop stretch vertically
(Left|Top|Bottom); the paperdoll + side-bag column stay pinned at the top
(Left|Top). The grid's ViewHeight grows → more rows + the scrollbar thumb ratio
(view/content) reflects how much is left to scroll. Min = dat default (expand
only for now); max = 560. Visually confirmed: scroll + resize work.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Erik 2026-06-21 21:17:28 +02:00
parent 06c4288282
commit a1e7041ba8

View file

@ -2170,9 +2170,44 @@ public sealed class GameWindow : IDisposable
// Content offset by the border so it sits inside the chrome.
inventoryRoot.Left = invBorder; inventoryRoot.Top = invBorder;
inventoryRoot.Width = invContentW; inventoryRoot.Height = invContentH;
inventoryRoot.Anchors = AcDream.App.UI.AnchorEdges.Left | AcDream.App.UI.AnchorEdges.Top;
// Content fills the frame vertically (Left|Top|Bottom = fixed width + height tracks
// the frame) so a vertical resize grows the inner content.
inventoryRoot.Anchors = AcDream.App.UI.AnchorEdges.Left | AcDream.App.UI.AnchorEdges.Top
| AcDream.App.UI.AnchorEdges.Bottom;
inventoryRoot.Draggable = false;
inventoryFrame.AddChild(inventoryRoot);
// Vertical-only resize: drag the BOTTOM edge to expand and see more of the pack.
// ResizeX=false + ResizableEdges=Bottom blocks horizontal resize (user request).
// MinHeight = the dat default (no shrink below it); MaxHeight = toward full screen.
inventoryFrame.Resizable = true;
inventoryFrame.ResizeX = false;
inventoryFrame.ResizableEdges = AcDream.App.UI.ResizeEdges.Bottom;
inventoryFrame.MinHeight = invContentH + 2 * invBorder;
inventoryFrame.MaxHeight = 560f;
// Stretch the contents region with the window: the gm3DItemsUI sub-window + its grid
// + scrollbar + the full-window backdrop grow vertically (Left|Top|Bottom); the
// paperdoll + side-bag column stay pinned at the top (Left|Top). The grid's ViewHeight
// grows → more rows + the scrollbar thumb ratio (view/content) reflects it.
void StretchV(uint id)
{
if (invLayout!.FindElement(id) is { } el)
el.Anchors = AcDream.App.UI.AnchorEdges.Left | AcDream.App.UI.AnchorEdges.Top
| AcDream.App.UI.AnchorEdges.Bottom;
}
void PinTopLeft(uint id)
{
if (invLayout!.FindElement(id) is { } el)
el.Anchors = AcDream.App.UI.AnchorEdges.Left | AcDream.App.UI.AnchorEdges.Top;
}
StretchV(0x100001D0u); // full-window backdrop
StretchV(0x100001CFu); // gm3DItemsUI sub-window (contents-grid container)
StretchV(0x100001C6u); // contents grid (UiItemList)
StretchV(0x100001C7u); // contents scrollbar
PinTopLeft(0x100001CDu); // paperdoll (fixed at top)
PinTopLeft(0x100001CEu); // side-bag column (fixed at top)
_uiHost.Root.AddChild(inventoryFrame);
_uiHost.RegisterWindow(AcDream.App.UI.WindowNames.Inventory, inventoryFrame);