From bc3c6037fc3ce192d96b396ae3d36a9ed98db947 Mon Sep 17 00:00:00 2001 From: DanS Date: Wed, 15 Jul 2026 09:09:18 -0500 Subject: [PATCH] fix(image-picker): inset content from rounded card + center footer - Wrap the picker body in a padded inner child so the filled directory list and thumbnail grid keep a clear margin from the card's rounded corners instead of running edge-to-edge past them. - Center the Use image / Cancel buttons and drop the stray separator line above them (the faint artifact at the footer's left edge). Co-Authored-By: Claude Opus 4.8 (1M context) --- src/ui/windows/image_picker.h | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/src/ui/windows/image_picker.h b/src/ui/windows/image_picker.h index 00bbafb..5dd26f6 100644 --- a/src/ui/windows/image_picker.h +++ b/src/ui/windows/image_picker.h @@ -104,6 +104,12 @@ public: std::string pendingNav; + // Inner padded body so the filled list + thumbnail grid keep a clear margin from the card's + // rounded edges (the overlay's own content padding is tight for edge-to-edge filled content). + ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(10.0f * dp, 8.0f * dp)); + ImGui::BeginChild("##imgPickBody", ImVec2(0, 0), ImGuiChildFlags_AlwaysUseWindowPadding, + ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse); + // ---- Path bar: Up + Home + Pictures + current path strip ------------------------------ { const float bh = ImGui::GetFrameHeight(); @@ -240,19 +246,25 @@ public: Type().textColored(TypeStyle::Caption, OnSurfaceDisabled(), TR("img_picker_none")); } - // ---- Footer: Use image / Cancel -------------------------------------------------------- + // ---- Footer: Use image / Cancel (centered) --------------------------------------------- ImGui::Dummy(ImVec2(0, Layout::spacingSm())); - ImGui::Separator(); - ImGui::Dummy(ImVec2(0, Layout::spacingSm())); - ImGui::BeginDisabled(s_selected.empty()); - if (StyledButton(TR("img_picker_use"), ImVec2(200.0f * dp, 0))) { - if (s_onPick && !s_selected.empty()) s_onPick(s_selected); - s_open = false; + { + const float useW = 200.0f * dp, cancelW = 120.0f * dp; + const float total = useW + cancelW + ImGui::GetStyle().ItemSpacing.x; + ImGui::SetCursorPosX(ImGui::GetCursorPosX() + + std::max(0.0f, (ImGui::GetContentRegionAvail().x - total) * 0.5f)); + ImGui::BeginDisabled(s_selected.empty()); + if (StyledButton(TR("img_picker_use"), ImVec2(useW, 0))) { + if (s_onPick && !s_selected.empty()) s_onPick(s_selected); + s_open = false; + } + ImGui::EndDisabled(); + ImGui::SameLine(); + if (StyledButton(TR("cancel"), ImVec2(cancelW, 0))) s_open = false; } - ImGui::EndDisabled(); - ImGui::SameLine(); - if (StyledButton(TR("cancel"), ImVec2(120.0f * dp, 0))) s_open = false; + ImGui::EndChild(); // ##imgPickBody + ImGui::PopStyleVar(); // WindowPadding EndOverlayDialog(); if (!pendingNav.empty()) navigate(pendingNav);