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) <noreply@anthropic.com>
This commit is contained in:
@@ -104,6 +104,12 @@ public:
|
|||||||
|
|
||||||
std::string pendingNav;
|
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 ------------------------------
|
// ---- Path bar: Up + Home + Pictures + current path strip ------------------------------
|
||||||
{
|
{
|
||||||
const float bh = ImGui::GetFrameHeight();
|
const float bh = ImGui::GetFrameHeight();
|
||||||
@@ -240,19 +246,25 @@ public:
|
|||||||
Type().textColored(TypeStyle::Caption, OnSurfaceDisabled(), TR("img_picker_none"));
|
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::Dummy(ImVec2(0, Layout::spacingSm()));
|
||||||
ImGui::Separator();
|
{
|
||||||
ImGui::Dummy(ImVec2(0, Layout::spacingSm()));
|
const float useW = 200.0f * dp, cancelW = 120.0f * dp;
|
||||||
ImGui::BeginDisabled(s_selected.empty());
|
const float total = useW + cancelW + ImGui::GetStyle().ItemSpacing.x;
|
||||||
if (StyledButton(TR("img_picker_use"), ImVec2(200.0f * dp, 0))) {
|
ImGui::SetCursorPosX(ImGui::GetCursorPosX() +
|
||||||
if (s_onPick && !s_selected.empty()) s_onPick(s_selected);
|
std::max(0.0f, (ImGui::GetContentRegionAvail().x - total) * 0.5f));
|
||||||
s_open = false;
|
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();
|
EndOverlayDialog();
|
||||||
|
|
||||||
if (!pendingNav.empty()) navigate(pendingNav);
|
if (!pendingNav.empty()) navigate(pendingNav);
|
||||||
|
|||||||
Reference in New Issue
Block a user