feat(ui): width-responsiveness — content max-width cap + per-surface form/input clamps
Wide/ultrawide (1440-3440px) responsiveness was unhealthy: no page/content-level max-width cap existed, and every card/form/table derived width from raw GetContentRegionAvail().x with floor-only clamps, so surfaces stretched edge-to-edge (2000-3000px inputs, ballooning cards, giant grid cells, 2000px+ dead row-voids). Root cause: adopt the (previously dead-code) clamp helpers. - New Layout::kContentMaxWidth() (~1600dp, tunable via ui.toml [layout] content-max-width; <=0 disables). Cap ##ContentArea to it and center the column in wider windows — every tab derives from this child, so one change tames the app at wide widths. No-op below the cap (fills as before), so 1080p/1440p are unaffected. Per-surface upper-clamps (std::min(cap*dp, expr), floors preserved) where a single element is still too wide even within the capped column: - Settings: Theme/Layout/Language combos, the font-scale slider (~3000px -> 360dp), the effect sliders, Explorer URL and RPC credential fields. - Send / Receive: cap the compose / receive cards to a readable form width and center them (Indent(pad+offset) so the auto-layout fields align with the hand-drawn card); the recent-tx lists below keep the full column width. - Chat message bubbles + composer, mining pool URL/payout inputs + stats left/right split, contacts search, and the lite-network add-server row / server cards / status panel (capped + centered). - Wizard: vertically center the cards when they fit (was top-anchored, leaving a void on tall monitors), compensating the content-height measurement so it can't oscillate. The 1600 cap also subsumes the fixed-4-column balance grids (~400px cards) and the right-anchored row dead-gaps (voids shrink from ~2700px to ~800px), so those are left to the cap rather than blind column/row redesigns. Verified at 1024/1280 (and via a temporary 900dp cap to exercise the cap+center path, since the test display clamps to 1280) across full-node + Lite + Windows (ctest green) and an adversarial diff review (clean). The true wide/ultrawide look and the 1600dp cap value still want eyes on a real wide monitor. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
15
src/app.cpp
15
src/app.cpp
@@ -1875,10 +1875,21 @@ void App::render()
|
||||
float caPadY = caWin.padding[1] > 0.0f ? caWin.padding[1] : ImGui::GetStyle().WindowPadding.y;
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(caPadX, caPadY));
|
||||
|
||||
// Capture content area screen position for edge fade mask
|
||||
// Cap the content column to a readable max width and center it in wider windows. Every tab derives
|
||||
// its cards/forms/tables from this child's width, so an uncapped fill stretches them edge-to-edge on
|
||||
// wide/ultrawide displays. No-op below the cap (fills as before).
|
||||
float caAvailW = ImGui::GetContentRegionAvail().x;
|
||||
float caMaxW = ui::Layout::kContentMaxWidth();
|
||||
float caChildW = 0.0f; // 0 -> fill remaining width (default, and whenever the window is below the cap)
|
||||
if (caMaxW > 0.0f && caAvailW > caMaxW) {
|
||||
caChildW = caMaxW;
|
||||
ImGui::SetCursorPosX(ImGui::GetCursorPosX() + (caAvailW - caMaxW) * 0.5f);
|
||||
}
|
||||
|
||||
// Capture content area screen position for edge fade mask (after any centering offset)
|
||||
ImVec2 caScreenPos = ImGui::GetCursorScreenPos();
|
||||
|
||||
ImGui::BeginChild("##ContentArea", ImVec2(0, contentH), false, contentFlags);
|
||||
ImGui::BeginChild("##ContentArea", ImVec2(caChildW, contentH), false, contentFlags);
|
||||
|
||||
// Persistent node/RPC error banner — drawn first (before the edge-fade vertex capture below,
|
||||
// so it stays fully opaque) and above every page / overlay in the content column. It renders
|
||||
|
||||
Reference in New Issue
Block a user