From ee2e9463a241533c53cc995d5eb00b9d220c408d Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Sat, 10 Sep 2022 19:49:48 +0200 Subject: [PATCH] Fixed an issue where the rating component would be incorrectly sized in the scraper GUI at certain vertical resolutions. --- es-app/src/guis/GuiScraperSearch.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/es-app/src/guis/GuiScraperSearch.cpp b/es-app/src/guis/GuiScraperSearch.cpp index af6d36b3d..d5c8a591f 100644 --- a/es-app/src/guis/GuiScraperSearch.cpp +++ b/es-app/src/guis/GuiScraperSearch.cpp @@ -264,9 +264,17 @@ void GuiScraperSearch::resizeMetadata() mMD_Grid->setColWidthPerc(0, maxLblWidth / mMD_Grid->getSize().x); if (mScrapeRatings) { - // Rating is manually sized. - mMD_Rating->setSize(mMD_Grid->getColWidth(1), fontLbl->getHeight() * 0.65f); + // Make sure the rating component fits inside the column width regardless of screen + // aspect ratio. Also move the component slightly to the left to compensate for the + // padding baked into the actual SVG file. + float ratingWidth {mMD_Grid->getRowHeight(4) * 5.0f * 1.23f}; + ratingWidth = + std::round(glm::clamp(ratingWidth, 0.0f, mMD_Developer->getSize().x * 0.98f)); + mMD_Rating->setSize(0, std::round(ratingWidth / 5.0f)); mMD_Grid->onSizeChanged(); + mMD_Rating->setPosition( + std::round(maxLblWidth - std::round(mMD_Rating->getSize().y / 10.0f)), + mMD_Rating->getPosition().y); } // Make result font follow label font.