mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-25 15:45:38 +00:00
bug fixes, adjust theme badge proportions
Signed-off-by: Sophia Hadash <sophiahadash@gmail.com>
This commit is contained in:
parent
123e50cf17
commit
a93b975ca0
|
@ -44,15 +44,12 @@ void FlexboxComponent::computeLayout()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Compute children maximal dimensions.
|
// Compute children maximal dimensions.
|
||||||
// direction == row
|
|
||||||
// maxItemSize = { ((mMaxSize.x - mItemMargin.x) / mItemsPerLine) - mItemMargin.x, ((mMaxSize.y
|
|
||||||
// - mItemMargin.y) / mLines) - mItemMargin.y};
|
|
||||||
glm::vec2 grid;
|
glm::vec2 grid;
|
||||||
if (mDirection == Direction::row)
|
if (mDirection == Direction::row)
|
||||||
grid = {mItemsPerLine, mLines};
|
grid = {mItemsPerLine, mLines};
|
||||||
else
|
else
|
||||||
grid = {mLines, mItemsPerLine};
|
grid = {mLines, mItemsPerLine};
|
||||||
glm::vec2 maxItemSize = ((mSize - mItemMargin) / grid) - mItemMargin;
|
glm::vec2 maxItemSize = (mSize + mItemMargin - grid * mItemMargin) / grid;
|
||||||
|
|
||||||
// Set final children dimensions.
|
// Set final children dimensions.
|
||||||
for (auto i : mChildren) {
|
for (auto i : mChildren) {
|
||||||
|
@ -61,8 +58,13 @@ void FlexboxComponent::computeLayout()
|
||||||
oldSize.x = maxItemSize.x;
|
oldSize.x = maxItemSize.x;
|
||||||
glm::vec2 sizeMaxX = {maxItemSize.x, oldSize.y * (maxItemSize.x / oldSize.x)};
|
glm::vec2 sizeMaxX = {maxItemSize.x, oldSize.y * (maxItemSize.x / oldSize.x)};
|
||||||
glm::vec2 sizeMaxY = {oldSize.x * (maxItemSize.y / oldSize.y), maxItemSize.y};
|
glm::vec2 sizeMaxY = {oldSize.x * (maxItemSize.y / oldSize.y), maxItemSize.y};
|
||||||
glm::vec2 newSize =
|
glm::vec2 newSize;
|
||||||
sizeMaxX.x * sizeMaxX.y >= sizeMaxY.x * sizeMaxY.y ? sizeMaxX : sizeMaxY;
|
if (sizeMaxX.y > maxItemSize.y)
|
||||||
|
newSize = sizeMaxY;
|
||||||
|
else if (sizeMaxY.x > maxItemSize.x)
|
||||||
|
newSize = sizeMaxX;
|
||||||
|
else
|
||||||
|
newSize = sizeMaxX.x * sizeMaxX.y >= sizeMaxY.x * sizeMaxY.y ? sizeMaxX : sizeMaxY;
|
||||||
i->setSize(newSize);
|
i->setSize(newSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,17 +108,17 @@ void FlexboxComponent::computeLayout()
|
||||||
// Translate anchor.
|
// Translate anchor.
|
||||||
if ((i + 1) % std::max(1, static_cast<int>(mItemsPerLine)) != 0) {
|
if ((i + 1) % std::max(1, static_cast<int>(mItemsPerLine)) != 0) {
|
||||||
// Translate on same line.
|
// Translate on same line.
|
||||||
anchorX += (size.x + mItemMargin.x) * directionLine.x;
|
anchorX += (size.x + mItemMargin.x) * static_cast<float>(directionLine.x);
|
||||||
anchorY += (size.y + mItemMargin.y) * directionLine.y;
|
anchorY += (size.y + mItemMargin.y) * static_cast<float>(directionLine.y);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Translate to first position of next line.
|
// Translate to first position of next line.
|
||||||
if (directionRow.x == 0) {
|
if (directionRow.x == 0) {
|
||||||
anchorY += lineWidth * directionRow.y;
|
anchorY += lineWidth * static_cast<float>(directionRow.y);
|
||||||
anchorX = anchorXStart;
|
anchorX = anchorXStart;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
anchorX += lineWidth * directionRow.x;
|
anchorX += lineWidth * static_cast<float>(directionRow.x);
|
||||||
anchorY = anchorYStart;
|
anchorY = anchorYStart;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -238,13 +238,13 @@ based on: 'recalbox-multi' by the Recalbox community
|
||||||
</text>
|
</text>
|
||||||
<badges name="md_badges">
|
<badges name="md_badges">
|
||||||
<pos>0.8125 0.675</pos>
|
<pos>0.8125 0.675</pos>
|
||||||
<size>0.1 0.2</size>
|
<size>0.15 0.21</size>
|
||||||
<origin>0 0</origin>
|
<origin>0 0</origin>
|
||||||
<direction>row</direction>
|
<direction>row</direction>
|
||||||
<align>start</align>
|
<align>start</align>
|
||||||
<itemsPerLine>3</itemsPerLine>
|
<itemsPerLine>3</itemsPerLine>
|
||||||
<lines>2</lines>
|
<lines>2</lines>
|
||||||
<itemMargin>0.005 0.005</itemMargin>
|
<itemMargin>0.0028125 0.005</itemMargin>
|
||||||
<slots>favorite completed kidgame broken altemulator</slots>
|
<slots>favorite completed kidgame broken altemulator</slots>
|
||||||
</badges>
|
</badges>
|
||||||
<!-- This block prevents additional elements from interfering when mixing layouts. -->
|
<!-- This block prevents additional elements from interfering when mixing layouts. -->
|
||||||
|
|
Loading…
Reference in a new issue