From 8fd05fcd77a3e747431a7d5fd90f8f2d250d41fd Mon Sep 17 00:00:00 2001 From: shadash Date: Sun, 17 Oct 2021 01:11:01 +0200 Subject: [PATCH] bugfix, simplification Signed-off-by: Sophia Hadash --- es-core/src/components/FlexboxComponent.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/es-core/src/components/FlexboxComponent.cpp b/es-core/src/components/FlexboxComponent.cpp index a31871102..612a61bad 100644 --- a/es-core/src/components/FlexboxComponent.cpp +++ b/es-core/src/components/FlexboxComponent.cpp @@ -194,7 +194,8 @@ void FlexboxComponent::computeLayout() // Apply right-align if (mAlignment == "right") { - unsigned int n = mItemsPerLine - (--i + 1) % std::max(1, static_cast(mItemsPerLine)); + unsigned int m = i % std::max(1, static_cast(mItemsPerLine)); + unsigned int n = m > 0 ? mItemsPerLine - m : m; i = 0; unsigned int line = 1; for (auto& image : mImages) {