on xenial help sign in
More sane way of setting the displayMargin[Begin,End]
02cbc37Albert Astals
qml/Dash/GenericScopeView.qml+22−19
@@ -380,25 +380,28 @@ FocusScope {
380 }
380 }
381
381
382 if (item && item.hasOwnProperty("displayMarginBeginning")) {
382 if (item && item.hasOwnProperty("displayMarginBeginning")) {
383− // TODO do we need item.originY here, test 1300302 once we have a silo
383+ // A item view is considered visible from
384− // and we can run it on the phone
384+ // -displayMarginBeginning
385− if (baseItem.y + baseItem.height <= 0) {
385+ // to
386− // Not visible (item at top of the list viewport)
386+ // height + item.displayMarginEnd
387− item.displayMarginBeginning = -baseItem.height;
387+ // We adjust displayMarginBeginning and displayMarginEnd so
388− item.displayMarginEnd = 0;
388+ // * In non visible scopes only the viewport is considered visible
389− } else if (baseItem.y >= categoryView.height) {
389+ // that way when you switch to it the visible items are there
390− // Not visible (item at bottom of the list viewport)
390+ // * For visible scopes we increase the visible range by categoryView.height * 1.5
391− item.displayMarginBeginning = 0;
391+ // in both directions to make scrolling nicer by mantaining a higher number of
392− item.displayMarginEnd = -baseItem.height;
392+ // cached items
393− } else {
393+ // TODO Improvements
394− item.displayMarginBeginning = Math.round(-Math.max(-baseItem.y, 0));
394+ // - For non visible scopes we should always have a visible range of 0 and
395− item.displayMarginEnd = -Math.round(Math.max(baseItem.height - seeAll.height -
395+ // make sure the items in the viewport are created with the cache buffer feature
396− categoryView.height + baseItem.y, 0));
396+ // - For visible scopes we should always the have a visible range be exactly the
397+ // viewport and make sure the rest of items are created with the cache buffer feature
398+ // To be able to implement that feature VerticalJournal/AbstractDashView needs to
399+ // make the cache buffer value setable externally
397− if (scopeView.isCurrent) {
400+ var extraMargins = scopeView.isCurrent ? categoryView.height * 1.5 : 0;
398− item.displayMarginBeginning += categoryView.height * 1.5;
401+
402+ item.displayMarginBeginning = Math.round(-Math.max(-baseItem.y - extraMargins, 0));
403+ item.displayMarginEnd = -Math.round(Math.max(baseItem.height - extraMargins - seeAll.height -
399− item.displayMarginEnd += categoryView.height * 1.5;
404+ categoryView.height + baseItem.y, 0));
400− }
401− }
402 }
405 }
403 }
406 }
404 }
407 }