using System; using System.Collections.Generic; namespace AcDream.App.UI; /// /// A toolbar-frame variant that snaps its height between two stops — collapsed (row 2 hidden) and /// expanded (row 2 shown) — and toggles a set of "second-row" elements to match. Resized via the /// bottom edge (the mount sets = Bottom); each tick it resolves /// the dragged height to the nearer stop so the frame always rests collapsed or expanded — never a /// half-row. Toolkit UX (keystone.dll has no decomp; the dat stacks both rows always) — see IA-17. /// public sealed class UiCollapsibleFrame : UiNineSlicePanel { public UiCollapsibleFrame(Func resolve) : base(resolve) { } public float CollapsedHeight { get; set; } public float ExpandedHeight { get; set; } /// Elements shown only when expanded (the row-2 slot lists). Hidden when collapsed. public IReadOnlyList SecondRow { get; set; } = Array.Empty(); /// True when the frame is at (or nearer) the expanded stop. public bool IsExpanded => Height >= (CollapsedHeight + ExpandedHeight) * 0.5f; protected override void OnTick(double deltaSeconds) { base.OnTick(deltaSeconds); if (ExpandedHeight <= CollapsedHeight) return; // not configured yet — no snap bool expanded = IsExpanded; Height = expanded ? ExpandedHeight : CollapsedHeight; // snap the dragged height to a stop for (int i = 0; i < SecondRow.Count; i++) SecondRow[i].Visible = expanded; } /// Test hook — OnTick is protected. Drives one snap+visibility reconcile. internal void TickForTest(double dt) => OnTick(dt); }