summaryrefslogtreecommitdiff
path: root/plugingui
diff options
context:
space:
mode:
authorAndré Nusser <andre.nusser@googlemail.com>2018-07-22 19:33:33 +0200
committerAndré Nusser <andre.nusser@googlemail.com>2018-07-22 19:33:33 +0200
commit55965723f463cdd5ebfc0b493ac3ae317900fdee (patch)
treee23c35be21d8e4f09aa55b1785c64b79fa3a4a80 /plugingui
parentd21d23af0958e82439425f545f5937e7a3559f53 (diff)
Fix bug in GridLayout.
Diffstat (limited to 'plugingui')
-rw-r--r--plugingui/layout.cc13
1 files changed, 4 insertions, 9 deletions
diff --git a/plugingui/layout.cc b/plugingui/layout.cc
index da64d1b..f38bc20 100644
--- a/plugingui/layout.cc
+++ b/plugingui/layout.cc
@@ -370,15 +370,10 @@ void GridLayout::moveAndResize(
}
else
{
- if(item.width() <= width && item.height() <= height)
- {
- item.move(x + (width - item.width()) / 2,
- y + (height - item.height()) / 2);
- }
- else
- {
- item.move(x, y);
- }
+ auto x_new = (item.width() > width) ? x : x + (width - item.width()) / 2;
+ auto y_new = (item.height() > height) ? y : y + (height - item.height()) / 2;
+
+ item.move(x_new, y_new);
}
}