Cubic bezier momentum event triggering

Emulates the CSS cubic-bezier function to interpolate transition values
to trigger intermediate scroll events.
This commit is contained in:
Max Lynch
2013-10-28 19:15:06 -05:00
parent 43c3c4136b
commit e66a27996b
5 changed files with 292 additions and 46 deletions

View File

@ -55,17 +55,19 @@ describe('List View', function() {
var itemHeight = list.itemHeight;
var totalItems = height / itemHeight;
var viewportHeight = list.el.parentNode.offsetHeight;
var itemsPerViewport = (viewportHeight + -list.virtualRemoveThreshold + list.virtualAddThreshold) / itemHeight;
// set up scroll top
var scrollTop = 1000;
var start = (scrollTop + -list.virtualRemoveThreshold) / itemHeight;
var start = (scrollTop + list.virtualRemoveThreshold) / itemHeight;
var end = (scrollTop + viewportHeight + list.virtualAddThreshold) / itemHeight;
//console.log(height, itemHeight, totalItems, viewportHeight);
list.scrollTo(0, scrollTop);
expect(list.renderViewport).toHaveBeenCalledWith(scrollTop + -list.virtualRemoveThreshold,
// Given a scrollTop of 1000px, an item height of 50px, and the given += 200px
// render window, renderViewport should be called with the following
// computed values:
expect(list.renderViewport).toHaveBeenCalledWith(scrollTop + list.virtualRemoveThreshold,
scrollTop + viewportHeight + list.virtualAddThreshold, start, end);
});