A Civilization-style strategy game about governing Israel from 15 May 1948. Real ministers, real map, every fact sourced. Unity + deterministic C# sim.
UI: the HUD holds at the Settings scale choices, 125% and 150% (carries #1135 by Agam; refs #40) (#1853)
Eyal Golandd023ad77f13
diff --git a/changelog.d/1135-ui-large-scales.md b/changelog.d/1135-ui-large-scales.mdnew file mode 100644index 000000000..3e806aa5d--- /dev/null+++ b/changelog.d/1135-ui-large-scales.md@@ -0,0 +1,14 @@+- The HUD holds at the Settings screen's 125% and 150% UI scales (#40): below the smallest window the 100% layout is+ tested at (HudPresenter's new hud-tight, set from the panel's logical size; small phone windows reach it too) the+ bar's rows, the icon column and the panels tighten; on the tight three-row window the icon column becomes a row of the+ phone's 60 px discs under the bar (at least 24 px on screen down to 375x667) and a screen takes the window like a+ mobile modal, with the card's backdrop leaving the row's discs clear. The decision card starts right of the tight+ column; the info panel is a scrolling panel capped clear of the bar and the column, and on a phone at 125% or 150% it+ stands above the minimap at the window's width; the Cabinet's side column slims so+ the seats list keeps its room; and the small text keeps its 12 px on-screen floor at every size. The seven layout+ suites that failed at 125%/150% now run at all three scales.+- At 150% on short windows the Cabinet scroll shows seat cards before the house and legend; on phones at 150% the+ half circle fits its column. Desktop half circles and the 100%/125% Cabinet order keep their existing layout.+- The decision card's body scrolls as one (#1853): the text and the options with their effect lines sit in one scroll+ between the pinned head and the pinned foot, so Hide stays inside the card at 150%. A card that fits shows no scroll+ bar, Tab onto an option scrolls it into view, and a new card opens at the top of its text.diff --git a/unity/Assets/Scripts/UI/AdvisorLayout.cs b/unity/Assets/Scripts/UI/AdvisorLayout.csindex 7c30f12d7..36b260ae3 100644--- a/unity/Assets/Scripts/UI/AdvisorLayout.cs+++ b/unity/Assets/Scripts/UI/AdvisorLayout.cs@@ -8,8 +8,9 @@ namespace Statecraft.Game.UI/// <summary>Where the advisor popup goes (spec 7.1), in panel px. One and two rows: the right column's upper part,/// 400 px wide, its top under the "Decision waiting" row whether or not it shows (so it never jumps), its foot 12 px- /// above the minimap. An upright phone (three rows): a sheet from the left column's edge to the window's right edge,- /// under "Decision waiting" and the toast, its foot 12 px above the higher of the info panel and the minimap's label.+ /// above the minimap. An upright phone (three rows): a sheet from the left column's edge (from the side menu's left+ /// edge and under it, where the tight HUD makes the menu a row under the bar) to the window's right edge, under+ /// "Decision waiting" and the toast, its foot 12 px above the higher of the info panel and the minimap's label./// Hebrew: the same place (the HUD does not mirror its panels, Statecraft.uss:943-946).</summary>public static class AdvisorLayout{@@ -26,12 +27,16 @@ namespace Statecraft.Game.UIif (tier != HudTier.ThreeRow)return Rect.MinMaxRect(right - Width, rightColumn.yMin + DecisionRowPx + BelowPx, right, minimap.yMin - GapPx);float top = rightColumn.yMin;+ // On the tight three-row HUD (#40, HudPresenter.TightClass: every phone held upright) the side menu is a row+ // under the bar, not a column: the sheet starts at the row's left edge, under it, not right of it.+ bool menuIsARow = leftColumn.width > leftColumn.height;+ if (menuIsARow) top = Mathf.Max(top, leftColumn.yMax + BelowPx);if (decisionWaiting is Rect d) top = Mathf.Max(top, d.yMax + BelowPx);if (toast is Rect t) top = Mathf.Max(top, t.yMax + BelowPx);float floor = minimap.yMin;if (mapLabel is Rect m) floor = Mathf.Min(floor, m.yMin);if (infoPanel is Rect i) floor = Mathf.Min(floor, i.yMin);- return Rect.MinMaxRect(leftColumn.xMax + GapPx, top, right, floor - GapPx);+ return Rect.MinMaxRect(menuIsARow ? leftColumn.xMin : leftColumn.xMax + GapPx, top, right, floor - GapPx);}/// <summary>The popup's rectangle in its slot: at the top, or at the foot when that keeps it offdiff --git a/unity/Assets/Scripts/UI/CabinetPresenter.cs b/unity/Assets/Scripts/UI/CabinetPresenter.csindex f948e21e9..18b70e4b6 100644--- a/unity/Assets/Scripts/UI/CabinetPresenter.cs+++ b/unity/Assets/Scripts/UI/CabinetPresenter.cs@@ -28,6 +28,7 @@ namespace Statecraft.Game.UI/// <summary>The seat colours: coalition blue and opposition grey, each at least 3:1 against the screen's navy.</summary>public static readonly Color CoalitionColour = new Color32(92, 138, 200, 255), OppositionColour = new Color32(186, 180, 168, 255);+ readonly VisualElement house;readonly VisualElement screen; readonly SimBridge bridge; readonly UiText text; readonly PortraitCatalog? portraits;readonly Button pmCard; readonly System.Action onPm; readonly EventCallback<GeometryChangedEvent> onPmGeometry;string? pmId; VisualElement? pmPortrait;@@ -44,6 +45,7 @@ namespace Statecraft.Game.UIpublic CabinetPresenter(VisualElement root, SimBridge bridge, UiText text, PortraitCatalog? portraits){screen = root.Q<VisualElement>("screen-cabinet"); this.bridge = bridge; this.text = text; this.portraits = portraits;+ house = screen.Q("cabinet-house");pmCard = screen.Q<Button>("seat-" + PrimeMinister);list = screen.Q<ScrollView>("cabinet-seats"); candidates = screen.Q<ScrollView>("cabinet-candidates");FocusScroll.BarsAreNotTabStops(list, candidates); // #41: each bar was an extra Tab stop after the last row@@ -70,6 +72,7 @@ namespace Statecraft.Game.UIpmPortrait?.UnregisterCallback(onPmGeometry); pmPortrait = null;foreach (var e in new[] { side, pmOffices, status }) e.UnregisterCallback(onSideGeometry);if (screen.userData is System.Action) screen.userData = null;+ screen.Q("cabinet-main").Insert(0, house);list.Clear(); candidates.Clear(); pmOffices.Clear(); chips.Clear(); PersonCard.Clear(pmCard);cards.Clear(); rows.Clear(); cardOrder.Clear(); pmOrder.Clear(); pickFor = null; chipsFor = "";hemicycle.Set(new Hemicycle.Group[0], 0);@@ -163,6 +166,8 @@ namespace Statecraft.Game.UIvar grid = Cards(lineup.Where(x => x.Office.Id != PrimeMinister && !HeldByPm(x)));if (!grid.Select(x => x.key).SequenceEqual(cardOrder)){+ // The house may be the last item in this ScrollView. Keep it across a lineup rebuild.+ screen.Q("cabinet-main").Insert(0, house);list.Clear(); cards.Clear();foreach (var (key, seat, _) in grid){@@ -190,6 +195,7 @@ namespace Statecraft.Game.UIreturn text.Format("cabinet.queued", ContentNames.Of(text, person), ContentNames.Of(text, c.Offices.First(o => o.Id == a.Office), person, s.Date));});screen.Q<Label>("cabinet-status").text = string.Join("\n", queued);+ HudPresenter.FitCabinet(screen.parent);}/// <summary>The candidate list's floor (#41 M7): PickFloor where the side column has room; on a shorter one (32:9 isdiff --git a/unity/Assets/Scripts/UI/EventCardPresenter.cs b/unity/Assets/Scripts/UI/EventCardPresenter.csindex 1bf1e229e..7eb955698 100644--- a/unity/Assets/Scripts/UI/EventCardPresenter.cs+++ b/unity/Assets/Scripts/UI/EventCardPresenter.cs@@ -46,7 +46,10 @@ namespace Statecraft.Game.UIreadonly bool hiddenInCapture;/// <summary>Tests: the card is waiting for the start screen to close before it looks up its photograph.</summary>internal bool PhotoWaits => photoWaits;- readonly VisualElement band, head, scroll, options, layer, hudRoot; readonly Label credit, delegateLine;+ readonly VisualElement band, head, options, layer, hudRoot; readonly Label credit, delegateLine;+ /// <summary>The body: the text and the options with their effect lines, which scroll together only when they overflow+ /// the card (#1853); the head above it and the foot with Hide below it stay pinned.</summary>+ readonly ScrollView scroll;readonly Button? endTurn;readonly Button hide, reopen, illustrationSwitch;readonly System.Action onHide, onReopen, onUncovered;@@ -72,6 +75,9 @@ namespace Statecraft.Game.UIstring? focusedFor;/// <summary>The event whose card last raised Opened, so a card already in view never raises it again.</summary>string? openedFor;+ /// <summary>The event the body was last put back to its top for: a new event opens at its text, never part way down+ /// the last card's options (#1853).</summary>+ string? scrolledFor;float appliedWidth = float.NaN;/// <param name="video">The illustration loop's player, or null when video is off (CardVideo.ForcedOff): then the@@ -95,7 +101,7 @@ namespace Statecraft.Game.UI// photograph back when the window grows. A hidden element keeps its old layout, so a band shown again at the// size it was dropped at gets no geometry event of its own; the head below it always moves, so it checks too.head = card.Q<VisualElement>(className: "event-head");- scroll = card.Q<VisualElement>("event-scroll"); options = card.Q<VisualElement>("event-options");+ scroll = card.Q<ScrollView>("event-scroll"); options = card.Q<VisualElement>("event-options");delegateLine = card.Q<Label>("event-delegate");layer = card.parent; hudRoot = root.Q("root") ?? root;endTurn = hudRoot.Q<Button>("end-turn");@@ -223,8 +229,8 @@ namespace Statecraft.Game.UIvar pending = s.PendingEvents.Select(id => c.Events.First(e => e.Id == id)).ToList();var open = pending.Where(e => bridge.QueuedLike(new ChooseEventOption(e.Id, "")) == null).ToList();Shown = open.FirstOrDefault();- if (Shown == null) { collapsedFor = null; openedFor = null; }- if (bridge.Session != session) { session = bridge.Session; collapsedFor = null; focusedFor = null; openedFor = null; }+ if (Shown == null) { collapsedFor = null; openedFor = null; scrolledFor = null; }+ if (bridge.Session != session) { session = bridge.Session; collapsedFor = null; focusedFor = null; openedFor = null; scrolledFor = null; }var shown = !hiddenInCapture && Shown != null && !Collapsed;ScreenNav.Show(card, shown); // #1106: grows in, shrinks awaycard.SetEnabled(shown); // a child of an undisplayed element can still take the focus (#400): a collapsed card's options must not@@ -302,6 +308,7 @@ namespace Statecraft.Game.UIrejoin.AddToClassList("muted"); rejoin.AddToClassList(RejoinClass);options.Add(rejoin);}+ if (scrolledFor != e.Id) { scrolledFor = e.Id; scroll.scrollOffset = UnityEngine.Vector2.zero; }card.Q<Label>("event-count").text = open.Count > 1 ? text.Format(open.Count == 2 ? "event.more_one" : "event.more", open.Count - 1) : "";if (shown && !photoWaits && layer.enabledInHierarchy && openedFor != e.Id) { openedFor = e.Id; Opened?.Invoke(e.Id); }if (shown && focusedFor != e.Id) FocusCard(e.Id, force: false);@@ -403,6 +410,10 @@ namespace Statecraft.Game.UIvar photo = shown ? current : null;var display = photo != null ? DisplayStyle.Flex : DisplayStyle.None;band.style.display = display; credit.style.display = display;+ // While the photograph shows it alone gives way (flex-shrink 1000): with the body's own flex-shrink 1 beside it,+ // the body took a sliver of the shortfall, and once rounded that was a device pixel of scroll on a card that fits+ // (1366x657 at 100%, #1853). Dropped, the body shrinks and scrolls as the stylesheet says.+ scroll.style.flexShrink = photo != null ? 0f : (StyleFloat)StyleKeyword.Null;band.style.backgroundImage = photo == null ? (StyleBackground)StyleKeyword.None : new StyleBackground(photo.Value.image);band.tooltip = photo?.alt ?? "";PhotoAlt = photo?.alt;diff --git a/unity/Assets/Scripts/UI/FocusScroll.cs b/unity/Assets/Scripts/UI/FocusScroll.csindex 5136488c2..204e96460 100644--- a/unity/Assets/Scripts/UI/FocusScroll.cs+++ b/unity/Assets/Scripts/UI/FocusScroll.cs@@ -89,13 +89,13 @@ namespace Statecraft.Game.UI/// <summary>The views whose bar is the only way a keyboard player can scroll them, so it stays in the Tab/// order. `KeyScroll` gives PageUp, PageDown, Home and End to the open screen's main view and to the decision- /// card's text, but it has no target for these three (`KeyScroll.MainViews`), and `GameRoot` turns those keys+ /// card's text, but it has no target for these views (`KeyScroll.MainViews`), and `GameRoot` turns those keys/// off entirely while the turn report or the end screen is open (`GameRoot`, the `report?.IsOpen != true &&/// end?.IsOpen != true` guard). Their rows are plain labels, so Tab reaches nothing inside them either. Taking/// their bar out would leave no way at all to scroll them once they overflow, which is worse than the stray/// stop. Giving `KeyScroll` a route to these is the better answer and is its own change; until then they stay/// out of the sweep (#41 K6, the owner's review).</summary>- static readonly string[] OnlyReachableByTheirBar = { "turn-report-rows", "end-screen-rows", "capture-scroll" };+ static readonly string[] OnlyReachableByTheirBar = { "turn-report-rows", "end-screen-rows", "capture-scroll", "info-panel" };/// <summary>Takes every scroll bar under <paramref name="root"/> out of the Tab order (accessibility audit, #41,/// K3 widened), except the few in <see cref="OnlyReachableByTheirBar"/>. #1453 did the Cabinet's two views,diff --git a/unity/Assets/Scripts/UI/HudPresenter.cs b/unity/Assets/Scripts/UI/HudPresenter.csindex 6f773edd1..54ae5e127 100644--- a/unity/Assets/Scripts/UI/HudPresenter.cs+++ b/unity/Assets/Scripts/UI/HudPresenter.cs@@ -11,6 +11,11 @@ namespace Statecraft.Game.UIreadonly VisualElement root; readonly SimBridge bridge; readonly UiText text;readonly Button endTurn; readonly System.Action onEndTurn;readonly VisualElement bar, hudRoot, nav;+ /// <summary>The info panel and the side menu, for the tight HUD's info-panel caps (FitInfoPanel, #40).</summary>+ readonly VisualElement? infoPanel, railColumn;+ /// <summary>The minimap and its border caption, which a lifted info panel stands above, and "Decision waiting" and the+ /// toast at the top of the right column, which it stays under (FitInfoPanel, #40).</summary>+ readonly VisualElement? minimap, mapLayer, decisionWaiting, captureWaiting, toast;readonly System.Collections.Generic.List<VisualElement> meters;/// <summary>Each meter's element and its caption in the UI's language, for the words in its tooltip (#398).</summary>readonly System.Collections.Generic.Dictionary<string, (VisualElement element, string caption)> said =@@ -52,6 +57,38 @@ namespace Statecraft.Game.UI/// wrapped to two lines, #380), then the screen buttons and End Turn (Statecraft.uss .hud-three-row; #210).</summary>public const float ThreeRowBelowPx = 1100f;public const string ThreeRowClass = "hud-three-row";++ /// <summary>The tight HUD (#40, the UI scale's 125% and 150%): a small logical window (1920x1080 at 150% is 1280x720+ /// logical; a 360x800 phone at 150% is about 517 px wide) gives the stacked bar, the icon column and the panels their tight+ /// sizes (Statecraft.uss .hud-tight). Small phone windows at 100% reach these bounds too, so the tight HUD changes+ /// only layout sizes: the small text keeps the same screen-pixel floor (SmallTextSize) in and out of it.</summary>+ public const string TightClass = "hud-tight";+ // With the panel's match 0.5, the ratio sum is 2 at 100%, 1.6 at 125%, and 1.33 at 150%.+ public const string Scale150Class = "hud-scale-150", CabinetCardsFirstClass = "cabinet-cards-first", CabinetPhone150Class = "cabinet-phone-150";+ public const float TightBelowHeightPx = 1200f, TightAndBelowWidthPx = 1700f, TightBelowWidthPx = 960f;+ /// <summary>Also tight below this logical height at a scale choice, at any width: 2560x1080 at 125% is 1755x740+ /// logical, wider than TightAndBelowWidthPx and too short for a city's info panel, which rose above the window.+ /// Some windows at 100% are as short (5120x1440 is 2560x720 logical, 1280x420 is 2424x795), so this applies only+ /// at a scale choice: the panel scales by the plain mean of its two ratios to the reference resolution (match+ /// 0.5), so at 100% every window's logical width / 1920 + height / 1080 is exactly 2, and at 125% it is 1.6, at+ /// 150% 1.33 (Settings sets the reference resolution to 1920x1080 / the scale).</summary>+ public const float TightScaledBelowHeightPx = 800f;+ /// <summary>Statecraft.uss .hud-tight.hud-three-row .top-bar height: the tight three-row bar's rows.</summary>+ public const float TightThreeRowBarPx = 200f;+ /// <summary>Statecraft.uss .hud-tight.hud-two-row .top-bar height: a floor the rows can outgrow when the text floor+ /// raises the plate (960x600 at 125%: a 109 px plate over End Turn's 64 px row), as the three-row bar's (PlaceUnderBar).</summary>+ public const float TightTwoRowBarPx = 172f;+ /// <summary>The tight info panel's top keeps this gap below the lower of the bar and the side menu (FitInfoPanel).</summary>+ public const float TightInfoGapPx = 4f;+ /// <summary>On the tight three-row window the info panel's right edge keeps this far from the window's: the minimap's+ /// 222 px (Statecraft.uss .minimap), its 16 px inset and a 32 px gap (FitInfoPanel).</summary>+ public const float TightThreeRowMinimapClearPx = 270f;+ /// <summary>On the tight three-row window, when that clearance leaves the info panel narrower than this (the hex's sign+ /// and a line of its facts; a phone at 125% or 150%, 163 to 280 px), the panel stands above the minimap and its+ /// caption instead, as wide as the window less its insets (FitInfoPanel). Phones at 100% keep 422 px or more.</summary>+ public const float TightInfoBesideMinPx = 360f;+ /// <summary>The lifted info panel's gap above the minimap and its caption (FitInfoPanel).</summary>+ public const float TightInfoAbovePx = 12f;/// <summary>On the one-row bar, when the meters leave enough room, the bar gets RoomyClass: promo-sized icons (38 px)/// and values (25 px) (Statecraft.uss .top-bar--roomy). It turns on only when the measured spare room covers the/// predicted growth (RoomyGrowth) plus SpareShare, and off when the spare room falls below SpareShare, so it never@@ -110,6 +147,7 @@ namespace Statecraft.Game.UIpublic const float PlateSidePx = 18f, PlateEdgePx = 9f;readonly VisualElement turnBox;readonly IVisualElementScheduledItem floorCheck;+ readonly EventCallback<GeometryChangedEvent> onRootGeometry;float smallTextSize = SmallTextPx;bool captionFitWrap;@@ -152,6 +190,17 @@ namespace Statecraft.Game.UIbar = root.Q<VisualElement>("top-bar");hudRoot = root.Q<VisualElement>("root");bar.RegisterCallback<GeometryChangedEvent>(OnBarGeometry);+ infoPanel = root.Q<VisualElement>("info-panel");+ railColumn = root.Q<VisualElement>(RailName);+ infoPanel?.RegisterCallback<GeometryChangedEvent>(OnCapGeometry); // shown again after a screen, or resized+ railColumn?.RegisterCallback<GeometryChangedEvent>(OnCapGeometry); // moved down by a grown three-row bar+ minimap = root.Q<VisualElement>("minimap");+ mapLayer = root.Q<VisualElement>("map-layer");+ mapLayer?.RegisterCallback<GeometryChangedEvent>(OnCapGeometry); // the border caption shown or hidden+ minimap?.RegisterCallback<GeometryChangedEvent>(OnCapGeometry); // moved with the right column+ decisionWaiting = root.Q<VisualElement>("event-reopen"); captureWaiting = root.Q<VisualElement>("capture-reopen");+ toast = root.Q<VisualElement>("toast");+ foreach (var e in new[] { decisionWaiting, captureWaiting, toast }) e?.RegisterCallback<GeometryChangedEvent>(OnCapGeometry); // shown or hiddenmeters = root.Q<VisualElement>("meters").Children().ToList();nav = root.Q<VisualElement>("nav");foreach (var m in meters) m.RegisterCallback<GeometryChangedEvent>(OnMeterGeometry);@@ -193,6 +242,9 @@ namespace Statecraft.Game.UIApplyTextFloor();floorCheck = root.schedule.Execute(ApplyTextFloor).Every(500);SetCompact(bar.layout.width); // the bar may already be laid out (the loading screen shows it) and never resize+ onRootGeometry = _ => SetTight(); // the window, not only the bar, can cross the tight bounds+ hudRoot.RegisterCallback(onRootGeometry);+ root.Q(className: "hemicycle-box")?.RegisterCallback<GeometryChangedEvent>(OnCabinetGeometry);bridge.Changed += Render;Render();}@@ -212,6 +264,20 @@ namespace Statecraft.Game.UIif (dateRow != null) { dateRow.style.flexDirection = StyleKeyword.Null; if (dateRow.parent != null) PadPlate(dateRow.parent, false); }bridge.Changed -= Render; endTurn.clicked -= onEndTurn; endTurn.generateVisualContent -= PaintHourglass;bar.UnregisterCallback<GeometryChangedEvent>(OnBarGeometry);+ hudRoot.UnregisterCallback(onRootGeometry);+ root.Q(className: "hemicycle-box")?.UnregisterCallback<GeometryChangedEvent>(OnCabinetGeometry);+ hudRoot.RemoveFromClassList(TightClass);+ hudRoot.RemoveFromClassList(Scale150Class);+ hudRoot.RemoveFromClassList(CabinetPhone150Class);+ hudRoot.RemoveFromClassList(CabinetCardsFirstClass);+ FitCabinet(root);+ SizeTightValues(); // off the tight HUD: the values' sizes go back to the stylesheet's+ infoPanel?.UnregisterCallback<GeometryChangedEvent>(OnCapGeometry);+ railColumn?.UnregisterCallback<GeometryChangedEvent>(OnCapGeometry);+ mapLayer?.UnregisterCallback<GeometryChangedEvent>(OnCapGeometry);+ minimap?.UnregisterCallback<GeometryChangedEvent>(OnCapGeometry);+ foreach (var e in new[] { decisionWaiting, captureWaiting, toast }) e?.UnregisterCallback<GeometryChangedEvent>(OnCapGeometry);+ if (infoPanel != null) { infoPanel.style.maxHeight = StyleKeyword.Null; infoPanel.style.maxWidth = StyleKeyword.Null; infoPanel.style.bottom = StyleKeyword.Null; }dateRow?.parent?.UnregisterCallback<GeometryChangedEvent>(OnPlateGeometry);foreach (var m in meters) m.UnregisterCallback<GeometryChangedEvent>(OnMeterGeometry);bar.RemoveFromClassList(RoomyClass);@@ -236,6 +302,9 @@ namespace Statecraft.Game.UI// The rows' height does not depend on the bar's (RowsHeight), so this settles in one pass.void OnRowGeometry(GeometryChangedEvent e) => PlaceUnderBar();+ void OnCapGeometry(GeometryChangedEvent e) => FitInfoPanel();+ void OnCabinetGeometry(GeometryChangedEvent e) => FitCabinet(root);+/// <summary>Roomy only on the one-row bar with icons; see RoomyClass.</summary>void UpdateRoomy(){@@ -372,16 +441,26 @@ namespace Statecraft.Game.UI/// it move by what it grew or shrank: a top margin (negative when it shrank), not a top, so the stylesheet's other/// placements (the toast at the bottom beside a wide screen) still apply. Set here, not as height: auto in the stylesheet:/// there Yoga sized the wrapping bar as if each quarter-width meter took a line of its own (about 1300 px). Its items'- /// geometry events re-run this (OnRowGeometry), and so does SetCompact.</summary>+ /// geometry events re-run this (OnRowGeometry), and so does SetCompact. The tight two-row bar (#40) grows the same way+ /// past its TightTwoRowBarPx when the text floor makes its rows taller, and never shrinks under it.</summary>void PlaceUnderBar(){// A hidden bar (the start screen) moves nothing: the start screen's toast keeps its own top (review of #859).- var rows = hudRoot.ClassListContains(ThreeRowClass) && bar.resolvedStyle.display != DisplayStyle.None ? RowsHeight() : 0f;- var grown = rows > 0f ? rows - ThreeRowBarPx : 0f; // NaN before layout or 0 off the three-row bar: the stylesheet's height+ var threeRow = hudRoot.ClassListContains(ThreeRowClass);+ var tight = hudRoot.ClassListContains(TightClass);+ // The tight two-row bar only grows past its floor (#40): its rows never came in shorter than its 172 px.+ var tightTwoRow = tight && !threeRow && hudRoot.ClassListContains(TwoRowClass);+ var basePx = threeRow ? (tight ? TightThreeRowBarPx : ThreeRowBarPx) : TightTwoRowBarPx;+ var rows = (threeRow || tightTwoRow) && bar.resolvedStyle.display != DisplayStyle.None ? RowsHeight() : 0f;+ if (tightTwoRow && rows < basePx) rows = 0f;+ var grown = rows > 0f ? rows - basePx : 0f; // NaN before layout or 0 off these bars: the stylesheet's heightvar fit = UnityEngine.Mathf.Abs(grown) > 0.5f;bar.style.height = fit ? new StyleLength(rows) : new StyleLength(StyleKeyword.Null);var margin = fit ? new StyleLength(grown) : new StyleLength(StyleKeyword.Null);- foreach (var e in underBar) e.style.marginTop = margin;+ // On the tight three-row window a screen takes the window (Statecraft.uss, the mobile-modal pattern): the bar's+ // growth does not move it, or it would start part-way down the bar it covers.+ var screenTakesWindow = threeRow && hudRoot.ClassListContains(TightClass);+ foreach (var e in underBar) e.style.marginTop = screenTakesWindow && e.ClassListContains("screen") ? new StyleLength(StyleKeyword.Null) : margin;}/// <summary>The height the bar's rows take: each row's tallest item (its children laid out in the flow, grouped by the@@ -412,6 +491,139 @@ namespace Statecraft.Game.UIstatic float DevicePixelRatio() => 1f;#endif+ /// <summary>Tight below the TightClass bounds, read from the root's laid-out size, so it follows the panel's scale+ /// by itself. The text floor does not depend on it. The info panel's caps are re-fit on every call, since the+ /// window can change size inside one tier.</summary>+ void SetTight()+ {+ var r = root.worldBound;+ if (float.IsNaN(r.width) || r.width <= 0f) return;+ var scaled = r.width / 1920f + r.height / 1080f < 1.9f; // see TightScaledBelowHeightPx+ var tight = r.height < TightBelowHeightPx && r.width < TightAndBelowWidthPx || r.width < TightBelowWidthPx+ || scaled && r.height < TightScaledBelowHeightPx;+ var changed = tight != hudRoot.ClassListContains(TightClass);+ hudRoot.EnableInClassList(TightClass, tight);+ if (changed) ScreenNav.DisableCovered(hudRoot);+ var ratioSum = r.width / 1920f + r.height / 1080f;+ var scale150 = ratioSum < 1.4f;+ hudRoot.EnableInClassList(Scale150Class, scale150);+ // Use the existing phone breakpoint at its 100% equivalent width: desktops can enter three rows at 150% too.+ hudRoot.EnableInClassList(CabinetPhone150Class, scale150 && r.width * 2f / ratioSum < ThreeRowBelowPx);+ hudRoot.EnableInClassList(CabinetCardsFirstClass, tight && scale150 && r.height < TightScaledBelowHeightPx);+ FitCabinet(root);+ if (changed) PlaceUnderBar(); // the three-row bar's base height and the screens' margin depend on the tight class+ SizeTightValues();+ FitInfoPanel();+ }++ // The existing seat ScrollView owns both the cards and (last) the house only at 150% on short windows.+ // Moving the same elements preserves the existing card instances and handlers; leaving the mode restores the UXML order.+ internal static void FitCabinet(VisualElement root)+ {+ var hud = root.Q("root") ?? root;+ var house = root.Q("cabinet-house");+ var main = root.Q("cabinet-main");+ var seats = root.Q<ScrollView>("cabinet-seats");+ if (house == null || main == null || seats == null) return;+ var first = hud.ClassListContains(CabinetCardsFirstClass);+ // hierarchy.parent: a ScrollView child's logical parent is the ScrollView, never its content container, so+ // comparing .parent re-added the house on every call, and its geometry callback looped the layout.+ if (first && house.hierarchy.parent != seats.contentContainer)+ {+ seats.Add(house); seats.scrollOffset = UnityEngine.Vector2.zero;+ }+ else if (!first && house.hierarchy.parent != main)+ {+ main.Insert(0, house); seats.scrollOffset = UnityEngine.Vector2.zero;+ }+ var box = house.Q(className: "hemicycle-box");+ if (box == null) return;+ var phone150 = hud.ClassListContains(TightClass) && hud.ClassListContains(ThreeRowClass) && hud.ClassListContains(CabinetPhone150Class);+ var width = box.layout.width;+ var height = phone150 && width > 0f && !float.IsNaN(width)+ ? new StyleLength(UnityEngine.Mathf.Min(320f, width) * 168f / 320f) : new StyleLength(StyleKeyword.Null);+ if (box.style.height != height) box.style.height = height;+ }++ /// <summary>The tight three-row bar's values and changes (#40). Statecraft.uss gives them the narrow bar's 22 px and+ /// 15 px, for a phone held upright at 100%, where 22 px is 9 to 11 screen px. At 125% and 150% the same phone's+ /// quarter-width meter is narrower in panel px, and the Hebrew "IL -123.4m" no longer fit it at 360x800 (TopBarTests).+ /// So each takes the size that keeps it at the 12 px screen floor (FlooredTextSize of the tight bar's 16 px and 12 px),+ /// no larger than the stylesheet's: 22 px and 15 px on every phone at 100%, 17 to 21 px at 125% and 150%.</summary>+ void SizeTightValues()+ {+ var p = root.panel;+ var on = p != null && hudRoot.ClassListContains(TightClass) && hudRoot.ClassListContains(ThreeRowClass);+ var ratio = p == null ? 0f : ScreenPxPerPanelPx(p);+ StyleLength Size(float tightPx, float maxPx) =>+ on ? new StyleLength(UnityEngine.Mathf.Min(maxPx, FlooredTextSize(tightPx, ratio))) : new StyleLength(StyleKeyword.Null);+ var value = Size(TightValuePx, TightThreeRowValuePx); var delta = Size(TightDeltaPx, TightThreeRowDeltaPx);+ foreach (var m in meters)+ {+ foreach (var l in m.Query<Label>(className: "meter-value").ToList()) if (l.style.fontSize != value) l.style.fontSize = value;+ foreach (var l in m.Query<Label>(className: "meter-delta").ToList()) if (l.style.fontSize != delta) l.style.fontSize = delta;+ }+ }+ // Statecraft.uss .hud-tight .meter-value / .meter-delta, and the .hud-tight.hud-three-row sizes.+ const float TightValuePx = 16f, TightDeltaPx = 12f, TightThreeRowValuePx = 22f, TightThreeRowDeltaPx = 15f;++ /// <summary>The info panel's caps on a tight window (#40). They are set here from laid-out bounds because the USS+ /// importer of the pinned Unity 6000.3 has no calc() ("Unknown function calc"). The panel's top stays+ /// TightInfoGapPx below the lower of the bar and the side menu (its column, or its rail row on the three-row bar),+ /// so a bar or rail the text floor grows lowers the cap with it; on the tight three-row window its right edge also+ /// keeps TightThreeRowMinimapClearPx from the window's right edge, or, where that leaves it narrower than+ /// TightInfoBesideMinPx, it stands TightInfoAbovePx above the minimap and its border caption, as wide as the window+ /// less its insets. The empty panel's hint keeps the stylesheet's place, which already clears the minimap+ /// (.hud-three-row .info-panel.info-empty). Taller content scrolls (the panel is a ScrollView). The panel is+ /// bottom-anchored, and its bottom is computed here from the minimap's place, not from the panel's own bound, so a+ /// re-fit after its own geometry changes sets the same values and settles at once. Off the tight HUD the caps are+ /// cleared.</summary>+ void FitInfoPanel()+ {+ if (infoPanel == null) return;+ if (!hudRoot.ClassListContains(TightClass))+ {+ infoPanel.style.maxHeight = StyleKeyword.Null; infoPanel.style.maxWidth = StyleKeyword.Null; infoPanel.style.bottom = StyleKeyword.Null;+ return;+ }+ if (infoPanel.resolvedStyle.display == DisplayStyle.None) return; // hidden (a screen is open): re-fit when shown+ var panel = infoPanel.worldBound;+ var window = hudRoot.worldBound;+ var top = bar.resolvedStyle.display != DisplayStyle.None ? bar.worldBound.yMax : window.yMin;+ if (railColumn != null && railColumn.resolvedStyle.display != DisplayStyle.None && railColumn.worldBound.height > 0f)+ top = UnityEngine.Mathf.Max(top, railColumn.worldBound.yMax);+ if (float.IsNaN(top) || float.IsNaN(panel.yMax) || !(panel.width > 0f) || !(window.width > 0f)) return; // not laid out yet: the geometry callbacks come back+ var foot = panel.yMax;+ var width = new StyleLength(StyleKeyword.Null);+ var bottom = new StyleLength(StyleKeyword.Null);+ if (hudRoot.ClassListContains(ThreeRowClass) && !infoPanel.ClassListContains("info-empty"))+ {+ // From the panel's stylesheet left, not its laid-out edge, so a first pass before the window settles cannot+ // decide the place.+ var left = window.xMin + infoPanel.resolvedStyle.left;+ var beside = window.xMax - TightThreeRowMinimapClearPx - left;+ if (beside >= TightInfoBesideMinPx || minimap == null || !(minimap.worldBound.height > 0f)) width = UnityEngine.Mathf.Max(0f, beside);+ else+ {+ var above = minimap.worldBound.yMin;+ if (mapLayer != null && mapLayer.resolvedStyle.display != DisplayStyle.None && mapLayer.worldBound.height > 0f)+ above = UnityEngine.Mathf.Min(above, mapLayer.worldBound.yMin);+ foot = above - TightInfoAbovePx;+ bottom = window.yMax - foot;+ // At the window's width it reaches under the right column's top: it stays under "Decision waiting" and+ // the toast while they show, as the advisor sheet does (AdvisorLayout).+ foreach (var e in new[] { decisionWaiting, captureWaiting, toast })+ if (e != null && e.resolvedStyle.display != DisplayStyle.None && e.worldBound.height > 0f) top = UnityEngine.Mathf.Max(top, e.worldBound.yMax);+ width = UnityEngine.Mathf.Max(0f, window.xMax - EdgeInsetPx - left);+ }+ }+ infoPanel.style.bottom = bottom;+ infoPanel.style.maxWidth = width;+ infoPanel.style.maxHeight = UnityEngine.Mathf.Max(0f, foot - top - TightInfoGapPx);+ }+ /// <summary>Statecraft.uss: the panels' inset from the window's edges (.right-column's right, .info-panel's bottom).</summary>+ const float EdgeInsetPx = 16f;+// Compact raised captions need their intrinsic group width, not the shrunken meter-body allocation.// Security and its level share a row; the fit-triggered two-row tier lets that group wrap.bool CaptionsNeedAnotherRow(float width)@@ -459,6 +671,7 @@ namespace Statecraft.Game.UIhudRoot.EnableInClassList(ThreeRowClass, width < ThreeRowBelowPx);StyleSmallText(raised);PlaceUnderBar();+ SetTight();ScreenNav.DisableCovered(hudRoot); // two rows or one: what an open screen covers changes with it (#400)}diff --git a/unity/Assets/Scripts/UI/InfoPanelPresenter.cs b/unity/Assets/Scripts/UI/InfoPanelPresenter.csindex 7973a3365..73d55f399 100644--- a/unity/Assets/Scripts/UI/InfoPanelPresenter.cs+++ b/unity/Assets/Scripts/UI/InfoPanelPresenter.cs@@ -106,6 +106,10 @@ namespace Statecraft.Game.UISystem.Action<IReadOnlyList<(int q, int r, int turn)>>? showRoute = null, System.Action? clearSelection = null, System.Action<int>? selectPioneer = null){panel = root.Q<VisualElement>("info-panel"); this.bridge = bridge; this.text = text;+ // #40: the panel is a ScrollView, so Game.uxml's filigree frame lands in its scrolled content, inside the padding+ // and clipped by the viewport. Framing the panel needs it on the ScrollView itself, as on the panel before.+ if (panel is ScrollView scroll)+ foreach (var frame in scroll.contentContainer.Children().OfType<UiFrame>().ToList()) scroll.hierarchy.Add(frame);orders = panel.Q<VisualElement>("info-orders");confirmMove = new Button(ConfirmMove) { name = "info-confirm-move" };confirmMove.RegisterCallback<KeyDownEvent>(OnConfirmKey);diff --git a/unity/Assets/Scripts/UI/ScreenNav.cs b/unity/Assets/Scripts/UI/ScreenNav.csindex 0cfd726bb..a7290d418 100644--- a/unity/Assets/Scripts/UI/ScreenNav.cs+++ b/unity/Assets/Scripts/UI/ScreenNav.cs@@ -47,14 +47,15 @@ namespace Statecraft.Game.UIbool start = r.ClassListContains(StartScreenPresenter.OpenClass);bool screen = r.ClassListContains(ScreenOpenClass);bool full = screen && r.ClassListContains(HudPresenter.TwoRowClass);+ bool fullWindow = screen && r.ClassListContains(HudPresenter.TightClass) && r.ClassListContains(HudPresenter.ThreeRowClass);bool outcome = r.ClassListContains(OutcomePresenter.OpenClass) || r.ClassListContains(AdvisorPresenter.OverlayOpenClass); // an End Turn outcome clip covers all but itselfbool end = r.ClassListContains(EndScreenPresenter.OpenClass); // the end screen (#812) covers the HUD and the reportbool report = r.ClassListContains(TurnReportPresenter.OpenClass) || end; // the turn report covers the HUD under itbool modal = (r.ClassListContains(EventCardPresenter.OpenClass) || r.ClassListContains(CaptureDialogPresenter.OpenClass)) && !start && !screen && !outcome && !report;r.EnableInClassList(EventCardPresenter.ModalClass, modal);- r.Q("top-bar")?.SetEnabled(!(start || outcome || report));- r.Q("left-column")?.SetEnabled(!(start || outcome || report)); // the screens' buttons: usable wherever the top bar is- r.Q(CommunityIconsPresenter.ColumnName)?.SetEnabled(!(start || outcome || report)); // Star, Report, Share (#1236): in the same lane+ r.Q("top-bar")?.SetEnabled(!(start || outcome || report || fullWindow));+ r.Q("left-column")?.SetEnabled(!(start || outcome || report || fullWindow)); // the screens' buttons: usable wherever the top bar is+ r.Q(CommunityIconsPresenter.ColumnName)?.SetEnabled(!(start || outcome || report || fullWindow)); // Star, Report, Share (#1236): in the same laner.Q("right-column")?.SetEnabled(!(start || full || modal || outcome || report));bool infoCovered = start || full || modal || outcome || report || r.ClassListContains(WideOpenClass);r.Q("info-panel")?.SetEnabled(!infoCovered);diff --git a/unity/Assets/Tests/EditMode/AdvisorLayoutTests.cs b/unity/Assets/Tests/EditMode/AdvisorLayoutTests.csindex 4d985a6c0..3468f861f 100644--- a/unity/Assets/Tests/EditMode/AdvisorLayoutTests.cs+++ b/unity/Assets/Tests/EditMode/AdvisorLayoutTests.cs@@ -42,6 +42,22 @@ public class AdvisorLayoutTestsAssert.AreEqual(1688f, slot.yMax, "12 px above the higher of the info panel and the minimap's label");}+ /// <summary>#40 (#1135): on the tight three-row HUD the side menu is a row under the bar (Statecraft.uss .hud-tight+ /// .hud-three-row .left-column). The sheet starts at the row's left edge and under it, not right of the row, which would+ /// leave it a strip at the window's right edge.</summary>+ [Test]+ public void OnTheTightPhoneTheSheetStartsUnderTheMenuRow()+ {+ var window = R(0, 0, 792, 1714); // 390x844 at 100%+ var column = R(296, 276, 480, 1422); var row = R(8, 212, 776, 60);+ var minimap = R(554, 1318, 222, 380);+ var slot = AdvisorLayout.Slot(HudTier.ThreeRow, window, column, row, minimap, null, null, null, null);+ Assert.AreEqual(8f, slot.xMin, "from the row's left edge");+ Assert.AreEqual(776f, slot.xMax, "right: 16px");+ Assert.AreEqual(280f, slot.yMin, "8 px under the row (lower than the right column's top)");+ Assert.AreEqual(1306f, slot.yMax, "12 px above the minimap");+ }+[Test]public void PlaceKeepsThePopupInItsSlotAndOffATarget(){diff --git a/unity/Assets/Tests/EditMode/CommunityIconsTests.cs b/unity/Assets/Tests/EditMode/CommunityIconsTests.csindex d55c918f3..c358a793e 100644--- a/unity/Assets/Tests/EditMode/CommunityIconsTests.cs+++ b/unity/Assets/Tests/EditMode/CommunityIconsTests.cs@@ -53,12 +53,13 @@ public class CommunityIconsTests/// <summary>The real Game.uxml on the real PanelSettings at w x h, with the top bar, the side menu, the decision card (open/// when the session has an event), the info panel on the hex given, the minimap and the border caption.</summary>- static IEnumerator Rendered(int w, int h, bool hebrew, GameSession g, (int q, int r)? hex, System.Action<VisualElement> check)+ static IEnumerator Rendered(int w, int h, bool hebrew, GameSession g, (int q, int r)? hex, System.Action<VisualElement> check, int uiScale = 100){var text = hebrew ? He : En;var rt = new RenderTexture(w, h, 0);var ps = Object.Instantiate(AssetDatabase.LoadAssetAtPath<PanelSettings>(UiPaths.Panel));ps.targetTexture = rt;+ if (uiScale != 100) ps.referenceResolution = new Vector2Int(Mathf.RoundToInt(1920f * 100f / uiScale), Mathf.RoundToInt(1080f * 100f / uiScale)); // #40: the panel as the Settings scale choice sets itvar go = new GameObject("CommunityIconsTest");go.SetActive(false);var doc = go.AddComponent<UIDocument>();@@ -141,6 +142,28 @@ public class CommunityIconsTestsAssert.IsEmpty(problems, string.Join("\n", problems));}+ /// <summary>#40, owner decision of 22 Oct 2026 (a condition on #1135): at 150% on a 1280x720 or 1920x1080 window (the tight+ /// HUD) the three icons stay clear of the tightened side menu above them, with a gap, in English and Hebrew.</summary>+ [UnityTest]+ public IEnumerator AtOneHundredFiftyPercentTheIconsClearTheTightSideMenu()+ {+ var problems = new List<string>();+ var g = WithAnEventOpen();+ var lod = C.SettlementHexes.Single(s => s.Id == "lod");+ foreach (var hebrew in new[] { false, true })+ foreach (var (w, h) in new[] { (1280, 720), (1920, 1080) })+ yield return Rendered(w, h, hebrew, g, (lod.Q, lod.R), root =>+ {+ string at = $"{(hebrew ? "he" : "en")} {w}x{h} at 150%";+ if (!root.Q("root").ClassListContains(HudPresenter.TightClass)) problems.Add($"{at}: precondition: the HUD is tight");+ var icons = Hull(Icons.Select(i => root.Q<Button>(i.name)));+ var column = Hull(root.Q("left-column").Query<Button>().ToList());+ TestContext.WriteLine($"{at}: side menu {column}, icons {icons}, gap {icons.yMin - column.yMax:0.0} px");+ if (column.Overlaps(icons) || icons.yMin < column.yMax) problems.Add($"{at}: the icons {icons} overlap the side menu {column}");+ }, 150);+ Assert.IsEmpty(problems, string.Join("\n", problems));+ }+/// <summary>Each icon is a round disc with its own glyph, named in both languages by the Settings button's string (its/// text, drawn clear, and its tooltip); Star opens the repository (a click, Enter or Space), Report and Share open their/// panels, and Close gives the focus back to the icon. Disposed, the icons are unwired.</summary>diff --git a/unity/Assets/Tests/EditMode/ControlTests.cs b/unity/Assets/Tests/EditMode/ControlTests.csindex 1dd33efc6..f96331b32 100644--- a/unity/Assets/Tests/EditMode/ControlTests.cs+++ b/unity/Assets/Tests/EditMode/ControlTests.cs@@ -381,9 +381,19 @@ public class ControlTestsdoc.visualTreeAsset = AssetDatabase.LoadAssetAtPath<VisualTreeAsset>(UiPaths.GameUxml);go.SetActive(true);var root = doc.rootVisualElement;+ // Mirror GameRoot.Begin (GameRoot.cs:244-247): Hebrew uses its own face and layout classes.+ root.Q("root").EnableInClassList(UiLanguage.HebrewClass, lang["ui.lang"] == UiLanguage.Hebrew);+ root.Q("root").RemoveFromClassList("loading");var bridge = new SimBridge(GameSession.New(c, GoldenRun.Seed, Mode.Historical), lang);var hud = new HudPresenter(root, bridge, lang);var card = new EventCardPresenter(root, bridge, lang, null, null);+ // The info panel as the game draws it before a hex is chosen: the hint chip (its presenter, as+ // ArmisticeTests.TheLongestMapLabelFitsBesideTheEventCard). The bare UXML is no game state: every order button+ // and the GDD column shown at once squeeze the text column to 0 px, and a later layout pass can stack the order+ // row over 1300 px tall, so the panel's height depended on how many passes ran before the check.+ var info = new InfoPanelPresenter(root, bridge, lang, new Dictionary<string, string>());+ // GameRoot.cs:585: paragraph direction is applied after the presenters have rendered.+ var direction = lang["ui.lang"] == UiLanguage.Hebrew ? new UiDirection(root, bridge) : null;try{var g = GameSession.New(c, GoldenRun.Seed, Mode.Historical);@@ -393,6 +403,10 @@ public class ControlTestsvar label = root.Q<Label>("map-layer");label.text = text; label.style.display = DisplayStyle.Flex;for (int i = 0; i < 6; i++) yield return null;+ // Fixture guard: without GameRoot's setup the Hebrew text was measured in the Latin face.+ Assert.AreEqual(lang["ui.lang"] == UiLanguage.Hebrew, root.Q("root").ClassListContains(UiLanguage.HebrewClass));+ if (lang["ui.lang"] == UiLanguage.Hebrew)+ Assert.AreEqual(LanguageDirection.RTL, root.Q<Label>("info-title").languageDirection);Rect R(string n) => root.Q(n).worldBound;var lb = label.worldBound; var screen = root.worldBound;string at = $"{lang["ui.lang"]} {w}x{h}";@@ -411,7 +425,7 @@ public class ControlTests// the approved legend alone is about three lines in the 312 px box; with its caption, at most sixAssert.LessOrEqual(size.y, 6 * label.resolvedStyle.fontSize * 1.4f, $"{at}: the label takes more than six lines ({size.y} px)");}- finally { card.Dispose(); hud.Dispose(); Object.DestroyImmediate(go); Object.DestroyImmediate(ps); rt.Release(); Object.DestroyImmediate(rt); }+ finally { direction?.Dispose(); info.Dispose(); card.Dispose(); hud.Dispose(); Object.DestroyImmediate(go); Object.DestroyImmediate(ps); rt.Release(); Object.DestroyImmediate(rt); }}}}diff --git a/unity/Assets/Tests/EditMode/DecisionCardTests.cs b/unity/Assets/Tests/EditMode/DecisionCardTests.csindex b7467525c..e5efe2555 100644--- a/unity/Assets/Tests/EditMode/DecisionCardTests.cs+++ b/unity/Assets/Tests/EditMode/DecisionCardTests.cs@@ -26,12 +26,15 @@ public class DecisionCardTestspublic readonly VisualElement Root; public readonly SimBridge Bridge; public readonly ScreenNav Nav; public readonly EventCardPresenter Card;readonly GameObject go; readonly PanelSettings ps; readonly RenderTexture rt; readonly List<System.IDisposable> owned = new List<System.IDisposable>();- public Rig(int w, int h, string eventId, bool photos = false, UiText? text = null, string? second = null)+ /// <param name="portraits">The real minister portraits, as the game has them (the tallest cards are portrait cards).</param>+ /// <param name="uiScale">The Settings UI scale, set on the panel as UiLayoutTests sets it (#40).</param>+ public Rig(int w, int h, string eventId, bool photos = false, UiText? text = null, string? second = null, bool portraits = false, int uiScale = 100){var t = text ?? Text;rt = new RenderTexture(w, h, 0);ps = Object.Instantiate(AssetDatabase.LoadAssetAtPath<PanelSettings>(UiPaths.Panel));ps.targetTexture = rt;+ if (uiScale != 100) ps.referenceResolution = new Vector2Int(Mathf.RoundToInt(1920f * 100f / uiScale), Mathf.RoundToInt(1080f * 100f / uiScale));go = new GameObject("DecisionCardTest");go.SetActive(false);var doc = go.AddComponent<UIDocument>();@@ -45,7 +48,8 @@ public class DecisionCardTestsowned.Add(new HudPresenter(Root, Bridge, t));Nav = new ScreenNav(Root); owned.Add(Nav);owned.Add(new InfoPanelPresenter(Root, Bridge, t, C.SettlementHexes.ToDictionary(x => x.Id, x => x.Id)));- Card = new EventCardPresenter(Root, Bridge, t, null,+ Card = new EventCardPresenter(Root, Bridge, t,+ portraits ? AssetDatabase.LoadAssetAtPath<PortraitCatalog>("Assets/UI/Portraits/PortraitCatalog.asset") : null,photos ? AssetDatabase.LoadAssetAtPath<EventImageCatalog>("Assets/Resources/EventImageCatalog.asset") : null); owned.Add(Card);}@@ -59,6 +63,8 @@ public class DecisionCardTestspublic Button FirstOption => Root.Q("event-options").Q<Button>();public VisualElement CardElement => Root.Q("event-card");public Button Hide => Root.Q<Button>("event-hide");+ public ScrollView Body => Root.Q<ScrollView>("event-scroll");+ public List<Button> Options => Root.Q("event-options").Query<Button>().ToList();public Button Waiting => Root.Q<Button>("event-reopen");public Focusable? Focused => Root.panel.focusController.focusedElement;public bool Shows(string name) => Root.Q(name).resolvedStyle.display == DisplayStyle.Flex;@@ -515,4 +521,84 @@ public class DecisionCardTests}Assert.IsEmpty(problems, string.Join("\n", problems));}++ // #1853, layout decided by the coordinator overnight (owner asleep), as the Cabinet's cards and house scroll together+ // (26 Oct): the card's body (its text and its options with their effect lines) is one ScrollView between the pinned+ // head and the pinned foot with Hide, and it scrolls only when the body overflows the card's height cap.++ static UiText He => UiText.Parse(AssetDatabase.LoadAssetAtPath<TextAsset>(UiPaths.StringsHebrew).text, "strings.he.yaml");++ static bool InView(VisualElement e, ScrollView view)+ {+ Rect r = e.worldBound, v = view.contentViewport.worldBound;+ return r.yMin >= v.yMin - 0.5f && r.yMax <= v.yMax + 0.5f;+ }++ static bool ScrollerShown(Scroller s) =>+ s.resolvedStyle.display == DisplayStyle.Flex && s.resolvedStyle.visibility == Visibility.Visible && s.worldBound.height > 0f;++ /// <summary>#1853, no change for a normal card: at 100% on a 1080p window a short card's body fits, so it shows no+ /// scroll bar, has no scroll range and sits at its top, and every option shows whole, in English and in Hebrew.</summary>+ [UnityTest]+ public IEnumerator AShortCardDoesNotScrollAt100([Values(false, true)] bool hebrew)+ {+ using var r = new Rig(1920, 1080, "law_of_return", photos: true, text: hebrew ? He : Text, portraits: true);+ yield return Frames(5);+ var where = hebrew ? "he" : "en";+ var body = r.Body;+ Assert.LessOrEqual(body.contentContainer.layout.height, body.contentViewport.layout.height + 1f, $"{where}: the body fits its view");+ Assert.AreEqual(0f, body.verticalScroller.highValue, 0.5f, $"{where}: the body has no scroll range");+ Assert.AreEqual(0f, body.scrollOffset.y, 0.5f, $"{where}: the body is at its top");+ Assert.IsFalse(ScrollerShown(body.verticalScroller), $"{where}: no scroll bar shows");+ Assert.Greater(r.Options.Count, 1, $"{where}: precondition, the options are shown");+ foreach (var b in r.Options) Assert.IsTrue(InView(b, body), $"{where}: {b.name} {b.worldBound} shows whole in the body {body.contentViewport.worldBound}");+ Assert.LessOrEqual(r.Hide.worldBound.yMax, r.CardElement.worldBound.yMax + 0.5f, $"{where}: Hide is inside the card");+ }++ /// <summary>#1853: Tab (the NavigationMoveEvent that the keyboard and a gamepad raise) onto an option below the visible+ /// part of a long card's body scrolls the body to it (FocusScroll, at the UI root as in GameRoot), at 150% on a short+ /// window where the body overflows, in English and in Hebrew. Hide stays inside the card throughout.</summary>+ [UnityTest]+ public IEnumerator TabOntoAnOptionBelowTheBodyScrollsItIntoView([Values(false, true)] bool hebrew)+ {+ using var r = new Rig(1920, 900, "forex_crisis_1951", photos: true, text: hebrew ? He : Text, portraits: true, uiScale: 150);+ using var follow = new FocusScroll(r.Root);+ yield return Frames(5);+ var where = hebrew ? "he" : "en";+ var body = r.Body;+ var options = r.Options;+ int k = options.FindIndex(b => !InView(b, body));+ Assert.GreaterOrEqual(k, 0, $"{where}: precondition, an option is below the body's visible part ({body.contentViewport.worldBound})");+ Assert.Greater(body.verticalScroller.highValue, 0f, $"{where}: precondition, the body overflows and scrolls");+ Assert.AreSame(r.CardElement, r.Focused, $"{where}: precondition, the new card has the focus");+ for (int i = 0; i < options.Count + 2 && r.Focused != options[k]; i++)+ {+ var at = (VisualElement)r.Focused!;+ using (var e = NavigationMoveEvent.GetPooled(NavigationMoveEvent.Direction.Next)) { e.target = at; at.SendEvent(e); }+ yield return Frames(2);+ if (r.Focused is Button b && options.Contains(b)) Assert.IsTrue(InView(b, body), $"{where}: {b.name} {b.worldBound} is in view once focused ({body.contentViewport.worldBound})");+ }+ Assert.AreSame(options[k], r.Focused, $"{where}: Tab reached {options[k].name}");+ Assert.IsTrue(InView(options[k], body), $"{where}: {options[k].name} {options[k].worldBound} was scrolled into view ({body.contentViewport.worldBound})");+ Assert.Greater(body.scrollOffset.y, 0f, $"{where}: the body scrolled");+ Assert.LessOrEqual(r.Hide.worldBound.yMax, r.CardElement.worldBound.yMax + 0.5f, $"{where}: Hide stays inside the card");+ }++ /// <summary>#1853: a body scrolled down on one card does not carry over: the next card opens at the top of its text.</summary>+ [UnityTest]+ public IEnumerator TheNextCardOpensAtTheTopOfItsBody()+ {+ using var r = new Rig(1920, 900, "forex_crisis_1951", photos: true, second: "maabarot_policy", portraits: true, uiScale: 150);+ yield return Frames(5);+ var body = r.Body;+ Assert.Greater(body.verticalScroller.highValue, 0f, "precondition: the first card's body scrolls");+ body.scrollOffset = new Vector2(0f, body.verticalScroller.highValue);+ yield return Frames(2);+ Assert.Greater(body.scrollOffset.y, 0f, "precondition: scrolled down");+ Press(r.Options.Last());+ yield return Frames(5);+ Assert.AreEqual("maabarot_policy", r.Card.Shown?.Id, "precondition: the second card shows");+ Assert.Greater(body.verticalScroller.highValue, 0f, "precondition: the second card's body scrolls too, so an offset could carry over");+ Assert.AreEqual(0f, body.scrollOffset.y, 0.5f, "the second card opens at its top");+ }}diff --git a/unity/Assets/Tests/EditMode/EventCardScrollShots.cs b/unity/Assets/Tests/EditMode/EventCardScrollShots.csnew file mode 100644index 000000000..ef0053948--- /dev/null+++ b/unity/Assets/Tests/EditMode/EventCardScrollShots.cs@@ -0,0 +1,104 @@+#nullable enable+using System.Collections;+using System.IO;+using System.Linq;+using NUnit.Framework;+using Statecraft.Game;+using Statecraft.Game.UI;+using Statecraft.Sim;+using UnityEditor;+using UnityEngine;+using UnityEngine.TestTools;+using UnityEngine.UIElements;+using Object = UnityEngine.Object;++/// <summary>Writes the before and after stills for #1853's card scroll to `.superpowers/card-scroll-1853/` (local, not+/// committed): one long card (forex_crisis_1951, with the real portraits and photographs) on a 1920x1080 window at 150%+/// and at 125% and 100%, and at 150% in Hebrew. The "before" state moves the options and the Attention line back out of the body,+/// where they were before the change (Game.uxml), on the same card, state and window; "after" is the change as it ships,+/// and "after-scrolled" is the body scrolled to its last option. Explicit, so it does not run with the checks.</summary>+[Explicit("writes stills for a pull request, not a check")]+public class EventCardScrollShots+{+ const string Event = "forex_crisis_1951";+ static readonly Content C = ContentLoader.Load(Paths.Content);++ IEnumerator Frames(int n) { for (int i = 0; i < n; i++) yield return null; }++ static void Shot(RenderTexture rt, string dir, string name, VisualElement root)+ {+ var prev = RenderTexture.active;+ RenderTexture.active = rt;+ var tex = new Texture2D(rt.width, rt.height, TextureFormat.RGB24, false);+ tex.ReadPixels(new Rect(0, 0, rt.width, rt.height), 0, 0);+ tex.Apply();+ RenderTexture.active = prev;+ File.WriteAllBytes(Path.Combine(dir, name + ".png"), tex.EncodeToPNG());+ Object.DestroyImmediate(tex);+ var card = root.Q("event-card").worldBound; var hide = root.Q("event-hide").worldBound;+ var body = root.Q<ScrollView>("event-scroll");+ Debug.Log(string.Format(System.Globalization.CultureInfo.InvariantCulture,+ "SHOT {0}: card {1}, Hide {2}, body content {3:0} in view {4:0}, offset {5:0}", name, card, hide,+ body.contentContainer.layout.height, body.contentViewport.layout.height, body.scrollOffset.y));+ }++ IEnumerator Shots(int uiScale, bool hebrew)+ {+ var dir = Path.Combine(Directory.GetCurrentDirectory(), ".superpowers", "card-scroll-1853");+ Directory.CreateDirectory(dir);+ var tag = $"{(hebrew ? "he" : "en")}-1920x1080-{uiScale}";+ var rt = new RenderTexture(1920, 1080, 24);+ var ps = Object.Instantiate(AssetDatabase.LoadAssetAtPath<PanelSettings>(UiPaths.Panel));+ ps.targetTexture = rt; ps.clearColor = true; ps.colorClearValue = Color.black; // else each still shows the frames before it+ if (uiScale != 100) ps.referenceResolution = new Vector2Int(Mathf.RoundToInt(1920f * 100f / uiScale), Mathf.RoundToInt(1080f * 100f / uiScale));+ var go = new GameObject("EventCardScrollShots");+ go.SetActive(false);+ var doc = go.AddComponent<UIDocument>();+ doc.panelSettings = ps;+ doc.visualTreeAsset = AssetDatabase.LoadAssetAtPath<VisualTreeAsset>(UiPaths.GameUxml);+ go.SetActive(true);+ var text = hebrew ? UiText.Parse(AssetDatabase.LoadAssetAtPath<TextAsset>(UiPaths.StringsHebrew).text, "strings.he.yaml")+ : UiText.Parse(AssetDatabase.LoadAssetAtPath<TextAsset>(UiPaths.Strings).text);+ var root = doc.rootVisualElement;+ root.Q("root").RemoveFromClassList("loading");+ root.Q("root").EnableInClassList(UiLanguage.HebrewClass, hebrew);+ var g = GameSession.New(C, GoldenRun.Seed, Mode.Historical);+ g.State.Date = C.Events.First(e => e.Id == Event).From;+ g.State.PendingEvents.Clear(); g.State.PendingEvents.Add(Event);+ var bridge = new SimBridge(g, text);+ var hud = new HudPresenter(root, bridge, text);+ var card = new EventCardPresenter(root, bridge, text,+ AssetDatabase.LoadAssetAtPath<PortraitCatalog>("Assets/UI/Portraits/PortraitCatalog.asset"),+ AssetDatabase.LoadAssetAtPath<EventImageCatalog>("Assets/Resources/EventImageCatalog.asset"));+ try+ {+ for (int i = 0; i < 20 && float.IsNaN(root.Q("minimap").worldBound.width); i++) yield return null;+ yield return Frames(8);+ Shot(rt, dir, tag + "-after", root);+ var body = root.Q<ScrollView>("event-scroll");+ var options = root.Q("event-options");+ // To the end of the body: ScrollTo(last option) left the Hebrew body unmoved in this capture (the Tab test proves+ // focus does scroll it), so set the offset to the scroller's range directly.+ body.scrollOffset = new Vector2(0f, body.verticalScroller.highValue);+ yield return Frames(4);+ Shot(rt, dir, tag + "-after-scrolled", root);+ body.scrollOffset = Vector2.zero;+ // Before: the Attention line and the options back after the body, as Game.uxml had them before #1853.+ var cardElement = root.Q("event-card");+ cardElement.Insert(cardElement.IndexOf(body) + 1, root.Q("event-delegate"));+ cardElement.Insert(cardElement.IndexOf(body) + 2, options);+ yield return Frames(8);+ Shot(rt, dir, tag + "-before", root);+ }+ finally+ {+ card.Dispose(); hud.Dispose();+ Object.DestroyImmediate(go); Object.DestroyImmediate(ps); rt.Release(); Object.DestroyImmediate(rt);+ }+ }++ [UnityTest] public IEnumerator English150() { yield return Shots(150, false); }+ [UnityTest] public IEnumerator English125() { yield return Shots(125, false); }+ [UnityTest] public IEnumerator English100() { yield return Shots(100, false); }+ [UnityTest] public IEnumerator Hebrew150() { yield return Shots(150, true); }+}diff --git a/unity/Assets/Tests/EditMode/EventCardScrollShots.cs.meta b/unity/Assets/Tests/EditMode/EventCardScrollShots.cs.metanew file mode 100644index 000000000..1405d9b86--- /dev/null+++ b/unity/Assets/Tests/EditMode/EventCardScrollShots.cs.meta@@ -0,0 +1,2 @@+fileFormatVersion: 2+guid: 82d308993f11485f9dc42828f046aa5adiff --git a/unity/Assets/Tests/EditMode/FocusScrollTests.cs b/unity/Assets/Tests/EditMode/FocusScrollTests.csindex a316f67bd..baeeade01 100644--- a/unity/Assets/Tests/EditMode/FocusScrollTests.cs+++ b/unity/Assets/Tests/EditMode/FocusScrollTests.cs@@ -75,6 +75,53 @@ public class FocusScrollTestsusing (var e = NavigationMoveEvent.GetPooled(NavigationMoveEvent.Direction.Next)) { e.target = from; from.SendEvent(e); }}+ [UnityTest]+ public IEnumerator TheInfoPanelsLabelOnlyOverflowIsKeyboardReachableUntilCovered()+ {+ using var r = new Rig(1568, 752);+ r.Own(new NavigationGuard(r.Root));+ var nav = r.Own(new ScreenNav(r.Root));+ var view = r.Root.Q<ScrollView>("info-panel");+ view.Clear();+ view.style.display = DisplayStyle.Flex;+ view.style.width = 400f; view.style.maxWidth = 400f;+ view.style.height = 120f; view.style.minHeight = 120f; view.style.maxHeight = 120f;+ view.contentContainer.style.flexDirection = FlexDirection.Column;+ Label last = null!;+ for (int i = 0; i < 20; i++)+ {+ last = new Label("Fact") { style = { height = 40f, flexShrink = 0f } };+ view.Add(last);+ }+ var before = new Button { text = "Before facts" };+ view.parent.Insert(view.parent.IndexOf(view), before);+ FocusScroll.NoScrollBarIsATabStop(r.Root); // The policy GameRoot applies after constructing the views.+ yield return Frames(4);+ var slider = view.verticalScroller.slider;+ Assert.IsTrue(slider.focusable, "label-only facts retain a keyboard scroll stop");+ Assert.Greater(view.verticalScroller.highValue, 0f, "precondition: the facts overflow");+ Assert.IsFalse(Inside(last, view), "precondition: the bottom fact is below the viewport");+ before.Focus();+ for (int i = 0; i < 8 && r.Focused != slider; i++)+ {+ Tab((VisualElement)r.Focused!);+ yield return Frames(1);+ }+ Assert.AreSame(slider, r.Focused, "Tab reaches the info panel's slider with no card or screen open");+ using (var key = KeyDownEvent.GetPooled(new Event { type = EventType.KeyDown, keyCode = KeyCode.End }))+ { key.target = slider; slider.SendEvent(key); }+ yield return Frames(3);+ Assert.IsTrue(Inside(last, view), "End on the slider reaches the bottom label");+ nav.Open("cabinet");+ before.Focus();+ Assert.IsFalse(slider.canGrabFocus, "the covered slider cannot take keyboard focus");+ float coveredOffset = view.scrollOffset.y;+ using (var key = KeyDownEvent.GetPooled(new Event { type = EventType.KeyDown, keyCode = KeyCode.Home }))+ { key.target = slider; slider.SendEvent(key); }+ yield return Frames(2);+ Assert.AreEqual(coveredOffset, view.scrollOffset.y, "keys cannot scroll the covered facts");+ }+/// <summary>The Cabinet open in the playtest window (1568x752), its cards laid out, and the first card below the view.</summary>static IEnumerator OpenCabinet(Rig r, List<Button> cards, Action<int> below){diff --git a/unity/Assets/Tests/EditMode/InfoPanelLayoutTests.cs b/unity/Assets/Tests/EditMode/InfoPanelLayoutTests.csindex d37992f50..97b34c5fb 100644--- a/unity/Assets/Tests/EditMode/InfoPanelLayoutTests.cs+++ b/unity/Assets/Tests/EditMode/InfoPanelLayoutTests.cs@@ -40,12 +40,13 @@ public class InfoPanelLayoutTestsstatic IEnumerator Rendered(int w, int h, GameSession g, System.Action<VisualElement, InfoPanelPresenter> act, System.Action<VisualElement> check,UiText? text = null, bool hebrew = false, System.Action<VisualElement>? settled = null,System.Func<Statecraft.Game.Map.Units.PlacedToken?>? unit = null, System.Func<int, string?>? unitName = null,- System.Action<IReadOnlyCollection<(int q, int r)>>? showReachable = null)+ System.Action<IReadOnlyCollection<(int q, int r)>>? showReachable = null, int uiScale = 100){var t = text ?? Text;var rt = new RenderTexture(w, h, 0);var ps = Object.Instantiate(AssetDatabase.LoadAssetAtPath<PanelSettings>(UiPaths.Panel));ps.targetTexture = rt;+ if (uiScale != 100) ps.referenceResolution = new Vector2Int(Mathf.RoundToInt(1920f * 100f / uiScale), Mathf.RoundToInt(1080f * 100f / uiScale)); // #40: the panel as the Settings scale choice sets itvar go = new GameObject("InfoPanelTest");go.SetActive(false);var doc = go.AddComponent<UIDocument>();@@ -75,6 +76,15 @@ public class InfoPanelLayoutTests}}+ /// <summary>#40: the panel is a ScrollView now: a label may run past its bottom edge only when the panel scrolls to it+ /// (the Cabinet list's pattern). Sideways and upward it must always stay inside.</summary>+ static bool InsideOrScrollsTo(Rect r, ScrollView panel)+ {+ var p = panel.worldBound;+ if (r.xMin < p.xMin - 0.5f || r.xMax > p.xMax + 0.5f || r.yMin < p.yMin - 0.5f) return false;+ return r.yMax <= p.yMax + 0.5f || panel.verticalScroller.highValue > 0f;+ }+/// <summary>A label's text fits its box: on one line, or wrapped within its height.</summary>static bool TextFits(TextElement l){@@ -85,7 +95,10 @@ public class InfoPanelLayoutTestsvar pixel = l.panel == null ? 1f : 1f / l.panel.scaledPixelsPerPoint;// A line that does not wrap draws on one line: a box one raster pixel under its text still shows it all (#1789).if (l.resolvedStyle.whiteSpace != WhiteSpace.Normal) return natural.x <= box.width + pixel + 0.01f;- var wrapped = l.MeasureTextSize(l.text, box.width, VisualElement.MeasureMode.Exactly, 0, VisualElement.MeasureMode.Undefined);+ // The layout wraps the text at its width before that rounding, so the box can come out up to a pixel narrower than+ // the width it was wrapped at (#40: Hula's region line at 1920x1080 on 150% wraps in two lines at 264.5 px, in three+ // at the rounded 264.0): measure at the box's width plus that pixel.+ var wrapped = l.MeasureTextSize(l.text, box.width + pixel, VisualElement.MeasureMode.Exactly, 0, VisualElement.MeasureMode.Undefined);return wrapped.y <= box.height + pixel + 0.01f;}@@ -115,7 +128,7 @@ public class InfoPanelLayoutTests/// its box, the panel lies in the window, and it overlaps neither the minimap nor the event card (unless the card's backdrop/// covers it, the panel disabled under it), at every window size.</summary>[UnityTest]- public IEnumerator InfoPanelTextStaysInsideThePanel()+ public IEnumerator InfoPanelTextStaysInsideThePanel([Values(100, 125, 150)] int uiScale) // #40: at the Settings scale choices{var g = WithAnEventOpen();var lod = C.SettlementHexes.Single(s => s.Id == "lod");@@ -136,10 +149,33 @@ public class InfoPanelLayoutTestsproblems.Add($"{w}x{h}: the panel {panel.worldBound} overlaps the event card {root.Q("event-card").worldBound} with no backdrop over it");foreach (var l in panel.Query<Label>().ToList().Where(l => !string.IsNullOrEmpty(l.text) && Shown(l))){- if (!Inside(l.worldBound, panel.worldBound)) problems.Add($"{w}x{h}: '{l.text}' {l.worldBound} leaves the panel {panel.worldBound}");+ if (!InsideOrScrollsTo(l.worldBound, root.Q<ScrollView>("info-panel"))) problems.Add($"{w}x{h}: '{l.text}' {l.worldBound} leaves the panel {panel.worldBound}");if (!TextFits(l)) problems.Add($"{w}x{h}: '{l.text}' does not fit its box {l.contentRect} ({l.name})");}- });+ }, uiScale: uiScale);+ Assert.IsEmpty(problems, string.Join("\n", problems));+ }++ /// <summary>#40, owner decision of 22 Oct 2026 (a condition on #1135): the info panel is a ScrollView, whose rows the scroll+ /// content container lays out, and in Hebrew they still mirror: the hex's terrain sign sits right of its facts, as on+ /// the row-reversed panel before (#550). In English it sits left of them. At every window size and scale, Lydda's hex.</summary>+ [UnityTest]+ public IEnumerator InHebrewTheInfoPanelsRowsMirror([Values(100, 125, 150)] int uiScale)+ {+ var he = UiText.Parse(AssetDatabase.LoadAssetAtPath<TextAsset>(UiPaths.StringsHebrew).text, "strings.he.yaml");+ var g = WithAnEventOpen();+ var lod = C.SettlementHexes.Single(s => s.Id == "lod");+ var problems = new List<string>();+ foreach (var hebrew in new[] { false, true })+ foreach (var (w, h) in Windows)+ yield return Rendered(w, h, g, (root, info) => info.Show(lod.Q, lod.R), root =>+ {+ var at = $"{(hebrew ? "he" : "en")} {w}x{h} at {uiScale}%";+ var thumb = root.Q("info-thumb").worldBound; var body = root.Q(className: "info-body").worldBound;+ if (!(thumb.width > 0) || !(body.width > 0)) { problems.Add($"{at}: precondition: the sign {thumb} and the facts {body} show"); return; }+ if (hebrew ? !(thumb.xMin >= body.xMax - 0.5f) : !(thumb.xMax <= body.xMin + 0.5f))+ problems.Add($"{at}: the sign {thumb} is not {(hebrew ? "right" : "left")} of the facts {body}");+ }, text: hebrew ? he : null, hebrew: hebrew, uiScale: uiScale);Assert.IsEmpty(problems, string.Join("\n", problems));}@@ -149,7 +185,7 @@ public class InfoPanelLayoutTests/// the panel lies in the window, clear of the minimap, the left column and the top bar, and every shown label and/// button lies inside the panel with its text fitting its box.</summary>[UnityTest]- public IEnumerator TheGddCityAndSitePanelsFitEveryWindow()+ public IEnumerator TheGddCityAndSitePanelsFitEveryWindow([Values(100, 125, 150)] int uiScale) // #40: at the Settings scale choices{var he = UiText.Parse(AssetDatabase.LoadAssetAtPath<TextAsset>(UiPaths.StringsHebrew).text, "strings.he.yaml");var city = C.SettlementHexes.Single(s => s.Id == "tel_aviv");@@ -184,7 +220,11 @@ public class InfoPanelLayoutTestsif (what.StartsWith("city")){var collapsed = root.Q("root").ClassListContains(HudPresenter.TwoRowClass) || panel.ClassListContains(InfoPanelPresenter.ShortClass);- if (collapsed ? (w, h) == (1920, 1080) : CollapsedWindows.Contains((w, h))) problems.Add($"{at}: the city projects collapse: {collapsed}, expected {!collapsed}");+ // The ruling names windows at 100%. Its rule is the logical size (the stacked bars, ShortBelowPx), and+ // at 125%/150% 1920x1080 is 1536x864 or 1280x720 logical, shorter than 1366x657 at 100% (998), which+ // collapses: so 1920x1080 keeps the full list only at 100%, and the windows that collapse there+ // collapse at every scale (#40).+ if (collapsed ? uiScale == 100 && (w, h) == (1920, 1080) : CollapsedWindows.Contains((w, h))) problems.Add($"{at}: the city projects collapse: {collapsed}, expected {!collapsed}");var toggle = root.Q(GddHexPanel.ToggleName); var list = root.Q(GddHexPanel.ListName);if (toggle == null || list == null) problems.Add($"{at}: precondition: the city's projects have a toggle and a list");else if (Shown(toggle) != collapsed || Shown(list) == collapsed) problems.Add($"{at}: toggle shown {Shown(toggle)}, list shown {Shown(list)}, collapsed {collapsed}");@@ -194,10 +234,10 @@ public class InfoPanelLayoutTestsif (panel.worldBound.Overlaps(root.Q(other).worldBound)) problems.Add($"{at}: the panel {panel.worldBound} overlaps the {other} {root.Q(other).worldBound}");foreach (var l in panel.Query<TextElement>().ToList().Where(l => !string.IsNullOrEmpty(l.text) && Shown(l))){- if (!Inside(l.worldBound, panel.worldBound)) problems.Add($"{at}: '{l.text}' {l.worldBound} leaves the panel {panel.worldBound}");+ if (!InsideOrScrollsTo(l.worldBound, root.Q<ScrollView>("info-panel"))) problems.Add($"{at}: '{l.text}' {l.worldBound} leaves the panel {panel.worldBound}");if (!TextFits(l)) problems.Add($"{at}: '{l.text}' does not fit its box {l.contentRect} ({l.name})");}- }, hebrew ? he : Text, hebrew);+ }, hebrew ? he : Text, hebrew, uiScale: uiScale);}Assert.IsEmpty(problems, string.Join("\n", problems));}@@ -550,7 +590,7 @@ public class InfoPanelLayoutTests{foreach (var panel in new[] { root.Q(className: "date-box"), root.Q("event-card"), root.Q("info-panel"), root.Q("minimap") }){- var frame = panel.Children().OfType<UiFrame>().Single();+ var frame = panel.hierarchy.Children().OfType<UiFrame>().Single(); // the info panel's is on its ScrollView (#40)Assert.IsTrue(frame.Filigree, $"{panel.name}{panel.GetClasses().FirstOrDefault()}: filigree");Assert.AreEqual(PickingMode.Ignore, frame.pickingMode);var b = panel.worldBound;diff --git a/unity/Assets/Tests/EditMode/LeftColumnTests.cs b/unity/Assets/Tests/EditMode/LeftColumnTests.csindex 4f9e31054..d4a608bd2 100644--- a/unity/Assets/Tests/EditMode/LeftColumnTests.cs+++ b/unity/Assets/Tests/EditMode/LeftColumnTests.cs@@ -62,12 +62,14 @@ public class LeftColumnTests/// navigation, the decision card (open when the session has an event), the info panel on Lydda's hex, the minimap and the/// border caption. <paramref name="photos"/>: the card shows its event's photograph (the taller card).</summary>static IEnumerator Rendered(int w, int h, bool hebrew, GameSession g, System.Action<VisualElement, ScreenNav> check, System.Action<VisualElement, ScreenNav>? act = null,- EventImageCatalog? photos = null)+ EventImageCatalog? photos = null, int uiScale = 100,+ System.Func<VisualElement, ScreenNav, PanelSettings, IEnumerator>? interact = null){var text = hebrew ? He : En;var rt = new RenderTexture(w, h, 0);var ps = Object.Instantiate(AssetDatabase.LoadAssetAtPath<PanelSettings>(UiPaths.Panel));ps.targetTexture = rt;+ if (uiScale != 100) ps.referenceResolution = new Vector2Int(Mathf.RoundToInt(1920f * 100f / uiScale), Mathf.RoundToInt(1080f * 100f / uiScale)); // #40: the panel as the Settings scale choice sets itvar go = new GameObject("LeftColumnTest");go.SetActive(false);var doc = go.AddComponent<UIDocument>();@@ -94,6 +96,7 @@ public class LeftColumnTestsfor (int i = 0; i < 30 && !(root.Q("nav-cabinet").layout.width > 0); i++) yield return null;for (int i = 0; i < 3; i++) yield return null;check(root, nav);+ if (interact != null) yield return interact(root, nav, ps);}finally{@@ -135,7 +138,7 @@ public class LeftColumnTests/// px with no caption showing, clear of the info panel, the decision card and its backdrop, the minimap column and the/// border caption, and the toast.</summary>[UnityTest]- public IEnumerator TheColumnFitsEveryWindowInEnglishAndHebrew()+ public IEnumerator TheColumnFitsEveryWindowInEnglishAndHebrew([Values(100, 125, 150)] int uiScale) // #40: at the Settings scale choices{var problems = new List<string>();var g = WithAnEventOpen();@@ -165,10 +168,127 @@ public class LeftColumnTests("the border caption", root.Q("map-layer").worldBound) })if (r.Overlaps(hull)) problems.Add($"{at}: the column {hull} overlaps {name} {r}");if (!root.Q(Column).enabledInHierarchy) problems.Add($"{at}: the column is disabled under the open card (the top bar is not)");- });+ }, uiScale: uiScale);+ Assert.IsEmpty(problems, string.Join("\n", problems));+ }++ /// <summary>#40, owner decision of 22 Oct 2026 (phones at 100% take the tight HUD, on #1135): on a phone held upright the+ /// HUD is tight and three-row, and an open screen takes the window (the mobile-modal pattern), however far the bar's+ /// rows grew: it starts at the window's top inset, over the bar, not part-way down it, and lies in the window, in+ /// English and Hebrew.</summary>+ [UnityTest]+ public IEnumerator OnAPhoneAScreenTakesTheWindow()+ {+ var problems = new List<string>();+ var g = WithAnEventOpen();+ foreach (var hebrew in new[] { false, true })+ foreach (var (w, h) in new[] { (390, 844), (360, 800), (375, 667) })+ yield return Rendered(w, h, hebrew, g, (root, nav) =>+ {+ string at = $"{(hebrew ? "he" : "en")} {w}x{h}";+ var hud = root.Q("root");+ if (!hud.ClassListContains(HudPresenter.TightClass) || !hud.ClassListContains(HudPresenter.ThreeRowClass)) problems.Add($"{at}: precondition: the tight three-row HUD");+ var window = root.worldBound; var screen = root.Q("screen-cabinet").worldBound;+ if (!(screen.width > 0)) { problems.Add($"{at}: precondition: the Cabinet shows"); return; }+ CheckPhoneScreenBounds(at, window, screen, problems);+ }, (root, nav) => nav.Toggle("cabinet"));Assert.IsEmpty(problems, string.Join("\n", problems));}+ static void CheckPhoneScreenBounds(string at, Rect window, Rect screen, List<string> problems)+ {+ // Its 8 px inset, give or take the panel's scaling.+ if (screen.yMin > window.yMin + 12f)+ {+ problems.Add(System.FormattableString.Invariant($"{at}: the screen {screen} starts {screen.yMin - window.yMin:0} px down, not at the window's top"));+ }+ if (screen.xMin < window.xMin - 0.5f || screen.xMax > window.xMax + 0.5f || screen.yMax > window.yMax + 0.5f)+ {+ problems.Add(System.FormattableString.Invariant($"{at}: the screen {screen} leaves the window {window}"));+ }+ }++ [TestCase(8f, 8f, 374f, 800f, 0)]+ [TestCase(8f, 12f, 374f, 800f, 0)]+ [TestCase(8f, 20f, 374f, 800f, 1)]+ [TestCase(-1f, 8f, 374f, 800f, 1)]+ [TestCase(8f, 8f, 383f, 800f, 1)]+ [TestCase(8f, 8f, 374f, 837f, 1)]+ [TestCase(-1f, 20f, 374f, 800f, 2)]+ public void PhoneScreenBoundsRejectDisplacementAndOverflowIndependently(float x, float y, float width, float height, int expectedProblems)+ {+ var problems = new List<string>();+ CheckPhoneScreenBounds("phone", new Rect(0f, 0f, 390f, 844f), new Rect(x, y, width, height), problems);+ Assert.AreEqual(expectedProblems, problems.Count, string.Join("\n", problems));+ }++ [UnityTest]+ public IEnumerator FullWindowScreensExcludeCoveredControlsAcrossLiveScaleChanges()+ {+ foreach (var hebrew in new[] { false, true })+ yield return Rendered(1024, 1024, hebrew, GameSession.New(C, GoldenRun.Seed, Mode.Historical),+ (root, nav) => { }, interact: CheckFullWindowKeyboard);+ }++ static IEnumerator CheckFullWindowKeyboard(VisualElement root, ScreenNav nav, PanelSettings ps)+ {+ int activations = 0;+ var controls = new[] { root.Q<Button>("new-game"), root.Q<Button>("end-turn") }+ .Concat(root.Q("left-column").Query<Button>().ToList()).ToArray();+ // Community controls also belong to the covered lane.+ controls = controls.Concat(root.Q(CommunityIconsPresenter.ColumnName).Query<Button>().ToList()).ToArray();+ System.Action activated = () => activations++;+ foreach (var b in controls) b.clicked += activated;+ try+ {+ UiTestKit.Press(root.Q<Button>("event-hide"));+ nav.Open("cabinet");+ foreach (var scale in new[] { 100, 125, 150, 100, 150 })+ {+ ps.referenceResolution = new Vector2Int(Mathf.RoundToInt(1920f * 100f / scale), Mathf.RoundToInt(1080f * 100f / scale));+ for (int i = 0; i < 8; i++) yield return null;+ var hud = root.Q("root");+ bool covered = hud.ClassListContains(HudPresenter.TightClass) && hud.ClassListContains(HudPresenter.ThreeRowClass);+ Assert.AreEqual(scale == 150, covered, "1024x1024 crosses into the full-window tier at 150%");+ var x = root.Q<Button>("screen-close-cabinet");+ x.Focus();+ foreach (var b in controls)+ {+ Assert.AreEqual(!covered, b.enabledInHierarchy, "covered lanes restore when leaving the tier");+ if (!covered) continue;+ Assert.IsFalse(b.canGrabFocus, "covered controls are outside keyboard focus");+ b.Focus();+ Assert.AreNotSame(b, root.panel.focusController.focusedElement);+ UiTestKit.Press(b);+ }+ Assert.AreEqual(0, activations, "keyboard submit cannot activate a covered control");+ Assert.AreEqual("cabinet", nav.Current, "covered navigation cannot replace the screen");+ if (covered)+ {+ // Focus() on a control that cannot take focus clears it, so the lap starts again from the screen's X.+ x.Focus();+ Assert.AreSame(x, root.panel.focusController.focusedElement, "precondition: the lap starts on the screen's X");+ for (int i = 0; i < 24; i++)+ {+ var focused = (VisualElement)root.panel.focusController.focusedElement;+ Assert.IsNotNull(focused, "the keyboard retains a traversal target");+ using (var e = NavigationMoveEvent.GetPooled(NavigationMoveEvent.Direction.Next)) { e.target = focused; focused.SendEvent(e); }+ yield return null;+ Assert.IsFalse(controls.Any(b => b == root.panel.focusController.focusedElement), "Tab skips the covered controls");+ }+ }+ nav.Close();+ foreach (var b in controls) Assert.IsTrue(b.enabledInHierarchy, "closing restores covered controls");+ root.Q<Button>("nav-budget").Focus();+ UiTestKit.Press(root.Q<Button>("nav-budget"));+ Assert.AreEqual("budget", nav.Current, "restored navigation activates by keyboard");+ activations = 0;+ nav.Open("cabinet");+ }+ }+ finally { foreach (var b in controls) b.clicked -= activated; }+ }+/// <summary>Review of #859 at fb2a8dc (WebGL) and the owner's ruling there (17 October 2026): on a phone held upright,/// 390x844, 360x800 and 375x667, with a photo card open (turn 0's One Army, shown before Degania, and turn 1's The First Truce, taller than/// WithAnEventOpen's card, which the test above uses), no rail button sits under the card, Why? and Settings included@@ -203,7 +323,9 @@ public class LeftColumnTests}/// <summary>Each screen opens clear of the column at every window size (a screen under the column would hide the button- /// that closes it), and the toast too, in English and Hebrew.</summary>+ /// that closes it), and the toast too, in English and Hebrew. On the tight three-row HUD (a phone held upright) a screen+ /// takes the window instead and covers the whole side menu, its own X closing it (#40, the owner's ruling on #1135,+ /// 22 Oct 2026; OnAPhoneAScreenTakesTheWindow).</summary>[UnityTest]public IEnumerator EveryScreenAndTheToastOpenClearOfTheColumn(){@@ -223,7 +345,10 @@ public class LeftColumnTestsyield return Rendered(w, h, hebrew, g, (root, nav) =>{var r = root.Q("screen-" + screen).worldBound;+ var hud = root.Q("root");+ bool takesWindow = hud.ClassListContains(HudPresenter.TightClass) && hud.ClassListContains(HudPresenter.ThreeRowClass);if (!(r.width > 0)) problems.Add($"{at}: precondition: the {screen} screen shows");+ else if (takesWindow) { if (!(r.Contains(Hull(root).min) && r.Contains(Hull(root).max))) problems.Add($"{at}: the {screen} screen {r} takes the window but leaves part of the column {Hull(root)} uncovered"); }else if (r.Overlaps(Hull(root))) problems.Add($"{at}: the {screen} screen {r} covers the column {Hull(root)}");}, (root, nav) => nav.Toggle(screen));}diff --git a/unity/Assets/Tests/EditMode/PromoHudTests.cs b/unity/Assets/Tests/EditMode/PromoHudTests.csindex 31ad7ecee..9620f2a1f 100644--- a/unity/Assets/Tests/EditMode/PromoHudTests.cs+++ b/unity/Assets/Tests/EditMode/PromoHudTests.cs@@ -296,7 +296,11 @@ public class PromoHudTestsvar screen = root.Q("screen-why");screen.style.display = DisplayStyle.Flex; // opened, as ScreenNav doesfor (int i = 0; i < 2; i++) yield return null;- Assert.GreaterOrEqual(screen.worldBound.yMin, barRect.yMax, where + ": the screens start under the bar");+ if (root.Q("root").ClassListContains(HudPresenter.TightClass) && root.Q("root").ClassListContains(HudPresenter.ThreeRowClass))+ // #40, the owner's ruling on #1135 (22 Oct 2026): on a phone held upright a screen takes the window, over the bar.+ Assert.LessOrEqual(screen.worldBound.yMin, root.worldBound.yMin + 12f, where + ": the screen takes the window");+ else+ Assert.GreaterOrEqual(screen.worldBound.yMin, barRect.yMax, where + ": the screens start under the bar");screen.style.display = DisplayStyle.None;// The badge keeps its width for a short date line, so nothing shifts when the month changes.var wide = badge.worldBound.width;diff --git a/unity/Assets/Tests/EditMode/PromoScreensTests.cs b/unity/Assets/Tests/EditMode/PromoScreensTests.csindex 8e3409a8a..6f617e433 100644--- a/unity/Assets/Tests/EditMode/PromoScreensTests.cs+++ b/unity/Assets/Tests/EditMode/PromoScreensTests.cs@@ -692,20 +692,84 @@ public class PromoScreensTestsfinally { nav.Dispose(); cabinet.Dispose(); Object.DestroyImmediate(go); Object.DestroyImmediate(ps); rt.Release(); Object.DestroyImmediate(rt); }}+ /// <summary>Red on BASE: short 150% never moves the house; phone 150% never fits its column.+ /// Scale changes in one live panel must also restore the original order and 320x168 size.</summary>+ [UnityTest]+ public IEnumerator TheCabinetRestoresItsOrderAfterScaleChanges([Values(false, true)] bool hebrew)+ {+ var text = hebrew ? UiText.Parse(AssetDatabase.LoadAssetAtPath<TextAsset>(UiPaths.StringsHebrew).text, "strings.he.yaml") : Text;+ foreach (var (w, h) in new[] { (1920, 1080), (1280, 720), (390, 844), (360, 800) })+ {+ var rt = new RenderTexture(w, h, 0);+ var ps = Object.Instantiate(AssetDatabase.LoadAssetAtPath<PanelSettings>(UiPaths.Panel));+ ps.targetTexture = rt;+ var go = new GameObject("CabinetScaleChange"); go.SetActive(false);+ var doc = go.AddComponent<UIDocument>(); doc.panelSettings = ps;+ doc.visualTreeAsset = AssetDatabase.LoadAssetAtPath<VisualTreeAsset>(UiPaths.GameUxml);+ go.SetActive(true);+ var root = doc.rootVisualElement;+ root.Q("root").RemoveFromClassList("loading");+ root.Q("root").EnableInClassList(UiLanguage.HebrewClass, hebrew);+ var bridge = new SimBridge(GameSession.New(C, GoldenRun.Seed, Mode.Historical), text);+ var hud = new HudPresenter(root, bridge, text);+ var cabinet = new CabinetPresenter(root, bridge, text, null);+ var nav = new ScreenNav(root);+ var direction = hebrew ? new UiDirection(root, bridge) : null;+ try+ {+ nav.Open("cabinet");+ var house = root.Q("cabinet-house");+ var main = root.Q("cabinet-main");+ var list = root.Q<ScrollView>("cabinet-seats");+ foreach (var scale in new[] { 100, 125, 150, 125, 100, 150 })+ {+ ps.referenceResolution = new Vector2Int(Mathf.RoundToInt(1920f * 100f / scale), Mathf.RoundToInt(1080f * 100f / scale));+ for (int frame = 0; frame < 8; frame++) yield return null;+ var first = scale == 150 && w >= 1280;+ Assert.AreSame(first ? list.contentContainer : main, house.hierarchy.parent, $"{w}x{h} {scale}%: house parent");+ if (first) Assert.AreSame(house, list.contentContainer.Children().Last(), "cards precede the house");+ else Assert.AreSame(house, main.Children().First(), "default UXML order restored");+ var box = house.Q(className: "hemicycle-box");+ if (scale == 150 && w < 400)+ {+ Assert.Less(box.layout.width, 320f, "phone half circle really shrinks");+ Assert.LessOrEqual(box.layout.width, house.contentRect.width + 1.5f, "phone half circle fits its column");+ }+ else Assert.Less(Vector2.Distance(box.layout.size, HemicycleBox), 2.2f, "desktop and 100%/125% retain the pin");+ // Rendering and replacing the presenter must not clear the house when it shares the seat ScrollView.+ cabinet.Render();+ Assert.AreSame(house, root.Q("cabinet-house"));+ cabinet.Dispose();+ Assert.AreSame(main, house.hierarchy.parent, "disposing restores the house before clearing cards");+ cabinet = new CabinetPresenter(root, bridge, text, null);+ Assert.AreSame(house, root.Q("cabinet-house"), "the same house survives rebuilding the cards");+ Assert.Greater(list.Query<Button>(className: "seat").ToList().Count, 5);+ }+ }+ finally+ {+ direction?.Dispose(); nav.Dispose(); cabinet.Dispose(); hud.Dispose();+ Object.DestroyImmediate(go); Object.DestroyImmediate(ps); rt.Release(); Object.DestroyImmediate(rt);+ }+ }+ }+/// <summary>Both screens at the window shapes the HUD supports (16:9 at 1920x1080 and 1366x768, 16:10, 4:3, 5:4, the/// wide-and-short browser, square and narrower): each opens under the top bar, clear of the minimap column and the/// minimap (over the info panel, which it is drawn above), and nothing on it leaves it or its panel sideways; every/// one-line text fits its box.</summary>[UnityTest]- public IEnumerator BothScreensFitEveryWindowShape()+ public IEnumerator BothScreensFitEveryWindowShape([Values(100, 125, 150)] int uiScale, [Values(false, true)] bool hebrew) // #40: at the Settings scale choices{+ var text = hebrew ? UiText.Parse(AssetDatabase.LoadAssetAtPath<TextAsset>(UiPaths.StringsHebrew).text, "strings.he.yaml") : Text;var g = GameSession.New(C, GoldenRun.Seed, Mode.Historical);var problems = new List<string>();- foreach (var (w, h) in new[] { (1920, 1080), (1366, 768), (1280, 720), (1440, 900), (1920, 1200), (1024, 768), (1280, 1024), (1531, 784), (1024, 1024), (960, 1080), (800, 1000), (960, 600), (390, 844) })+ foreach (var (w, h) in new[] { (1920, 1080), (1366, 768), (1280, 720), (1440, 900), (1920, 1200), (1024, 768), (1280, 1024), (1531, 784), (1024, 1024), (960, 1080), (800, 1000), (960, 600), (390, 844), (360, 800), (375, 667), (2560, 1080) }){var rt = new RenderTexture(w, h, 0);var ps = Object.Instantiate(AssetDatabase.LoadAssetAtPath<PanelSettings>(UiPaths.Panel));ps.targetTexture = rt;+ if (uiScale != 100) ps.referenceResolution = new Vector2Int(Mathf.RoundToInt(1920f * 100f / uiScale), Mathf.RoundToInt(1080f * 100f / uiScale)); // #40var go = new GameObject("ScreensTest");go.SetActive(false);var doc = go.AddComponent<UIDocument>();@@ -718,19 +782,23 @@ public class PromoScreensTests{for (int i = 0; i < 20 && !(root.Q("top-bar").worldBound.width > 0); i++) yield return null;root.Q("root").RemoveFromClassList("loading");- var bridge = new SimBridge(g, Text);- owned.Add(new HudPresenter(root, bridge, Text));- owned.Add(new CabinetPresenter(root, bridge, Text, null));- owned.Add(new DefencePresenter(root, bridge, Text));+ root.Q("root").EnableInClassList(UiLanguage.HebrewClass, hebrew);+ var bridge = new SimBridge(g, text);+ owned.Add(new HudPresenter(root, bridge, text));+ owned.Add(new CabinetPresenter(root, bridge, text, null));+ owned.Add(new DefencePresenter(root, bridge, text));+ if (hebrew) owned.Add(new UiDirection(root, bridge));var nav = new ScreenNav(root); owned.Add(nav);foreach (var s in new[] { "cabinet", "defence" }){nav.Open(s);for (int i = 0; i < 6; i++) yield return null;- var where = $"{w}x{h} {s}";+ var where = $"{w}x{h} {s} {(hebrew ? "he" : "en")} {uiScale}%";var screen = root.Q("screen-" + s); var sr = screen.worldBound;if (!(sr.width > 300)) { problems.Add($"{where}: the screen is {sr}"); continue; }- if (sr.yMin < root.Q("top-bar").worldBound.yMax - 0.5f) problems.Add($"{where}: starts over the top bar");+ // #40: on the tight three-row HUD a screen takes the whole window (the mobile-modal pattern).+ var fullWindowScreens = root.Q("root").ClassListContains(HudPresenter.TightClass) && root.Q("root").ClassListContains(HudPresenter.ThreeRowClass);+ if (!fullWindowScreens && sr.yMin < root.Q("top-bar").worldBound.yMax - 0.5f) problems.Add($"{where}: starts over the top bar");// Clear of the minimap column, or (two-row HUD, #210) full width with the column hidden.var column = root.Q("right-column");if (column.resolvedStyle.display != DisplayStyle.None && sr.Overlaps(column.worldBound)) problems.Add($"{where}: overlaps the minimap column {column.worldBound}");@@ -756,8 +824,23 @@ public class PromoScreensTestsif (s == "cabinet"){var hemi = root.Q("cabinet-hemicycle");- if (hemi.layout.width < HemicycleBox.x - 1.5f || hemi.layout.height < HemicycleBox.y - 1.5f) // pixel snapping at a fractional scale moves it by under 1.5 px- problems.Add($"{where}: the half circle is {hemi.layout.size}, not the {HemicycleBox} the line test assumes");+ var snap = Mathf.Max(1.5f, 1f / hemi.panel.scaledPixelsPerPoint + 0.01f);+ // Owner: only PHONES at 150% replace the 320x168 pin. In particular 1280x720 and 960x600+ // are desktops even when their scaled HUD enters the three-row tier.+ var phone150 = uiScale == 150 && (w == 390 || w == 360 || w == 375);+ if (phone150)+ {+ var house = root.Q("cabinet-house");+ if (!(hemi.layout.width > 0f) || hemi.layout.width > house.contentRect.width + 1.5f+ || hemi.layout.width > 320f + 1.5f || hemi.worldBound.xMin < house.worldBound.xMin - 0.5f+ || hemi.worldBound.xMax > house.worldBound.xMax + 0.5f)+ problems.Add($"{where}: the phone half circle {hemi.worldBound} does not fit its column {house.worldBound}");+ if (Mathf.Abs(hemi.layout.height - hemi.layout.width * 168f / 320f) > 1.5f)+ problems.Add($"{where}: the phone half circle lost its 320:168 proportions");+ }+ // Pixel snapping moves it by up to one raster pixel: 1.9 logical px at 960x600 (Hebrew, 318.3 px wide).+ else if (Mathf.Abs(hemi.layout.width - HemicycleBox.x) > snap || Mathf.Abs(hemi.layout.height - HemicycleBox.y) > snap)+ problems.Add($"{where}: the half circle is {hemi.layout.size}, not the unchanged {HemicycleBox}");var cards = root.Q<ScrollView>("cabinet-seats").Query<Button>(className: "seat").ToList();if (cards.Count < 5) problems.Add($"{where}: {cards.Count} cards");if (!(cards[0].worldBound.yMin < root.Q<ScrollView>("cabinet-seats").contentViewport.worldBound.yMax - 100)) problems.Add($"{where}: no card row in view");@@ -942,8 +1025,10 @@ public class PromoScreensTests}/// <summary>#210: at a phone-shaped 390x844 and at 960x600 every screen is usable: at least 500 logical px wide and- /// 300 tall, under the top bar. In the two-row HUD (390x844) a screen takes the full width, the minimap column and the- /// info panel under it are hidden and ignore map clicks, and the toast sits below the screen.</summary>+ /// 300 tall, under the top bar. In the two-row HUD a screen takes the full width, the minimap column and the info panel+ /// under it are hidden and ignore map clicks, and the toast sits below the screen. On a phone held upright (390x844, the+ /// tight three-row HUD) a screen takes the whole window instead, over the bar and the side menu (#40, the owner's ruling+ /// on #1135, 22 Oct 2026), and the toast at the window's foot keeps clear of the screen's header and its X.</summary>[UnityTest]public IEnumerator EveryScreenIsUsableInANarrowWindow(){@@ -981,6 +1066,8 @@ public class PromoScreensTestsfor (int i = 0; i < 6; i++) yield return null;bool twoRow = root.Q("root").ClassListContains(HudPresenter.TwoRowClass);if ((w, h) == (390, 844) && !twoRow) problems.Add("390x844 is not the two-row HUD");+ bool takesWindow = root.Q("root").ClassListContains(HudPresenter.TightClass) && root.Q("root").ClassListContains(HudPresenter.ThreeRowClass);+ if ((w, h) == (390, 844) && !takesWindow) problems.Add("390x844 is not the tight three-row HUD");var bar = root.Q("top-bar").worldBound;foreach (var s in ScreenNav.Screens){@@ -989,15 +1076,30 @@ public class PromoScreensTestsvar where = $"{w}x{h} {s}";var r = root.Q("screen-" + s).worldBound;if (!(r.width >= 500f && r.height >= 300f)) problems.Add($"{where}: the screen is only {r.width:0} x {r.height:0}");- if (r.yMin < bar.yMax - 0.5f) problems.Add($"{where}: starts over the top bar");var t = toast.worldBound;- if (t.Overlaps(r)) problems.Add($"{where}: the toast {t} covers the screen {r}");+ if (takesWindow)+ {+ var window = root.worldBound;+ if (r.yMin > window.yMin + 12f || r.xMin > window.xMin + 12f || r.xMax < window.xMax - 12f || r.yMax < window.yMax - 12f)+ problems.Add($"{where}: the screen {r} does not take the window {window}");+ var header = root.Q("screen-" + s).Q(className: "screen-header").worldBound;+ var close = root.Q("screen-close-" + s).worldBound;+ if (!(t.width > 0)) problems.Add($"{where}: precondition: the toast shows");+ else if (t.Overlaps(header) || t.Overlaps(close)) problems.Add($"{where}: the toast {t} covers the screen's header {header} or its X {close}");+ if (t.yMax > window.yMax + 0.5f) problems.Add($"{where}: the toast {t} leaves the window {window}");+ }+ else+ {+ if (r.yMin < bar.yMax - 0.5f) problems.Add($"{where}: starts over the top bar");+ if (t.Overlaps(r)) problems.Add($"{where}: the toast {t} covers the screen {r}");+ }if (twoRow){var panel = root.panel.visualTree.worldBound;- // Full width right of the left icon column (HUD round 2, #398), which stays in view to switch screens.+ // Full width right of the left icon column (HUD round 2, #398), which stays in view to switch screens+ // (on the tight three-row HUD the screen takes the window instead, above).var column = root.Q("left-column").worldBound;- if (r.xMin < column.xMax - 0.5f) problems.Add($"{where}: covers the left icon column {column}");+ if (!takesWindow && r.xMin < column.xMax - 0.5f) problems.Add($"{where}: covers the left icon column {column}");if (r.width < panel.width - 40f - 68f) problems.Add($"{where}: not full width ({r.width:0} of {panel.width:0})");foreach (var hidden in new[] { "right-column", "info-panel" })if (root.Q(hidden).resolvedStyle.display != DisplayStyle.None) problems.Add($"{where}: {hidden} shows under the screen");diff --git a/unity/Assets/Tests/EditMode/ScrollBarTabStopTests.cs b/unity/Assets/Tests/EditMode/ScrollBarTabStopTests.csindex 93ce73cb6..61aba88a9 100644--- a/unity/Assets/Tests/EditMode/ScrollBarTabStopTests.cs+++ b/unity/Assets/Tests/EditMode/ScrollBarTabStopTests.cs@@ -139,15 +139,15 @@ public class ScrollBarTabStopTestsAssert.IsEmpty(found, $"the Cabinet's bars stay out of the order, but one lap stopped on: {string.Join(", ", found)}");}- /// <summary>Every ScrollView in the tree has both of its bars out of the order, except the three whose bar is the+ /// <summary>Every ScrollView in the tree has both of its bars out of the order, except the four whose bar is the/// only way a keyboard player can scroll them. `KeyScroll` has no target for `turn-report-rows`,- /// `end-screen-rows` or `capture-scroll`, and `GameRoot` switches PageUp, PageDown, Home and End off entirely+ /// `end-screen-rows`, `capture-scroll` or `info-panel` (its facts are labels, #40), and `GameRoot` switches PageUp, PageDown, Home and End off entirely/// while the report or the end screen is open, so taking their bar out would leave no keyboard route at all.</summary>[UnityTest]public IEnumerator NoScrollViewInTheTreeKeepsAFocusableBar(){yield return BootShort();- var exempt = new[] { "turn-report-rows", "end-screen-rows", "capture-scroll" };+ var exempt = new[] { "turn-report-rows", "end-screen-rows", "capture-scroll", "info-panel" };var bad = new List<string>();foreach (var sv in ui.Query<ScrollView>().Build()){@@ -166,14 +166,14 @@ public class ScrollBarTabStopTestsAssert.IsEmpty(bad, $"these scroll bars can still take the focus: {string.Join(", ", bad)}");}- /// <summary>The exclusion is deliberate, so it is pinned: the three views the keyboard cannot otherwise scroll+ /// <summary>The exclusion is deliberate, so it is pinned: the four views the keyboard cannot otherwise scroll/// keep a focusable bar. If `KeyScroll` is ever given a route to them, this test should be deleted along with the/// exclusion in `FocusScroll.OnlyReachableByTheirBar` (#41 K6, the owner's review).</summary>[UnityTest]public IEnumerator TheViewsTheKeyboardCannotOtherwiseScrollKeepTheirBar(){yield return BootShort();- foreach (var name in new[] { "turn-report-rows", "end-screen-rows", "capture-scroll" })+ foreach (var name in new[] { "turn-report-rows", "end-screen-rows", "capture-scroll", "info-panel" }){var sv = ui.Q<ScrollView>(name);Assert.IsNotNull(sv, $"precondition: {name} is in the tree");diff --git a/unity/Assets/Tests/EditMode/TopBarTests.cs b/unity/Assets/Tests/EditMode/TopBarTests.csindex bfee4b9cb..a985956a7 100644--- a/unity/Assets/Tests/EditMode/TopBarTests.cs+++ b/unity/Assets/Tests/EditMode/TopBarTests.cs@@ -57,12 +57,13 @@ public class TopBarTests/// score in the plate. <paramref name="widest"/> false keeps the turn-1 values. <paramref name="collapsed"/> (with/// <paramref name="withEvent"/>) hides the open card to its "Decision waiting" button, as Hide does.</summary>static IEnumerator Rendered(int w, int h, bool hebrew, System.Action<VisualElement, UiText> check, bool widest = true, bool withEvent = false,- bool collapsed = false, System.Func<VisualElement, IEnumerator>? afterRender = null)+ bool collapsed = false, System.Func<VisualElement, IEnumerator>? afterRender = null, int uiScale = 100){var text = hebrew ? He : En;var rt = new RenderTexture(w, h, 0);var ps = Object.Instantiate(AssetDatabase.LoadAssetAtPath<PanelSettings>(UiPaths.Panel));ps.targetTexture = rt;+ if (uiScale != 100) ps.referenceResolution = new Vector2Int(Mathf.RoundToInt(1920f * 100f / uiScale), Mathf.RoundToInt(1080f * 100f / uiScale)); // #40: the panel as the Settings scale choice sets itvar go = new GameObject("TopBarTest");go.SetActive(false);var doc = go.AddComponent<UIDocument>();@@ -285,7 +286,7 @@ public class TopBarTests/// at the bar's right end, End Turn at its left); and every panel under the bar, and under the hanging plate, starts below/// them.</summary>[UnityTest]- public IEnumerator TheBarFitsEveryWindowInEnglishAndHebrew()+ public IEnumerator TheBarFitsEveryWindowInEnglishAndHebrew([Values(100, 125, 150)] int uiScale) // #40: at the Settings scale choices{var problems = new List<string>();foreach (var hebrew in new[] { false, true })@@ -343,7 +344,7 @@ public class TopBarTestsif (r.xMin < plate.xMax && r.xMax > plate.xMin && r.yMin < plate.yMax - 0.5f && name != "event-layer" && name != "right-column")problems.Add($"{at}: {name} {r} starts under the hanging plate {plate}");}- });+ }, uiScale: uiScale);Assert.IsEmpty(problems, string.Join("\n", problems));}@@ -413,7 +414,11 @@ public class TopBarTestsif (!(band.height > 0) || !(scrim.height > 0) || !(gutter.height > 0)) { problems.Add($"{at}: precondition: the backdrop shows"); return; }if (Mathf.Abs(band.yMin - bar.yMax) > 0.5f) problems.Add($"{at}: the band starts at {band.yMin:0}, not at the bar's bottom {bar.yMax:0}");if (band.xMin > root.worldBound.xMin + 0.5f || band.xMax < root.worldBound.xMax - 0.5f) problems.Add($"{at}: the band {band} is not the window's width");- if (band.yMax < scrim.yMin - 0.5f || band.yMax < gutter.yMin - 0.5f) problems.Add($"{at}: a gap between the band {band} and the backdrop {scrim} or the strip {gutter}");+ // On the tight three-row window (#40) the side menu is a row under the bar: the band stops at the row's top and+ // the strip, the window's width, takes over from there down to the backdrop.+ bool stripBridges = gutter.yMin <= band.yMax + 0.5f && gutter.yMax >= scrim.yMin - 0.5f+ && gutter.xMin <= root.worldBound.xMin + 0.5f && gutter.xMax >= root.worldBound.xMax - 0.5f;+ if (band.yMax < scrim.yMin - 0.5f && !stripBridges || band.yMax < gutter.yMin - 0.5f) problems.Add($"{at}: a gap between the band {band} and the backdrop {scrim} or the strip {gutter}");if (band.yMax > column.yMin + 0.5f) problems.Add($"{at}: the band {band} reaches over the column's discs {column}");foreach (var x in new[] { 0.1f, 0.5f, 0.9f }){diff --git a/unity/Assets/Tests/EditMode/UiLayoutTests.cs b/unity/Assets/Tests/EditMode/UiLayoutTests.csindex 17a079e20..28eb6cd1b 100644--- a/unity/Assets/Tests/EditMode/UiLayoutTests.cs+++ b/unity/Assets/Tests/EditMode/UiLayoutTests.cs@@ -273,11 +273,12 @@ public class UiLayoutTests/// <summary>The real Game.uxml on the real PanelSettings (and so the real theme), rendered at <paramref name="w"/> x/// <paramref name="h"/>, with the HUD and the Cabinet screen filled from the opening of the historical game.</summary>- static IEnumerator Filled(int w, int h, string? screen, System.Action<VisualElement> check)+ static IEnumerator Filled(int w, int h, string? screen, System.Action<VisualElement> check, int uiScale = 100){var rt = new RenderTexture(w, h, 0);var ps = Object.Instantiate(AssetDatabase.LoadAssetAtPath<PanelSettings>(UiPaths.Panel));ps.targetTexture = rt;+ if (uiScale != 100) ps.referenceResolution = new Vector2Int(Mathf.RoundToInt(1920f * 100f / uiScale), Mathf.RoundToInt(1080f * 100f / uiScale)); // #40: the panel as the Settings scale choice sets itvar go = new GameObject("LayoutTest");go.SetActive(false);var doc = go.AddComponent<UIDocument>();@@ -336,7 +337,7 @@ public class UiLayoutTests/// <summary>Playtest 1, item 2: the Cabinet lineup is a list inside the screen panel, below its header, filling the/// panel; rows that do not fit scroll instead of spilling over the top bar.</summary>[UnityTest]- public IEnumerator TheCabinetListStaysInsideItsPanel()+ public IEnumerator TheCabinetListStaysInsideItsPanel([Values(100, 125, 150)] int uiScale) // #40: at the Settings scale choices{foreach (var (w, h) in Windows)yield return Filled(w, h, "cabinet", root =>@@ -351,6 +352,20 @@ public class UiLayoutTestsAssert.GreaterOrEqual(view.yMax, root.Q("cabinet-status").worldBound.yMin - 16f, $"{w}x{h}: the list leaves the panel empty below it");var rows = list.Query<Button>(className: "seat").ToList();Assert.Greater(rows.Count, 5, "the lineup was rendered");+ // Red on BASE: the house is pinned above the list, consuming its viewport at 150% on short windows.+ var house = root.Q("cabinet-house");+ var cardsFirst = uiScale == 150 && root.worldBound.height < 800f;+ Assert.AreEqual(cardsFirst, house.hierarchy.parent == list.contentContainer, $"{w}x{h}: house shares the cards' scroll only on short 150% windows");+ if (cardsFirst)+ {+ Assert.AreSame(house, list.contentContainer.Children().Last(), "the house and legend follow every seat card");+ Assert.GreaterOrEqual(house.worldBound.yMin, rows.Max(x => x.worldBound.yMax) - 0.5f, "the house starts below all card rows");+ Assert.Less(rows[0].worldBound.yMin, view.yMax - 100f, "a card row is visible before scrolling");+ if (house.worldBound.yMax > view.yMax + 0.5f)+ Assert.Greater(list.verticalScroller.highValue, 0f, "the house can be reached by scrolling");+ }+ else+ Assert.LessOrEqual(house.worldBound.yMax, view.yMin + 0.5f, "100%/125% and tall 150% keep the pinned house above the list");foreach (var r in rows){Assert.GreaterOrEqual(r.worldBound.yMin, view.yMin - 0.5f, $"{w}x{h}: {r.name} sits above the list");@@ -359,7 +374,7 @@ public class UiLayoutTestsif (r.worldBound.yMax > view.yMax + 0.5f)Assert.Greater(list.verticalScroller.highValue, 0f, $"{w}x{h}: {r.name} runs past the panel and the list does not scroll");}- });+ }, uiScale);}/// <summary>Playtest 1, item 3: the camera learns how much of the window the top bar covers, at every window shape,@@ -393,7 +408,7 @@ public class UiLayoutTests// screen at every size; the Cabinet list grew out of its screen over the top bar. Checked with every screen filled by// its presenter (an event open on the card), at 16:9 and at the wider viewports a browser window leaves.[UnityTest]- public IEnumerator FilledScreensStayInsideTheirPanelsAndTheTopBarFits()+ public IEnumerator FilledScreensStayInsideTheirPanelsAndTheTopBarFits([Values(100, 125, 150)] int uiScale) // #40: at the Settings scale choices{var c = ContentLoader.Load(Paths.Content);var text = UiText.Parse(AssetDatabase.LoadAssetAtPath<TextAsset>(UiPaths.Strings).text);@@ -416,6 +431,7 @@ public class UiLayoutTestsvar rt = new RenderTexture(w, h, 0);var ps = Object.Instantiate(AssetDatabase.LoadAssetAtPath<PanelSettings>(UiPaths.Panel));ps.targetTexture = rt;+ if (uiScale != 100) ps.referenceResolution = new Vector2Int(Mathf.RoundToInt(1920f * 100f / uiScale), Mathf.RoundToInt(1080f * 100f / uiScale)); // #40var go = new GameObject("LayoutTest");go.SetActive(false);var doc = go.AddComponent<UIDocument>();@@ -494,7 +510,7 @@ public class UiLayoutTests/// 1040 px wide, below the top bar and inside the layer; its option buttons stay inside it with their text; and its/// media header is 16:9 whenever the card has the height for it (on a full card it gives way first, as before).</summary>[UnityTest]- public IEnumerator EveryEventCardFitsTheDecisionLayer()+ public IEnumerator EveryEventCardFitsTheDecisionLayer([Values(100, 125, 150)] int uiScale) // #40: at the Settings scale choices{var problems = new List<string>();foreach (var (w, h) in CardWindows)@@ -502,6 +518,7 @@ public class UiLayoutTestsvar rt = new RenderTexture(w, h, 0);var ps = Object.Instantiate(AssetDatabase.LoadAssetAtPath<PanelSettings>(UiPaths.Panel));ps.targetTexture = rt;+ if (uiScale != 100) ps.referenceResolution = new Vector2Int(Mathf.RoundToInt(1920f * 100f / uiScale), Mathf.RoundToInt(1080f * 100f / uiScale)); // #40var go = new GameObject("LayoutTest");go.SetActive(false);var doc = go.AddComponent<UIDocument>();@@ -535,19 +552,32 @@ public class UiLayoutTestsCheckCard($"{w}x{h}: {e.Id}", root, problems);var c = root.Q("event-card").worldBound;if (c.height > tallest) { tallest = c.height; tallestId = e.Id; }+ var scroll = root.Q<ScrollView>("event-scroll");foreach (var b in root.Q("event-options").Query<Button>().ToList()){+ // #1853: the options scroll with the text, so one past the body's visible part is first brought into+ // view, as Tab brings it (FocusScroll); then it must lie inside the card and the body's viewport.+ if (!Inside(b.worldBound, c))+ {+ scroll.ScrollTo(b);+ yield return null;+ if (!Inside(b.worldBound, scroll.contentViewport.worldBound))+ problems.Add($"{w}x{h}: {e.Id}: option '{b.text}' {b.worldBound} cannot be scrolled whole into the body {scroll.contentViewport.worldBound}");+ }if (b.worldBound.yMax > c.yMax + 0.5f || b.worldBound.yMin < c.yMin - 0.5f || b.worldBound.xMax > c.xMax + 0.5f || b.worldBound.xMin < c.xMin - 0.5f)problems.Add($"{w}x{h}: {e.Id}: option '{b.text}' {b.worldBound} is cut off by the card {c}");// Playtest 2, P2-2: the option's text lies inside its button (it wraps; it is never cut at the edge).if (!TextFits(b))problems.Add($"{w}x{h}: {e.Id}: option text '{b.text}' does not fit its button {b.contentRect}");}+ scroll.scrollOffset = Vector2.zero;// Playtest 2, P2-3: in a window at least as tall (logically) as 1366x657, the body and the options fit// without scrolling; shorter windows may scroll the body as the fallback.- var scroll = root.Q<ScrollView>("event-scroll");var logicalHeight = root.panel.visualTree.layout.height;- if (logicalHeight >= EventCardPresenter.ScrollFallbackHeight && scroll.contentContainer.layout.height > scroll.contentViewport.layout.height + 1f)+ // Owner ruling, 27 October: "Compact card + allow scroll (Recommended)" (#1135).+ // The narrow-card fallback is at 150% only; Hide and the options are still checked above at every size.+ if (CardBodyScrollsTooMuch(uiScale, root.Q("event-card").worldBound.width, logicalHeight,+ scroll.contentContainer.layout.height, scroll.contentViewport.layout.height))problems.Add($"{w}x{h} (logical height {logicalHeight:0}): {e.Id}: the body scrolls ({scroll.contentContainer.layout.height:0} px of text in {scroll.contentViewport.layout.height:0} px)");}Debug.Log($"I2 {w}x{h}: tallest card {tallestId} {tallest:0} px");@@ -562,6 +592,37 @@ public class UiLayoutTestsAssert.IsEmpty(problems, string.Join("\n", problems));}+ static bool CardBodyScrollsTooMuch(int uiScale, float width, float logicalHeight, float contentHeight, float viewportHeight)+ {+ var narrowAt150 = uiScale == 150 && width < CardMaxWidth - 1f;+ return !narrowAt150 && logicalHeight >= EventCardPresenter.ScrollFallbackHeight && contentHeight > viewportHeight + 1f;+ }++ [TestCase(150, 1038f, false)]+ [TestCase(150, 1039f, true)]+ [TestCase(150, 1040f, true)]+ [TestCase(150, 1041f, true)]+ [TestCase(125, 1038f, true)]+ [TestCase(125, 1039f, true)]+ [TestCase(125, 1040f, true)]+ [TestCase(125, 1041f, true)]+ [TestCase(100, 1038f, true)]+ [TestCase(100, 1039f, true)]+ [TestCase(100, 1040f, true)]+ [TestCase(100, 1041f, true)]+ public void TheBodyScrollCheckKeepsItsWidthAndScaleBoundary(int uiScale, float width, bool expectedProblem)+ {+ Assert.AreEqual(expectedProblem, CardBodyScrollsTooMuch(uiScale, width, EventCardPresenter.ScrollFallbackHeight, 200f, 100f));+ }++ [TestCase(100, 1039f)]+ [TestCase(125, 1040f)]+ [TestCase(150, 1041f)]+ public void ShortWindowsKeepTheBodyScrollFallback(int uiScale, float width)+ {+ Assert.IsFalse(CardBodyScrollsTooMuch(uiScale, width, EventCardPresenter.ScrollFallbackHeight - 1f, 200f, 100f));+ }+/// <summary>The decision card's place: in the decision layer, centred across it, at most CardMaxWidth logical px wide and/// below the top bar, Hide inside it; a shown media header is 16:9 unless the card is as tall as the layer (then it gave/// way first), and while it shows the body does not scroll.</summary>@@ -579,9 +640,12 @@ public class UiLayoutTestsif (c.yMin < bar.worldBound.yMax - 0.5f) problems.Add($"{where}: the card {c} starts over the top bar {bar.worldBound}");var hide = root.Q("event-hide").worldBound;if (!Inside(hide, c)) problems.Add($"{where}: Hide {hide} is cut off by the card {c}");- // The header gives way before the text on every window: while a photograph shows, the body never scrolls.+ // The header gives way before the text on every window: while a photograph shows, the body never scrolls. Layout+ // rounds each edge to the device pixel grid, so the viewport may come out one device pixel short of its text: at a+ // scale under 1 that is more than one panel px (1.06 at 125% on 1568x752, #40), and it is not a scroll.var scroll = root.Q<ScrollView>("event-scroll");- if (root.Q("event-photo").resolvedStyle.display == DisplayStyle.Flex && scroll.contentContainer.layout.height > scroll.contentViewport.layout.height + 1f)+ var devicePixel = Mathf.Max(1f, 1f / root.panel.scaledPixelsPerPoint) + 0.01f;+ if (root.Q("event-photo").resolvedStyle.display == DisplayStyle.Flex && scroll.contentContainer.layout.height > scroll.contentViewport.layout.height + devicePixel)problems.Add($"{where}: the body scrolls ({scroll.contentContainer.layout.height:0} px of text in {scroll.contentViewport.layout.height:0} px) while the photograph shows");var band = root.Q("event-photo");// The layer's padding is reserved space, so only its content rectangle can leave room for a full header.@@ -666,8 +730,20 @@ public class UiLayoutTestsif (card.PhotoAlt == null) dropped++; else shown++;CheckCard($"{w}x{h}: {e.Id}", root, problems);var c = root.Q("event-card").worldBound;+ var body = root.Q<ScrollView>("event-scroll");foreach (var b in root.Q("event-options").Query<Button>().ToList())+ {+ // #1853: an option past the body's visible part is brought into view first, as Tab brings it.+ if (!Inside(b.worldBound, c))+ {+ body.ScrollTo(b);+ yield return null;+ if (!Inside(b.worldBound, body.contentViewport.worldBound))+ problems.Add($"{w}x{h}: {e.Id}: option '{b.text}' {b.worldBound} cannot be scrolled whole into the body {body.contentViewport.worldBound}");+ }if (!Inside(b.worldBound, c)) problems.Add($"{w}x{h}: {e.Id}: option '{b.text}' {b.worldBound} is cut off by the card {c}");+ }+ body.scrollOffset = Vector2.zero;}Debug.Log($"I6 {w}x{h}: {shown} photographs shown, {dropped} dropped");Assert.Greater(shown, 0, $"{w}x{h}: photographs show on this window");diff --git a/unity/Assets/UI/Game.uxml b/unity/Assets/UI/Game.uxmlindex 27b14f6c4..84e92fe58 100644--- a/unity/Assets/UI/Game.uxml+++ b/unity/Assets/UI/Game.uxml@@ -132,7 +132,7 @@<Statecraft.Game.UI.UiFrame filigree="true" /></ui:VisualElement></ui:VisualElement>- <ui:VisualElement name="info-panel" class="panel info-panel">+ <ui:ScrollView name="info-panel" class="panel info-panel"><!-- The selected hex's terrain sign on its map colour, beside its real facts (no tile yields: owner ruling). --><Statecraft.Game.UI.UiIcon name="info-thumb" class="info-thumb" /><ui:VisualElement class="info-body">@@ -176,10 +176,13 @@<ui:VisualElement name="info-projects" class="info-projects" /></ui:VisualElement><!-- The GDD loop's city counts and orders, or the designated site's state and Build/Stop (GddHexPanel, #381): a- second column beside the hex's facts, under them on the two- and three-row HUD (Statecraft.uss .info-gdd). -->- <ui:VisualElement name="info-gdd" class="info-gdd" />+ second column beside the hex's facts, under them on the two- and three-row HUD (Statecraft.uss .info-gdd).+ Hidden until GddHexPanel fills it (it sets the display on every render): shown empty on the two- and+ three-row HUD, its 100% width took the whole unwrapped row and left the facts column 0 px wide, so their+ text wrapped a word a line and the panel's height swung by over 1000 px between runs (#40). -->+ <ui:VisualElement name="info-gdd" class="info-gdd" style="display: none;" /><Statecraft.Game.UI.UiFrame filigree="true" />- </ui:VisualElement>+ </ui:ScrollView><!-- Star, Report and Share (#1236, CommunityIconsPresenter): three round icons at the foot of the side menu's lane, atthe bottom left (the info panel starts right of the lane). Icon-only as the side menu: each one's name is its text,drawn clear, and its tooltip (HoverTip). After the info panel in the tree, so Tab reaches them after its actions. -->@@ -213,12 +216,18 @@</ui:VisualElement></ui:VisualElement><ui:VisualElement class="gold-rule" />- <!-- event-alt-banner: a consequence card's road and the record beside it (#954), hidden on every other card;- inside the scroll, so on a short window it scrolls with the text and never pushes the options away. -->- <ui:ScrollView name="event-scroll" class="event-scroll"><ui:Label name="event-alt-banner" class="muted event-alt-banner" /><ui:Label name="event-text" class="event-text" /><ui:Label name="event-objective" class="muted event-objective" /></ui:ScrollView>- <!-- Shown only when the turn's Attention cannot pay for an answer (#1034): End Turn hands the card to its minister. -->- <ui:Label name="event-delegate" class="event-delegate" />- <ui:VisualElement name="event-options" />+ <!-- The body: the text and the options with their effect lines scroll together, between the pinned head+ above and the pinned foot below, only when they overflow the card's height (#1853, as the Cabinet's+ cards and house scroll together, 26 Oct). Tab on an option scrolls it into view (FocusScroll).+ event-alt-banner: a consequence card's road and the record beside it (#954), hidden on every other card. -->+ <ui:ScrollView name="event-scroll" class="event-scroll">+ <ui:Label name="event-alt-banner" class="muted event-alt-banner" />+ <ui:Label name="event-text" class="event-text" />+ <ui:Label name="event-objective" class="muted event-objective" />+ <!-- Shown only when the turn's Attention cannot pay for an answer (#1034): End Turn hands the card to its minister. -->+ <ui:Label name="event-delegate" class="event-delegate" />+ <ui:VisualElement name="event-options" />+ </ui:ScrollView><!-- The count of other open decisions, and Hide: the card collapses to "Decision waiting" so the map can beinspected (EventCardPresenter.Collapse); focus order: the options, then Hide. --><ui:VisualElement name="event-foot" class="event-foot">@@ -270,6 +279,8 @@</ui:VisualElement><ui:Label name="cabinet-status" class="muted" /></ui:VisualElement>+ <!-- Default order stays house, then seats. HudPresenter.FitCabinet moves the house to the end of+ cabinet-seats only under hud-tight.hud-scale-150.cabinet-cards-first. --><ui:VisualElement name="cabinet-main" class="cabinet-main grow"><ui:VisualElement name="cabinet-house" class="cabinet-house"><ui:VisualElement class="hemicycle-box">diff --git a/unity/Assets/UI/Statecraft.uss b/unity/Assets/UI/Statecraft.ussindex 618bb42fb..80be77fa2 100644--- a/unity/Assets/UI/Statecraft.uss+++ b/unity/Assets/UI/Statecraft.uss@@ -286,8 +286,8 @@ Button:disabled { color: var(--ink-dim); border-color: rgba(120, 120, 120, 0.4);}.event-reopen:hover { border-color: var(--gold-light); }/* Up to 1040 px wide, its 960 px content holding the 16:9 media header at 960x540 (the photographs' and the clips' size);- the layer bounds its height. When the window is short the media header gives way first, then the text (it scrolls),- never the option buttons. */+ the layer bounds its height. When the window is short the media header gives way first, then the body: the text and+ the options scroll together (event-scroll, #1853), while the head and the foot with Hide stay in the card. */.event-card { width: 1040px; max-width: 100%; max-height: 100%; flex-shrink: 1; min-height: 0; overflow: hidden; padding: 16px 40px 10px 40px; }.hud-two-row .event-card { padding-left: 16px; padding-right: 16px; }/* The card takes the keyboard focus when an event opens (EventCardPresenter.FocusCard): a lighter gold edge says so. */@@ -1023,6 +1023,104 @@ Button.settings-choice-selected { -unity-font-definition: url("project://databas.hud-two-row .info-panel.info-gdd-shown { width: 452px; flex-wrap: wrap; }.hud-two-row .info-gdd { width: 100%; margin: 8px 0 0 0; padding: 8px 0 0 0; border-left-width: 0; border-right-width: 0; border-top-width: 1px; }+/* The tight HUD (#40, the UI scale's 125% and 150% - HudPresenter.TightClass): a window at 125% or 150% has a logical+ size smaller than any the 100% layout is tested at, in both directions at once (1920x1080 at 150% is 1280x720+ logical). The stacked bar, the icon column, the decision layer and the panels take their tight sizes below, so the+ HUD holds at those sizes. The bounds (HudPresenter.TightBelowHeightPx and friends) sit between the smallest sizes the+ 100% suites pin and the sizes only a scale choice reaches. At 100% only a phone held upright (narrower than+ TightBelowWidthPx, 390x844 is about 790 logical px) is tight. */+/* The bar keeps its tier shapes, tightened: the rows the tiers wrap, at sizes the small logical height can pay. The+ three-row height is a floor the rows can outgrow (HudPresenter.PlaceUnderBar, TightThreeRowBarPx). */+.hud-tight.hud-narrow .top-bar { height: 96px; }+.hud-tight.hud-two-row .top-bar { height: 172px; }+/* The tight two-row bar's meters take 79% of it, not 78%: at 960x600 on 125% (1455 logical px) the plate, 78% and New Game+ still fitted the first row, and End Turn wrapped alone under the plate, out of the bar (TopBarTests). At 79% New Game+ and End Turn share the second row on every tight two-row width, 1213 to 1455 px, as on the two-row bar at 100%; at+ 80% the meters no longer fit beside the plate at 1213 px. Its rows grow it past 172 px when the text floor raises the+ plate (HudPresenter.PlaceUnderBar, TightTwoRowBarPx). */+.hud-tight.hud-two-row .meters { width: 79%; }+.hud-tight.hud-three-row .meters { width: 100%; } /* the three-row bar is two-row too: its meters keep their own row */+.hud-tight.hud-three-row .top-bar { height: 200px; }+.hud-tight .top-bar { padding-top: 4px; padding-bottom: 3px; }+.hud-tight .meter { min-width: 0; padding: 0 4px; }+.hud-tight .meter-value { font-size: 16px; }+.hud-tight .meter-delta { font-size: 12px; }+/* The tight three-row bar keeps the narrow bar's values (22 px, deltas 15 px): a phone held upright at 100% is tight too,+ and at its 0.49 scale 16 px values were 8 screen px, smaller than the floored captions above them. Its rows grow the+ bar (PlaceUnderBar). */+.hud-tight.hud-three-row .meter-value { font-size: 22px; }+.hud-tight.hud-three-row .meter-delta { font-size: 15px; }+.hud-tight.hud-narrow .right-column, .hud-tight.hud-narrow .left-column, .hud-tight.hud-narrow .event-gutter, .hud-tight.hud-narrow .event-layer, .hud-tight.hud-narrow .screen, .hud-tight.hud-narrow .toast { top: 108px; }+.hud-tight.hud-two-row .right-column, .hud-tight.hud-two-row .left-column, .hud-tight.hud-two-row .event-gutter, .hud-tight.hud-two-row .event-layer, .hud-tight.hud-two-row .screen, .hud-tight.hud-two-row .toast { top: 184px; }+.hud-tight.hud-three-row .right-column, .hud-tight.hud-three-row .left-column, .hud-tight.hud-three-row .event-gutter, .hud-tight.hud-three-row .event-layer, .hud-tight.hud-three-row .screen, .hud-tight.hud-three-row .toast { top: 212px; }+/* The icon column: 40 px discs, 4 px apart, so six of them end at 372 px under the tight narrow bar and 448 px under+ the tight two-row one, and the info panel caps below them. On the tight three-row window they become a row instead+ (below). */+.hud-tight .left-column { width: 46px; }+.hud-tight .left-column .rail-button { width: 40px; height: 40px; margin: 0 0 4px 0; }+.hud-tight .left-column .rail-button .nav-disc { width: 40px; height: 40px; padding: 9px; border-radius: 20px; }+/* On the tight three-row bar the column is a ROW under it: the upright discs would not fit between the bar and the+ window's foot on a short window, while a row takes only one disc's height. The discs keep the phone's 60 px (the+ three-row column's above): a phone held upright at 100% is tight too, and its panel scale falls to about 0.41+ (375x667), where 60 px is still 24 screen px (LeftColumnTests). In Hebrew the row mirrors and stays at the left, as+ the column does (#550). The panels below it start under the row (top 276 px: the row's 212, its 60 and a 4 px gap).+ The row spans the window less 8 px each side (the full-window screen's inset) and the discs stand 2 px apart (the+ column's own gap at 100%), so the eight of them (494 px) fit the narrowest tight phone, 360x800 at 150% (517 logical+ px wide; LeftColumnTests), with the row's left edge inside the column test's 3% of the window. */+.hud-tight.hud-three-row .left-column { left: 8px; right: 8px; top: 212px; width: auto; flex-direction: row; align-items: flex-start; }+.hud-tight.hud-three-row .left-column > .rail-button { width: 60px; height: 60px; margin: 0 2px 0 0; }+.lang-he.hud-tight.hud-three-row .left-column { flex-direction: row-reverse; justify-content: flex-end; }+.hud-tight.hud-three-row .left-column > .rail-button .nav-disc { width: 60px; height: 60px; padding: 14px; border-radius: 30px; }+.hud-tight.hud-three-row .right-column, .hud-tight.hud-three-row .event-layer, .hud-tight.hud-three-row .toast { top: 276px; }+/* A screen on the tight three-row window takes the window (the mobile-modal pattern): the tight bar and the rail row+ leave no usable strip for one at 853x480 logical (150% on 1280x720). The rail and the bar wait under it; the screen's+ own X closes it (ScreenNav). The two-row rule already hides the right column and the info panel while one is open.+ The toast keeps the two-row rule's place at the window's foot, over the screen's bottom edge, clear of its header. */+.hud-tight.hud-three-row .screen { top: 8px; left: 8px; right: 8px; bottom: 8px; }+.hud-tight.hud-three-row.screen-open .toast { top: auto; }+/* The backdrop's strip and its scrim start at the tight column's right edge; the band over the bar-to-layer gap narrows+ to the tight gap (12 px). On the tight three-row window the column is the rail row: the band stays the 12 px from the+ bar to the row's top, the strip takes over across the window's width from there to the layer's top (the row's 60 px+ and its 4 px gap), still under the buttons, and the scrim spans the window from the layer's top. */+.hud-tight .event-gutter { width: 62px; }+.hud-tight .event-scrim { left: 46px; }+.hud-tight .event-scrim-top { top: -12px; height: 12px; }+.hud-tight.hud-three-row .event-gutter { top: 212px; bottom: auto; left: 0; right: 0; width: auto; height: 64px; }+.hud-tight.hud-three-row .event-scrim { left: -16px; }+.hud-tight.hud-three-row .event-scrim-top { top: -76px; height: 12px; }+/* The decision card starts right of the tight column (the three-row rule's reason, now at every tight tier): the+ column's 46 px at the layer's 16 px, so a narrow window never lays the card over it. */+.hud-tight .event-layer { padding-left: 54px; }+.hud-tight.hud-three-row .event-layer { padding-left: 0; }+/* The info panel never rises into the bar or the side menu: on a tight window HudPresenter.FitInfoPanel caps its height+ below the lower of them (the column, or the rail row on the three-row bar), and on the tight three-row window its+ width clear of the minimap (222 px; it keeps its size there, so its 50 px buttons stay at least 24 screen px on a+ phone held upright, MinimapReliefTests), or, where that leaves the panel too narrow (a phone at 125% or 150%), it+ stands above the minimap and its caption at the window's width. The caps are set in code from laid-out bounds: Unity's USS has no+ calc(). Content taller than the cap scrolls: the panel is a ScrollView now (Game.uxml), its rows laid out by the+ scroll content container. */+.info-panel .unity-scroll-view__content-container { flex-direction: row; align-items: flex-start; }+/* The ScrollView itself lays out its viewport and scroller, not the rows: a column that stretches them, as a ScrollView's+ own default. With the panel's row and flex-start (and Hebrew's row-reverse) the viewport took its content's measured+ width, which varied between layout passes: in a busy run the content was laid out 341 px wide and 1200 px tall at+ 390x844, and the panel grew into the border caption (ControlTests, 2 of 5 full runs). */+.info-panel.unity-scroll-view, .lang-he .info-panel.unity-scroll-view { flex-direction: column; align-items: stretch; }+/* In Hebrew the rows mirror as on the row-reversed panel before (#550): the ScrollView's own row-reverse does not reach the+ content container, which lays the rows out (owner decision on #1135, 22 Oct 2026). */+.lang-he .info-panel .unity-scroll-view__content-container { flex-direction: row-reverse; }+.hud-two-row .info-panel.info-gdd-shown .unity-scroll-view__content-container { flex-wrap: wrap; }+/* The pioneer list (#1788) is a ScrollView inside the panel: the three rules above reach its content container too, and+ laid its entries out in one row (InfoPanelLayoutTests' pioneer tests). Its own content stays a list. */+.info-panel .pioneer-list .unity-scroll-view__content-container,+.lang-he .info-panel .pioneer-list .unity-scroll-view__content-container,+.hud-two-row .info-panel.info-gdd-shown .pioneer-list .unity-scroll-view__content-container { flex-direction: column; align-items: stretch; flex-wrap: nowrap; }+/* The Cabinet on a tight window: a slimmer side column and a smaller half circle, so the seats list keeps its room. */+.hud-tight .cabinet-side { width: 220px; }+.hud-tight .pm-card .card-plate { height: 180px; }+.hud-tight .cabinet-house { padding: 6px 10px; margin-bottom: 6px; }+.hud-tight .screen { padding: 10px; }+.hud-tight .screen-header { margin-bottom: 6px; padding-bottom: 2px; }+/* #955: paired answers remain side by side, wrapping within equal columns. */.timeline-columns { flex-direction: row; align-items: stretch; }.timeline-columns > Label { flex-basis: 0; flex-grow: 1; min-width: 0; padding-left: 8px; padding-right: 8px; white-space: normal; }@@ -1090,6 +1188,38 @@ Button.settings-choice-selected { -unity-font-definition: url("project://databas/* Playtest B6: the city's name over its block on a hex that holds two cities (GddHexPanel.CityNameClass). */.city-part-name { -unity-font-style: bold; color: var(--gold-light); margin-top: 6px; }+/* Owner 26 Oct: cards first at 150% on short windows. HudPresenter moves the house after the cards in the same scroll.+ The base row/wrap (including Hebrew row-reverse) still lays out cards; the house starts its own final row. */+.hud-tight.hud-scale-150.cabinet-cards-first #cabinet-seats .cabinet-house {+ width: 100%; margin-left: 0; margin-right: 0;+}+/* Only the existing phone tier at 150% gives up the 320x168 pin. Height follows width in FitCabinet, at 168/320. */+.hud-tight.hud-three-row.hud-scale-150.cabinet-phone-150 .cabinet-house .hemicycle-box {+ width: 100%; max-width: 320px; margin-left: 0; margin-right: 0;+}+/* The phone column (about 246 px) has no room for the half circle and the legend side by side: the house stacks them, the+ half circle centred over the legend. In one wrapping row the legend shrank to 0 px beside the box and ran 14000 px tall. */+.hud-tight.hud-three-row.hud-scale-150.cabinet-phone-150 .cabinet-house,+.lang-he.hud-tight.hud-three-row.hud-scale-150.cabinet-phone-150 .cabinet-house { flex-direction: column; align-items: stretch; }+.hud-tight.hud-three-row.hud-scale-150.cabinet-phone-150 .cabinet-house .hemicycle-box { align-self: center; }+.hud-tight.hud-three-row.hud-scale-150.cabinet-phone-150 .cabinet-house .house-legend { min-width: 0; flex-shrink: 0; }+/* The legend's lines and party chips wrap in the narrow column rather than run past it. */+.hud-tight.hud-three-row.hud-scale-150.cabinet-phone-150 .house-legend > Label,+.hud-tight.hud-three-row.hud-scale-150.cabinet-phone-150 .party-chip > Label { white-space: normal; }+.hud-tight.hud-three-row.hud-scale-150.cabinet-phone-150 .party-chip,+.hud-tight.hud-three-row.hud-scale-150.cabinet-phone-150 .party-chip > Label { flex-shrink: 1; min-width: 0; }++/* Owner ruling, 27 October: "Compact card + allow scroll (Recommended)" (#1135). At 150% on a tight window the head is compact, so the+ longest cards (#1545's Jerusalem and Rafah follow-ups) keep Hide and the options inside the card. Same 3:4 portrait+ (EventCardPresenter frames it by aspect), smaller; the title one step down. 100% and 125% are unchanged. */+.hud-tight.hud-scale-150 .event-card { padding-top: 8px; padding-bottom: 4px; }+.hud-tight.hud-scale-150 .event-hide { margin-top: 0; padding-top: 1px; padding-bottom: 1px; }+.hud-tight.hud-scale-150 .event-head { padding: 2px; margin-bottom: 0; }+.hud-tight.hud-scale-150 .event-option { margin: 2px 0; }+.hud-tight.hud-scale-150 .event-image { width: 60px; height: 80px; margin-right: 8px; }+.lang-he.hud-tight.hud-scale-150 .event-image { margin-right: 0; margin-left: 8px; }+.hud-tight.hud-scale-150 .event-title { font-size: 24px; margin-bottom: 2px; }+/* #731: purchase controls remain inside Defence's scroll view; entered numbers must stay visible. */.arms-actions { flex-wrap: wrap; }#arms-count { min-width: 0; flex-shrink: 1; }