on xenial help sign in
Don't precache items that are outisde the 1.5*height buffering area

Fixes: #1410131 Approved by: Andrea Cimitan

commit90194d157dafd812357d6fbfefa89406222536fe authorAlbert Astals Cid <albert.astals@canonical.com> dateMon 2 Mar 2015, 12:09 (12 years ago) parent45c4ba414ef517
1 file changed+11−7
qml/Dash/GenericScopeView.qml+11−7
qml/Dash/GenericScopeView.qml+11−7
@@ -402,6 +402,12 @@ FocusScope {
402402 }
403403
404404 if (item && item.hasOwnProperty("displayMarginBeginning")) {
405+ var buffer = wasCurrentOnMoveStart ? categoryView.height * 1.5 : 0;
406+ var onViewport = baseItem.y + baseItem.height > 0 &&
407+ baseItem.y < categoryView.height;
408+ var onBufferViewport = baseItem.y + baseItem.height > -buffer &&
409+ baseItem.y < categoryView.height + buffer;
410+
405411 if (item.growsVertically) {
406412 // A item view creates its delegates synchronously from
407413 // -displayMarginBeginning
@@ -429,7 +435,7 @@ FocusScope {
429435 displayMarginEnd = -Math.min(-displayMarginEnd, baseItem.height);
430436 displayMarginEnd = Math.round(displayMarginEnd);
431437
432− if (scopeView.isCurrent || scopeView.visibleToParent) {
438+ if (onBufferViewport && (scopeView.isCurrent || scopeView.visibleToParent)) {
433439 item.displayMarginBeginning = displayMarginBeginning;
434440 item.displayMarginEnd = displayMarginEnd;
435441 if (holdingList && holdingList.moving) {
@@ -442,7 +448,10 @@ FocusScope {
442448 item.cacheBuffer = 0;
443449 }
444450 } else {
445− item.cacheBuffer = categoryView.height * 1.5;
451+ // Protect us against cases where the item hasn't yet been positioned
452+ if (!(categoryView.contentY === 0 && baseItem.y === 0 && index !== 0)) {
453+ item.cacheBuffer = categoryView.height * 1.5;
454+ }
446455 }
447456 } else {
448457 var visibleRange = baseItem.height + displayMarginEnd + displayMarginBeginning;
@@ -460,11 +469,6 @@ FocusScope {
460469 }
461470 }
462471 } else {
463− var buffer = wasCurrentOnMoveStart ? categoryView.height * 1.5 : 0;
464− var onViewport = baseItem.y + baseItem.height > 0 &&
465− baseItem.y < categoryView.height;
466− var onBufferViewport = baseItem.y + baseItem.height > -buffer &&
467− baseItem.y < categoryView.height + buffer;
468472 if (!onBufferViewport) {
469473 // If not on the buffered viewport, don't load anything
470474 item.displayMarginBeginning = 0;