fix(ui): preserve cropped chat and button faces
This commit is contained in:
parent
d825572e31
commit
accacecafe
7 changed files with 168 additions and 8 deletions
|
|
@ -232,6 +232,7 @@ public sealed class ChatWindowController
|
|||
float oldTop = bar.Top;
|
||||
bar.Top = 0f; // pull up to the panel top (resize-bar reclaim)
|
||||
bar.Height = bar.Height + oldTop;
|
||||
bar.ResetAnchorCapture();
|
||||
bar.Model = c.Transcript.Scroll;
|
||||
bar.SpriteResolve = resolve;
|
||||
bar.TrackSprite = TrackSprite;
|
||||
|
|
@ -308,6 +309,7 @@ public sealed class ChatWindowController
|
|||
// just LEFT of the scrollbar column — shift it one button-width left.
|
||||
if (track is not null)
|
||||
maxMinEl.Left = track.Left - maxMinEl.Width;
|
||||
maxMinEl.ResetAnchorCapture();
|
||||
maxMinEl.OnClick = c.ToggleMaximize;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -151,9 +151,10 @@ public sealed class UiButton : UiElement, IUiGlobalTimeListener, IUiDatStateful
|
|||
_resolve = resolve;
|
||||
ClickThrough = false; // buttons are interactive — opt OUT of click-through
|
||||
|
||||
foreach (uint stateId in info.States.Keys)
|
||||
if (stateId != UiStateInfo.DirectStateId)
|
||||
_availableStates.Add(stateId);
|
||||
// Visual transitions can select only states with an actual button face.
|
||||
// Retail layouts commonly declare an empty Normal_pressed descriptor while
|
||||
// supplying art only for Normal/Highlight. Treating that property-only state
|
||||
// as drawable briefly blanks the button during mouse-down.
|
||||
foreach (string stateName in info.StateMedia.Keys)
|
||||
if (UiButtonStateMachine.TryStateId(stateName, out uint stateId))
|
||||
_availableStates.Add(stateId);
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue