fix(ui): match retail spell bar controls

Place favorite-bar arrows by their authored sides, import rollover and pressed media through the shared scrollbar, and preserve manual offsets across passive refreshes. Carry the mixed-parent DAT anchor chain to a fixed 18-cell favorite viewport so overflow controls and the Cast button remain inside the retail-sized combat frame.

Co-authored-by: Codex <codex@openai.com>
This commit is contained in:
Erik 2026-07-23 07:01:01 +02:00
parent 02c29e67c8
commit 0134122c28
17 changed files with 424 additions and 59 deletions

View file

@ -7,6 +7,43 @@ public sealed class RetailWindowFrameTests
{
private static (uint, int, int) NoTex(uint _) => (0u, 0, 0);
[Theory]
[InlineData(9, 459f, 288f)]
[InlineData(13, 587f, 416f)]
[InlineData(18, 747f, 576f)]
public void CombatRoot_FitsRequestedFavoriteSlotCapacity(
int visibleSlots,
float expectedRootWidth,
float expectedListWidth)
{
ImportedLayout combat = LayoutImporter.Build(
FixtureLoader.LoadCombatInfos(), NoTex, datFont: null);
float width = RetailCombatLayout.FitFavoriteSlots(combat, visibleSlots);
Assert.Equal(expectedRootWidth, width);
Assert.Equal(expectedListWidth, combat.FindElement(
SpellcastingUiController.FavoriteListId)!.Width);
}
[Fact]
public void CombatRoot_EighteenSlotsKeepArrowsAndCastInsideFrame()
{
ImportedLayout combat = LayoutImporter.Build(
FixtureLoader.LoadCombatInfos(), NoTex, datFont: null);
RetailCombatLayout.FitFavoriteSlots(combat);
UiElement group = combat.FindElement(0x100000AAu)!;
UiElement scrollbar = combat.FindElement(SpellcastingUiController.FavoriteScrollbarId)!;
UiElement cast = combat.FindElement(SpellcastingUiController.CastButtonId)!;
Assert.Equal(747f, combat.Root.Width);
Assert.Equal((40f, 622f), (group.Left, group.Width));
Assert.Equal(622f, scrollbar.Width);
Assert.Equal((662f, 75f), (cast.Left, cast.Width));
Assert.Equal(737f, cast.Left + cast.Width);
}
[Fact]
public void ImportedChrome_MountsRootWithoutASecondFrame()
{
@ -41,6 +78,30 @@ public sealed class RetailWindowFrameTests
Assert.Equal(40f, content.MinWidth);
}
[Fact]
public void ImportedChrome_CanPreserveFixedHudDesktopAnchors()
{
var root = new UiRoot { Width = 1920, Height = 1080 };
var content = new UiPanel { Width = 1730, Height = 90 };
RetailWindowHandle handle = RetailWindowFrame.Mount(
root,
content,
NoTex,
new RetailWindowFrame.Options
{
WindowName = "combat",
Chrome = RetailWindowChrome.Imported,
Left = 0f,
Top = 980f,
OuterAnchors = AnchorEdges.Left | AnchorEdges.Bottom,
});
Assert.Equal(
AnchorEdges.Left | AnchorEdges.Bottom,
handle.OuterFrame.Anchors);
}
[Fact]
public void NineSlice_UsesCroppedContentAndDatHeightConstraints()
{