Skip to content

Commit

Permalink
fix(Infinite): remove startIndex, endIndex, horizontal
Browse files Browse the repository at this point in the history
  • Loading branch information
daybrush committed Mar 16, 2018
1 parent f174f26 commit dc9df44
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions src/Infinite.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ class Infinite {
this.options = Object.assign({
useRecycle: true,
threshold: 100,
horizontal: false,
}, options);
this._items = itemManger;
this.clear();
Expand Down Expand Up @@ -76,14 +75,8 @@ class Infinite {
const threshold = this.options.threshold;
const endScrollPos = scrollPos + size;
const targetItem = items.getData(isForward ? endCursor : startCursor);
// const outlines = targetItem.outlines[isForward ? "end" : "start"];
const edgeItem = targetItem.items[targetItem.outlines[isForward ? "endIndex" : "startIndex"]];
const sizeName = this.options.horizontal ? "width" : "height";
const posName = this.options.horizontal ? "left" : "top";
const edgeItemSize = edgeItem.rect[sizeName] || edgeItem.size[sizeName];
const edgePos = isForward ? edgeItem.rect[posName] : edgeItem.rect[posName] + edgeItemSize;

// Math[isForward ? "min" : "max"](...outlines);
const outlines = targetItem.outlines[isForward ? "end" : "start"];
const edgePos = Math[isForward ? "min" : "max"](...outlines);

if (isForward) {
if (endScrollPos >= edgePos - threshold) {
Expand Down

0 comments on commit dc9df44

Please sign in to comment.