Skip to content

Commit 49f4d75

Browse files
authored
[EGD-4189] BoxLayout Center Alignment calculation fixed when margins are present. (#926)
1 parent 035aef0 commit 49f4d75

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

module-gui/gui/widgets/BoxLayout.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -337,10 +337,10 @@ namespace gui
337337
break;
338338
case gui::Alignment::Vertical::Center:
339339
if (reverseOrder) {
340-
return calcPos + el->getMargins().getSumInAxis(axis) - offset / 2;
340+
return calcPos - ((offset - el->getMargins().getSumInAxis(axis)) / 2);
341341
}
342342
else {
343-
return calcPos - el->getMargins().getSumInAxis(axis) + offset / 2;
343+
return calcPos + ((offset - el->getMargins().getSumInAxis(axis)) / 2);
344344
}
345345
break;
346346
case gui::Alignment::Vertical::Bottom:
@@ -360,10 +360,10 @@ namespace gui
360360
break;
361361
case gui::Alignment::Horizontal::Center:
362362
if (reverseOrder) {
363-
return calcPos + el->getMargins().getSumInAxis(axis) - offset / 2;
363+
return calcPos - ((offset - el->getMargins().getSumInAxis(axis)) / 2);
364364
}
365365
else {
366-
return calcPos - el->getMargins().getSumInAxis(axis) + offset / 2;
366+
return calcPos + ((offset - el->getMargins().getSumInAxis(axis)) / 2);
367367
}
368368
break;
369369
case gui::Alignment::Horizontal::Right:

0 commit comments

Comments
 (0)