From 08be166ae31db98e2ec362eda0e52da6513e1c13 Mon Sep 17 00:00:00 2001 From: Michail Vourlakos Date: Wed, 11 Dec 2019 09:39:19 +0200 Subject: [PATCH] increase grow/shrink distance limits --automatic icon sizer is using a prediction algorithm in order to decide to grow or not the items size. There is a chance that the prediction calculations are executed too early and as such grow/shrink limits it is better to not be to near to each other. That approach should make the AutomaticItemSizer implementation a little more robust. --- containment/package/contents/ui/AutomaticItemSizer.qml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/containment/package/contents/ui/AutomaticItemSizer.qml b/containment/package/contents/ui/AutomaticItemSizer.qml index c226e69be..26b668cef 100644 --- a/containment/package/contents/ui/AutomaticItemSizer.qml +++ b/containment/package/contents/ui/AutomaticItemSizer.qml @@ -155,8 +155,12 @@ Item { layoutsContainer.startLayout.width+layoutsContainer.mainLayout.width+layoutsContainer.endLayout.width : layoutsContainer.mainLayout.width } - var toShrinkLimit = maxLength-((1+(root.zoomFactor-1))*(root.iconSize + lengthMargins)); - var toGrowLimit = maxLength-((1+(root.zoomFactor-1))*(root.iconSize + lengthMargins)); + var itemLength = root.iconSize + lengthMargins; + + var toShrinkLimit = maxLength - (root.zoomFactor * itemLength); + //! to grow limit must be a little less than the shrink one in order to be more robust and + //! not create endless loops from early calculations + var toGrowLimit = maxLength - (1.2 * root.zoomFactor * itemLength); //console.log("toShrinkLimit: "+ toShrinkLimit); //console.log("toGrowLimit: "+ toGrowLimit);