fix(market): stop portfolio group rows overlapping; center modal button text
- The per-row delete icon's SetCursorScreenPos left the ImGui cursor at the icon, so the next group row started too high and rows overlapped. Capture the row's end cursor after the Selectable and restore it after drawing the delete icon. - Force centered button-label alignment for the modal (ButtonTextAlign 0.5,0.5) so the footer/Add buttons read consistently. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -428,6 +428,7 @@ static void RenderPortfolioEditor(App* app)
|
||||
ImGui::PushStyleColor(ImGuiCol_ChildBg, ImVec4(0, 0, 0, 0));
|
||||
ImGui::BeginChild("##pfCard", ImVec2(cardW, cardH), ImGuiChildFlags_None, ImGuiWindowFlags_NoScrollbar);
|
||||
ImGui::PopStyleVar(); // pop WindowPadding — the 28x20 applies to ##pfCard only, not nested children
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_ButtonTextAlign, ImVec2(0.5f, 0.5f)); // centered button labels
|
||||
|
||||
material::DrawDialogTitleBar(TR("portfolio_manage_title"), nullptr); // no X — Close is in the footer
|
||||
if (ImGui::IsKeyPressed(ImGuiKey_Escape)) s_portfolio_editor_open = false;
|
||||
@@ -466,6 +467,7 @@ static void RenderPortfolioEditor(App* app)
|
||||
if (ImGui::Selectable("##pfgrp", selRow, ImGuiSelectableFlags_SpanAvailWidth, ImVec2(0, rowH))) {
|
||||
if (i != s_pf_sel) clickedSel = i;
|
||||
}
|
||||
ImVec2 rowNext = ImGui::GetCursorScreenPos(); // next-row cursor (the delete button moves it)
|
||||
ImVec2 rmx(rmn.x + ImGui::GetItemRectSize().x, rmn.y + rowH);
|
||||
bool rowHov = ImGui::IsItemHovered();
|
||||
ImU32 accent = en.color ? (ImU32)en.color : WithAlpha(OnSurface(), 60);
|
||||
@@ -498,6 +500,7 @@ static void RenderPortfolioEditor(App* app)
|
||||
ImVec2 isz = iconFont->CalcTextSizeA(iconFsz, FLT_MAX, 0, ICON_MD_DELETE_OUTLINE);
|
||||
mdl->AddText(iconFont, iconFsz, ImVec2(dmn.x + (ds - isz.x) * 0.5f, dmn.y + (ds - isz.y) * 0.5f),
|
||||
dhov ? Error() : OnSurfaceMedium(), ICON_MD_DELETE_OUTLINE);
|
||||
ImGui::SetCursorScreenPos(rowNext); // restore flow so the next row isn't offset
|
||||
}
|
||||
ImGui::PopID();
|
||||
}
|
||||
@@ -924,7 +927,7 @@ static void RenderPortfolioEditor(App* app)
|
||||
|
||||
ImGui::EndChild(); // ##pfCard
|
||||
ImGui::PopStyleColor();
|
||||
ImGui::PopStyleVar(); // ChildRounding (WindowPadding was popped right after BeginChild)
|
||||
ImGui::PopStyleVar(2); // ChildRounding + ButtonTextAlign (WindowPadding was popped after BeginChild)
|
||||
|
||||
// Outside-click dismiss (guarded against the appearing frame and open popups).
|
||||
if (!popupOpen && !ImGui::IsWindowAppearing() && ImGui::IsMouseClicked(ImGuiMouseButton_Left)
|
||||
|
||||
Reference in New Issue
Block a user