fix(ui): retain character sublayout reflow

This commit is contained in:
Erik 2026-07-10 18:20:11 +02:00
parent accacecafe
commit f684f874df
2 changed files with 64 additions and 9 deletions

View file

@ -447,16 +447,20 @@ public static class CharacterStatController
? FindInSubtree(contentPage, static el => HasDatElementId(el, ListBoxId))
: null)
?? layout.FindElement(ListBoxId);
if (statList is not null)
// Imported character nodes already carry the exact raw-edge policy from
// the 337px base sublayout into the 575px mounted page. Only synthetic/
// legacy widgets need compatibility anchors; assigning Anchors on an
// imported node deliberately clears its UiLayoutPolicy.
if (statList is not null && statList.LayoutPolicy is null)
statList.Anchors = AnchorEdges.Left | AnchorEdges.Top | AnchorEdges.Bottom;
if (layout.Root is { } stretchRoot)
{
SetAnchorsAllById(stretchRoot, ListScrollbarId, AnchorEdges.Left | AnchorEdges.Top | AnchorEdges.Bottom);
SetAnchorsAllById(stretchRoot, ListDividerId, AnchorEdges.Left | AnchorEdges.Bottom);
SetAnchorsAllById(stretchRoot, FooterStateAId, AnchorEdges.Left | AnchorEdges.Bottom);
SetAnchorsAllById(stretchRoot, FooterStateBId, AnchorEdges.Left | AnchorEdges.Bottom);
SetAnchorsAllById(stretchRoot, FooterStateCId, AnchorEdges.Left | AnchorEdges.Bottom);
SetCompatibilityAnchorsAllById(stretchRoot, ListScrollbarId, AnchorEdges.Left | AnchorEdges.Top | AnchorEdges.Bottom);
SetCompatibilityAnchorsAllById(stretchRoot, ListDividerId, AnchorEdges.Left | AnchorEdges.Bottom);
SetCompatibilityAnchorsAllById(stretchRoot, FooterStateAId, AnchorEdges.Left | AnchorEdges.Bottom);
SetCompatibilityAnchorsAllById(stretchRoot, FooterStateBId, AnchorEdges.Left | AnchorEdges.Bottom);
SetCompatibilityAnchorsAllById(stretchRoot, FooterStateCId, AnchorEdges.Left | AnchorEdges.Bottom);
}
UiScrollbar? skillScrollbar = PrepareSkillScrollbar(layout, contentPage, statList, spriteResolve);
@ -1637,12 +1641,19 @@ public static class CharacterStatController
// ── Helpers ──────────────────────────────────────────────────────────────
private static void SetAnchorsAllById(UiElement node, uint targetId, AnchorEdges anchors)
private static void SetCompatibilityAnchorsAllById(
UiElement node,
uint targetId,
AnchorEdges anchors)
{
if (node is UiDatElement d && d.ElementId == targetId)
if (node is UiDatElement d
&& d.ElementId == targetId
&& node.LayoutPolicy is null)
{
node.Anchors = anchors;
}
foreach (var child in node.Children)
SetAnchorsAllById(child, targetId, anchors);
SetCompatibilityAnchorsAllById(child, targetId, anchors);
}
/// <summary>Depth-first search of <paramref name="node"/> and its descendants.