on xenial help sign in
Fix infinite loop in creation/deletion of delegates

There's two fixes actually: * One fix the calculation of visibleRange * Two make sure the displayMargins don't cross the wrong way (too much) otherwise GridView gets all confused and starts the infinite creation/destruction

commita0e87ce5d7743d1cd29920d6f981ed686e598fdb authorAlbert Astals <albert.astals@canonical.com> dateWed 19 Nov 2014, 17:16 (12 years ago) parent30127c7
1 file changed+9−4
qml/Dash/GenericScopeView.qml+9−4
qml/Dash/GenericScopeView.qml+9−4
@@ -401,15 +401,20 @@ FocusScope {
401401 // to the next, we set the visible range to the viewport so
402402 // items are not culled (invisible) but still use no cacheBuffer
403403 // (it will be set once the scope is the current one)
404− var displayMarginBeginning = Math.round(-Math.max(-baseItem.y, 0));
405− var displayMarginEnd = -Math.round(Math.max(baseItem.height - seeAll.height -
406− categoryView.height + baseItem.y, 0));
404+ var displayMarginBeginning = baseItem.y;
405+ displayMarginBeginning = -Math.max(-displayMarginBeginning, 0);
406+ displayMarginBeginning = -Math.min(-displayMarginBeginning, baseItem.height);
407+ displayMarginBeginning = Math.round(displayMarginBeginning);
408+ var displayMarginEnd = -baseItem.height + seeAll.height + categoryView.height - baseItem.y;
409+ displayMarginEnd = -Math.max(-displayMarginEnd, 0);
410+ displayMarginEnd = -Math.min(-displayMarginEnd, baseItem.height);
411+ displayMarginEnd = Math.round(displayMarginEnd);
407412 if (scopeView.isCurrent || scopeView.visibleToParent) {
408413 item.displayMarginBeginning = displayMarginBeginning;
409414 item.displayMarginEnd = displayMarginEnd;
410415 item.cacheBuffer = scopeView.isCurrent ? categoryView.height * 1.5 : 0;
411416 } else {
412− var visibleRange = baseItem.height + displayMarginEnd - displayMarginBeginning;
417+ var visibleRange = baseItem.height + displayMarginEnd + displayMarginBeginning;
413418 if (visibleRange < 0) {
414419 item.displayMarginBeginning = displayMarginBeginning;
415420 item.displayMarginEnd = displayMarginEnd;