fix: first wall row sizing when < max
Pad number of wallpapers to the number of walls in a row so when < they dont expand to fill the entire row
This commit is contained in:
parent
a1034b0237
commit
210130de43
2 changed files with 24 additions and 5 deletions
|
|
@ -26,13 +26,22 @@ PageBase {
|
|||
columnSpacing: Tokens.spacing.large
|
||||
|
||||
Repeater {
|
||||
model: Wallpapers.list.filter(w => Wallpapers.getCategoryFor(w) === root.nState.selectedWallpaperCategory).sort((a, b) => a.name.localeCompare(b.name))
|
||||
model: {
|
||||
const walls = Wallpapers.list.filter(w => Wallpapers.getCategoryFor(w) === root.nState.selectedWallpaperCategory).sort((a, b) => a.name.localeCompare(b.name));
|
||||
while (walls.length < Config.nexus.wallpapersPerRow)
|
||||
walls.push(null);
|
||||
return walls;
|
||||
}
|
||||
|
||||
WallItem {
|
||||
required property FileSystemEntry modelData
|
||||
|
||||
source: modelData.path
|
||||
text: modelData.name
|
||||
// Empty placeholders for sizing
|
||||
opacity: modelData ? 1 : 0
|
||||
enabled: modelData
|
||||
|
||||
source: String(modelData?.path ?? "")
|
||||
text: modelData?.name ?? ""
|
||||
onClicked: {
|
||||
Wallpapers.setWallpaper(modelData.path);
|
||||
root.nState.closeSubPage();
|
||||
|
|
|
|||
|
|
@ -109,14 +109,24 @@ PageBase {
|
|||
categories[category] = w;
|
||||
}
|
||||
}
|
||||
return Object.values(categories);
|
||||
const cats = Object.values(categories);
|
||||
while (cats.length < Config.nexus.wallpapersPerRow)
|
||||
cats.push(null);
|
||||
return cats;
|
||||
}
|
||||
|
||||
WallItem {
|
||||
required property FileSystemEntry modelData
|
||||
|
||||
source: modelData.path
|
||||
// Empty placeholders for sizing
|
||||
opacity: modelData ? 1 : 0
|
||||
enabled: modelData
|
||||
|
||||
source: String(modelData?.path ?? "")
|
||||
text: {
|
||||
if (!modelData)
|
||||
return "";
|
||||
|
||||
if (modelData.parentDir !== Paths.wallsdir) {
|
||||
const category = Wallpapers.getCategoryFor(modelData);
|
||||
return category.slice(0, 1).toUpperCase() + category.slice(1);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue