Fixed an issue in GridComponent where the item size was sometimes not calculated correctly when running on a vertically oriented screen.

This commit is contained in:
Leon Styhre 2023-02-10 00:55:58 +01:00
parent 79b5993732
commit ebcc0f95b0

View file

@ -896,7 +896,10 @@ void GridComponent<T>::applyTheme(const std::shared_ptr<ThemeData>& theme,
const glm::vec2& itemSize {elem->get<glm::vec2>("itemSize")};
if (!(itemSize.x == -1 && itemSize.y == -1)) {
if (itemSize.x == -1) {
mItemSize.y = glm::clamp(itemSize.y, 0.05f, 1.0f) * mRenderer->getScreenHeight();
mItemSize.y =
glm::clamp(itemSize.y, 0.05f, 1.0f) * (mRenderer->getIsVerticalOrientation() ?
mRenderer->getScreenWidth() :
mRenderer->getScreenHeight());
mItemSize.x = mItemSize.y;
}
else if (itemSize.y == -1) {