mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-01-18 15:15:37 +00:00
remove flexbox padding when item margins are set
This commit is contained in:
parent
c08bdda008
commit
97067ae40b
|
@ -102,7 +102,7 @@ void FlexboxComponent::computeLayout()
|
|||
float anchorYStart = anchorY;
|
||||
|
||||
// Compute total container size.
|
||||
glm::vec2 totalSize = {mItemMargin.x, mItemMargin.y};
|
||||
glm::vec2 totalSize = {-mItemMargin.x, -mItemMargin.y};
|
||||
if (mDirection == "row") {
|
||||
totalSize.x += (mItemMargin.x + mItemWidth) * mItemsPerLine;
|
||||
totalSize.y += (mItemMargin.y + maxItemSize.y) * nLines;
|
||||
|
@ -121,7 +121,11 @@ void FlexboxComponent::computeLayout()
|
|||
float y = anchorY - anchorOriginY * size.y;
|
||||
|
||||
// Apply item margin.
|
||||
if ((mDirection == "row" && i % std::max(1, (int) mItemsPerLine) != 0) ||
|
||||
(mDirection == "column" && i >= (int) mItemsPerLine))
|
||||
x += mItemMargin.x * (directionLine.x >= 0.0f ? 1.0f : -1.0f);
|
||||
if ((mDirection == "column" && i % std::max(1, (int) mItemsPerLine) != 0) ||
|
||||
(mDirection == "row" && i >= (int) mItemsPerLine))
|
||||
y += mItemMargin.y * (directionLine.y >= 0.0f ? 1.0f : -1.0f);
|
||||
|
||||
// Apply alignment
|
||||
|
|
Loading…
Reference in a new issue