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
|
columnSpacing: Tokens.spacing.large
|
||||||
|
|
||||||
Repeater {
|
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 {
|
WallItem {
|
||||||
required property FileSystemEntry modelData
|
required property FileSystemEntry modelData
|
||||||
|
|
||||||
source: modelData.path
|
// Empty placeholders for sizing
|
||||||
text: modelData.name
|
opacity: modelData ? 1 : 0
|
||||||
|
enabled: modelData
|
||||||
|
|
||||||
|
source: String(modelData?.path ?? "")
|
||||||
|
text: modelData?.name ?? ""
|
||||||
onClicked: {
|
onClicked: {
|
||||||
Wallpapers.setWallpaper(modelData.path);
|
Wallpapers.setWallpaper(modelData.path);
|
||||||
root.nState.closeSubPage();
|
root.nState.closeSubPage();
|
||||||
|
|
|
||||||
|
|
@ -109,14 +109,24 @@ PageBase {
|
||||||
categories[category] = w;
|
categories[category] = w;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return Object.values(categories);
|
const cats = Object.values(categories);
|
||||||
|
while (cats.length < Config.nexus.wallpapersPerRow)
|
||||||
|
cats.push(null);
|
||||||
|
return cats;
|
||||||
}
|
}
|
||||||
|
|
||||||
WallItem {
|
WallItem {
|
||||||
required property FileSystemEntry modelData
|
required property FileSystemEntry modelData
|
||||||
|
|
||||||
source: modelData.path
|
// Empty placeholders for sizing
|
||||||
|
opacity: modelData ? 1 : 0
|
||||||
|
enabled: modelData
|
||||||
|
|
||||||
|
source: String(modelData?.path ?? "")
|
||||||
text: {
|
text: {
|
||||||
|
if (!modelData)
|
||||||
|
return "";
|
||||||
|
|
||||||
if (modelData.parentDir !== Paths.wallsdir) {
|
if (modelData.parentDir !== Paths.wallsdir) {
|
||||||
const category = Wallpapers.getCategoryFor(modelData);
|
const category = Wallpapers.getCategoryFor(modelData);
|
||||||
return category.slice(0, 1).toUpperCase() + category.slice(1);
|
return category.slice(0, 1).toUpperCase() + category.slice(1);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue