fix(ui): preserve cropped chat and button faces

This commit is contained in:
Erik 2026-07-10 18:11:14 +02:00
parent d825572e31
commit accacecafe
7 changed files with 168 additions and 8 deletions

View file

@ -483,11 +483,41 @@ public abstract class UiElement
Left = x; Top = y; Width = w; Height = h;
}
/// <summary>Forget the captured anchor margins so the next <see cref="ApplyAnchor"/>
/// re-captures them from the CURRENT rect. Call after manually repositioning/resizing
/// an anchored element at runtime (e.g. reflowing the chat input when the channel
/// button width changes) so the new rect becomes the anchor baseline.</summary>
internal void ResetAnchorCapture() => _anchorCaptured = false;
/// <summary>
/// Make the current geometry the new layout baseline after an intentional
/// controller/runtime change. Compatibility anchors recapture their margins on
/// the next layout pass; imported raw-edge policies rebase immediately against
/// the current parent rect.
/// </summary>
internal void ResetAnchorCapture()
{
_anchorCaptured = false;
if (LayoutPolicy is null || Parent is null) return;
LayoutPolicy.Rebase(
UiPixelRect.FromPositionAndSize(
(int)Left,
(int)Top,
(int)Width,
(int)Height),
UiPixelRect.FromPositionAndSize(
0,
0,
(int)Parent.Width,
(int)Parent.Height));
}
/// <summary>
/// Rebase each immediate child after a host deliberately changes this element's
/// design extent. This is used when a production DAT root contains auxiliary
/// space that is cropped by its retail window mount; descendants must reflow
/// from the mounted content rect, not from the uncropped LayoutDesc display box.
/// </summary>
internal void RebaseChildLayoutBaselines()
{
foreach (var child in _children)
child.ResetAnchorCapture();
}
/// <summary>Walk up to the owning <see cref="UiRoot"/> (the top of the tree), or null
/// if this element is not attached. Lets a widget reach focus/capture services — e.g.