summaryrefslogtreecommitdiff
path: root/plugingui/layout.cc
diff options
context:
space:
mode:
Diffstat (limited to 'plugingui/layout.cc')
-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);
}
}