feat(image-picker): thumbnails fill width at 6 per row
Fix the thumbnail grid to a constant 6 columns whose square cells scale to the available width, instead of fixed 96px cells that left dead space on the right. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -207,12 +207,12 @@ public:
|
||||
if (!s_images.empty()) ImGui::Dummy(ImVec2(0, Layout::spacingSm())); // gap before the thumbnails
|
||||
}
|
||||
|
||||
// Thumbnail grid.
|
||||
// Thumbnail grid: a fixed 6 columns whose square cells scale to fill the width.
|
||||
{
|
||||
const float availW = ImGui::GetContentRegionAvail().x;
|
||||
const float cell = 96.0f * dp;
|
||||
const float gap = Layout::spacingSm();
|
||||
const int cols = std::max(1, (int)((availW + gap) / (cell + gap)));
|
||||
const int cols = 6;
|
||||
const float cell = std::max(24.0f * dp, (availW - gap * (cols - 1)) / (float)cols);
|
||||
int col = 0;
|
||||
for (std::size_t i = 0; i < s_images.size(); ++i) {
|
||||
if (col != 0) ImGui::SameLine(0, gap);
|
||||
|
||||
Reference in New Issue
Block a user