From 4863c498b29173a7284c60a51b8854b2d2da55e8 Mon Sep 17 00:00:00 2001 From: Georges Basile Stavracas Neto Date: Mon, 30 Nov 2020 22:14:17 -0300 Subject: [PATCH] iconGrid/iconGridLayout: Make sure to always update best size When selecting the best icon size for the available area, we iterate from the biggest icon size to the smallest one, and stop when finding a size that fits the available area. However, the 'bestSize' variable is only updated when the available area is positive. This is problematic in super bad cases like when none of the icon sizes actually fit the availabe area, which was hit with a previous iteration of this branch. Make sure to update the best size while iterating, so that the smallest size is selected even in such bad cases. Part-of: --- js/ui/iconGrid.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/js/ui/iconGrid.js b/js/ui/iconGrid.js index 7275a6a41..93fc6219f 100644 --- a/js/ui/iconGrid.js +++ b/js/ui/iconGrid.js @@ -429,10 +429,10 @@ var IconGridLayout = GObject.registerClass({ this._pageHeight - usedHeight - rowSpacingPerPage - this._pagePadding.top - this._pagePadding.bottom; - if (emptyHSpace >= 0 && emptyVSpace > 0) { - bestSize = size; + bestSize = size; + + if (emptyHSpace >= 0 && emptyVSpace > 0) break; - } } return bestSize;