Fixed grid alignment issue

This commit is contained in:
Yousef Khadadeh 2026-04-21 18:52:11 +03:00
parent c75c668bf7
commit 06dd550067
2 changed files with 2 additions and 3 deletions

View file

@ -24,7 +24,7 @@ void GridScrollArea::layout(const Clay_ElementId& id, const Options& o) {
opts.entryCount = rowCount;
uint16_t xPadding = 0;
if(rowCount > 1 || (rowCount == 1 && ((options.entryCount + entriesPerRow) / entriesPerRow) > 1)) // More than 1 row or 1st row is full
xPadding = static_cast<float>(std::max<float>(rowWidth - (entriesPerRow * options.entryWidth), 0) / (entriesPerRow * 2));
xPadding = static_cast<float>(std::max<float>(rowWidth - (entriesPerRow * options.entryWidth), 0) / (entriesPerRow + 1));
opts.elementContent = [&] (size_t rowIndex) {
gui.new_id("grid row", [&] {

View file

@ -57,8 +57,7 @@ void FileSelectScreen::gui_layout_run() {
}
}) {
CLAY_AUTO_ID({
.layout = { .sizing = {.width = CLAY_SIZING_FIXED(150), .height = CLAY_SIZING_GROW(0) }},
.aspectRatio = { .aspectRatio = 1.0f }
.layout = { .sizing = {.width = CLAY_SIZING_FIXED(150), .height = CLAY_SIZING_FIXED(150) }},
}) {
gui.element<ImageDisplay>("ico", ImageDisplay::Data{
.imgPath = main.conf.configPath / "saveThumbnails" / (fileList[i].fileName + ".jpg"),