diff --git a/src/ui/windows/market_tab.cpp b/src/ui/windows/market_tab.cpp index 589d221..707d39a 100644 --- a/src/ui/windows/market_tab.cpp +++ b/src/ui/windows/market_tab.cpp @@ -1708,6 +1708,10 @@ static void mktDrawPortfolio(const MktCtx& cx) ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0, 0)); ImGui::BeginChild("##pfRows", ImVec2(availWidth, rowsH), false); ImGui::PopStyleVar(); + // Zero item-spacing INSIDE the child: each row emits an InvisibleButton + a gap Dummy, and + // ImGui's default ItemSpacing.y between those items would inflate the content past rowsH and + // clip the last row (and widen the gaps). The inter-row gap is controlled by the Dummy below. + ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0, 0)); ImDrawList* rdl = ImGui::GetWindowDrawList(); float rowW = ImGui::GetContentRegionAvail().x; // narrows automatically if a scrollbar shows if (vis.empty()) { @@ -1728,6 +1732,7 @@ static void mktDrawPortfolio(const MktCtx& cx) if (vi + 1 < (int)vis.size()) ImGui::Dummy(ImVec2(rowW, rowGap)); } } + ImGui::PopStyleVar(); // ItemSpacing ImGui::EndChild(); } @@ -1836,9 +1841,13 @@ void RenderMarketTab(App* app) float pfRowH = (pfStyle == 0 ? 46.0f : pfStyle == 1 ? 64.0f : 84.0f) * mktDp; float pfRowGap = Layout::spacingSm(); const int pfMaxVisibleRows = 4; // rows shown before the list scrolls - float pfWantH = (pfVisN > 0) ? (pfVisN * pfRowH + std::max(0, pfVisN - 1) * pfRowGap) : 0.0f; - float pfCapH = pfMaxVisibleRows * pfRowH + (pfMaxVisibleRows - 1) * pfRowGap; - float pfGroupsH = std::min(pfWantH, pfCapH); + // Height for up to pfMaxVisibleRows rows. ItemSpacing is zeroed inside the row child, so the + // content is exactly rows + inter-row gaps; one extra gap of bottom breathing room keeps the + // last visible row off the clip edge. More groups than this scroll internally. + int pfVisRows = std::min(pfVisN, pfMaxVisibleRows); + float pfGroupsH = (pfVisRows > 0) + ? (pfVisRows * pfRowH + (pfVisRows - 1) * pfRowGap + pfRowGap) + : 0.0f; float portfolioH = pfSummaryH + pfGroupsH; // Chart series for the selected interval (timestamped), shared by the hero change badge and