mirror of
https://github.com/hulthe/inkopslista.git
synced 2026-08-03 23:11:28 +02:00
Fix GoodButtons alignment
This commit is contained in:
+12
-10
@@ -183,20 +183,22 @@ component GoodButtons inherits ScrollView {
|
||||
in property <int> button-height: 60;
|
||||
in property <int> button-spacing: 10;
|
||||
|
||||
property <int> count-x: floor(root.width / 1pt / (button-width + button-spacing));
|
||||
property <int> count-x: max(1, floor(root.width / 1pt / (button-width + button-spacing)));
|
||||
property <int> count-y: ceil(favorites.length / count-x);
|
||||
|
||||
viewport-height: (count-y * (button-height + button-spacing)) * 1pt;
|
||||
mouse-drag-pan-enabled: true;
|
||||
|
||||
for item[idx] in favorites: Button {
|
||||
x: floor(mod(idx, count-x)) * (root.button-width + root.button-spacing) * 1pt;
|
||||
y: floor(idx / count-x) * (root.button-height + root.button-spacing) * 1pt;
|
||||
width: root.button-width * 1pt;
|
||||
height: root.button-height * 1pt;
|
||||
text: item;
|
||||
clicked => {
|
||||
State.add-to-list(item);
|
||||
GridBox {
|
||||
for item[idx] in favorites: Button {
|
||||
col: floor(mod(idx, count-x));
|
||||
row: floor(idx / count-x);
|
||||
min-width: 100pt;
|
||||
min-height: 60pt;
|
||||
max-height: 100pt;
|
||||
text: item;
|
||||
clicked => {
|
||||
State.add-to-list(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user