feat(settings): stack the rescan slider above the height field

Lay the optional scan-from-height control out vertically: the send-tab-style
slider spans the full row on top, with the numeric field full-width directly
beneath it (both were previously side by side). Reads more clearly and gives
the slider room; the unsynced fallback (field only) is unchanged.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-07-13 16:04:23 -05:00
parent 0c55ed0fe4
commit c25da0d26d

View File

@@ -2762,9 +2762,10 @@ static std::string formatIntWithCommas(long long v)
} }
// A send-tab-style slider (mirrors RenderAmountBar in send_tab.cpp: rounded track, accent fill, glass // A send-tab-style slider (mirrors RenderAmountBar in send_tab.cpp: rounded track, accent fill, glass
// thumb) for the optional rescan start height, paired with a numeric field for exact entry. Both share // thumb) for the optional rescan start height, stacked above a full-width numeric field for exact
// `buf` — the height as a decimal string — so it's the single source of truth. `tipHeight` is the chain // entry. Both share `buf` — the height as a decimal string — so it's the single source of truth.
// tip = the slider's max; when <= 0 (height unknown) the slider is omitted and the field spans the row. // `tipHeight` is the chain tip = the slider's max; when <= 0 (height unknown) the slider is omitted
// and only the field shows.
static void RenderScanHeightControl(char* buf, size_t bufSize, int tipHeight, bool enabled, float dp) static void RenderScanHeightControl(char* buf, size_t bufSize, int tipHeight, bool enabled, float dp)
{ {
namespace m = ui::material; namespace m = ui::material;
@@ -2773,13 +2774,9 @@ static void RenderScanHeightControl(char* buf, size_t bufSize, int tipHeight, bo
ImGui::BeginDisabled(!enabled); ImGui::BeginDisabled(!enabled);
const float inputW = 148.0f * dp;
if (tipHeight > 0) { if (tipHeight > 0) {
const float gap = ui::Layout::spacingSm(); const float barW = ImGui::GetContentRegionAvail().x; // slider spans the full row, stacked above the field
float barW = ImGui::GetContentRegionAvail().x - inputW - gap; const float barH = ImGui::GetFrameHeight(); // match the numeric field's height (already dp-scaled)
const float minBar = 120.0f * dp;
if (barW < minBar) barW = minBar;
const float barH = ImGui::GetFrameHeight(); // match the numeric field's height so the two align (already dp-scaled)
const float barRound = barH * 0.5f; const float barRound = barH * 0.5f;
const float thumbR = barH * 0.5f; const float thumbR = barH * 0.5f;
@@ -2817,11 +2814,10 @@ static void RenderScanHeightControl(char* buf, size_t bufSize, int tipHeight, bo
m::Tooltip("%s / %s (%.0f%%)", formatIntWithCommas(cur).c_str(), m::Tooltip("%s / %s (%.0f%%)", formatIntWithCommas(cur).c_str(),
formatIntWithCommas(tipHeight).c_str(), pct * 100.0f); formatIntWithCommas(tipHeight).c_str(), pct * 100.0f);
} }
ImGui::SameLine(0, gap);
} }
// Exact numeric entry — fills the remaining row (or the whole row when there's no slider). // Exact numeric entry — full-width row beneath the slider.
ImGui::SetNextItemWidth(tipHeight > 0 ? inputW : ImGui::GetContentRegionAvail().x); ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
ImGui::InputText("##importscanheight", buf, bufSize, ImGuiInputTextFlags_CharsDecimal); ImGui::InputText("##importscanheight", buf, bufSize, ImGuiInputTextFlags_CharsDecimal);
ImGui::EndDisabled(); ImGui::EndDisabled();