Replace grid hack with FlexBox for GoodButtons

This commit is contained in:
hulthe committed 2026-10-03 11:14:53 +02:00
1 parent e6024a06f6
commit f11cb56c12
1 file changed
+11 -9
+11 -9
View File
@@ -186,19 +186,21 @@ component GoodButtons inherits ScrollView {
property <int> count-x: floor(root.width / (button-min-width + button-spacing));
property <int> count-y: ceil(State.favorites.length / count-x);
property <length> button-width: ((self.width + button-spacing) / count-x) - button-spacing;
property <length> button-width: ((root.width + button-spacing) / count-x) - button-spacing;
content-height: (count-y * (button-height + button-spacing));
mouse-drag-pan-enabled: true;
vertical-scrollbar-policy: always-off;
for item[idx] in State.favorites: Button {
x: floor(mod(idx, count-x)) * (root.button-width + root.button-spacing);
y: floor(idx / count-x) * (root.button-height + root.button-spacing);
width: root.button-width;
height: root.button-height;
text: item.name;
clicked => {
State.add-to-list(item.name);
FlexboxLayout {
spacing: button-spacing;
for item in State.favorites: Button {
width: root.button-width;
height: root.button-height;
text: item.name;
clicked => {
State.add-to-list(item.name);
}
}
}
}