mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-01-31 04:25:40 +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;
|
float anchorYStart = anchorY;
|
||||||
|
|
||||||
// Compute total container size.
|
// Compute total container size.
|
||||||
glm::vec2 totalSize = {mItemMargin.x, mItemMargin.y};
|
glm::vec2 totalSize = {-mItemMargin.x, -mItemMargin.y};
|
||||||
if (mDirection == "row") {
|
if (mDirection == "row") {
|
||||||
totalSize.x += (mItemMargin.x + mItemWidth) * mItemsPerLine;
|
totalSize.x += (mItemMargin.x + mItemWidth) * mItemsPerLine;
|
||||||
totalSize.y += (mItemMargin.y + maxItemSize.y) * nLines;
|
totalSize.y += (mItemMargin.y + maxItemSize.y) * nLines;
|
||||||
|
@ -121,8 +121,12 @@ void FlexboxComponent::computeLayout()
|
||||||
float y = anchorY - anchorOriginY * size.y;
|
float y = anchorY - anchorOriginY * size.y;
|
||||||
|
|
||||||
// Apply item margin.
|
// Apply item margin.
|
||||||
x += mItemMargin.x * (directionLine.x >= 0.0f ? 1.0f : -1.0f);
|
if ((mDirection == "row" && i % std::max(1, (int) mItemsPerLine) != 0) ||
|
||||||
y += mItemMargin.y * (directionLine.y >= 0.0f ? 1.0f : -1.0f);
|
(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
|
// Apply alignment
|
||||||
if (mAlign == ITEM_ALIGN_END) {
|
if (mAlign == ITEM_ALIGN_END) {
|
||||||
|
|
Loading…
Reference in a new issue