fix(ui): keep spellbook tab captions above chrome
This commit is contained in:
parent
c918ccea06
commit
16eb4844c1
4 changed files with 91 additions and 1 deletions
|
|
@ -165,6 +165,7 @@ public sealed class UiText : UiElement, IUiDatStateful
|
|||
private ElementInfo? _datInfo;
|
||||
private uint _activeRetailStateId = UiStateInfo.DirectStateId;
|
||||
private string _activeDatStateName = "";
|
||||
private bool _drawTextAfterChildren;
|
||||
|
||||
// ── Selection state ──────────────────────────────────────────────────
|
||||
private Pos? _selAnchor; // where the drag started
|
||||
|
|
@ -205,10 +206,25 @@ public sealed class UiText : UiElement, IUiDatStateful
|
|||
internal void ConfigureDatState(ElementInfo info)
|
||||
{
|
||||
_datInfo = info;
|
||||
// Retail spellbook tabs are UIElement_Text parents whose Open/Closed
|
||||
// PassToChildren states drive three authored chrome pieces. In retail's
|
||||
// software surface those pieces form the tab background while the text
|
||||
// remains the foreground. Our retained renderer submits parent and child
|
||||
// sprites into one painter-ordered batch, so submit only the glyph content
|
||||
// in the parent's foreground pass after those chrome children.
|
||||
_drawTextAfterChildren = false;
|
||||
foreach (UiStateInfo state in info.States.Values)
|
||||
{
|
||||
if (!state.PassToChildren) continue;
|
||||
_drawTextAfterChildren = true;
|
||||
break;
|
||||
}
|
||||
_activeRetailStateId = info.EffectiveDefaultStateId();
|
||||
ApplyDatState(_activeRetailStateId, propagate: false);
|
||||
}
|
||||
|
||||
internal bool DrawTextAfterChildren => _drawTextAfterChildren;
|
||||
|
||||
public bool TrySetRetailState(uint stateId)
|
||||
=> ApplyDatState(stateId, propagate: true);
|
||||
|
||||
|
|
@ -307,6 +323,18 @@ public sealed class UiText : UiElement, IUiDatStateful
|
|||
// submitted first → text on top.
|
||||
ctx.DrawFill(0, 0, Width, Height, BackgroundColor);
|
||||
|
||||
if (!_drawTextAfterChildren)
|
||||
DrawText(ctx);
|
||||
}
|
||||
|
||||
protected override void OnDrawAfterChildren(UiRenderContext ctx)
|
||||
{
|
||||
if (_drawTextAfterChildren)
|
||||
DrawText(ctx);
|
||||
}
|
||||
|
||||
private void DrawText(UiRenderContext ctx)
|
||||
{
|
||||
// Static centered single-line mode (vitals cur/max numbers etc.): draw the first
|
||||
// line centered H+V (or H+Top/Bottom per VerticalJustify) with the SAME formula
|
||||
// UIElement_Meter used for its label, then skip the scroll/selection machinery entirely.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue