FIX: Couldn't track some post positions properly

This commit is contained in:
Robin Ward 2016-06-09 12:16:54 -04:00
parent 5047979f96
commit 9f8b8a1c3a
1 changed files with 5 additions and 1 deletions

View File

@ -94,6 +94,7 @@ export default MountWidget.extend({
let allAbove = true;
let bottomView = topView;
let lastBottom = 0;
while (bottomView < $posts.length) {
const post = $posts[bottomView];
const $post = $(post);
@ -112,11 +113,14 @@ export default MountWidget.extend({
onscreen.push(bottomView);
}
if (currentPost === null && (viewTop <= topCheck) && (viewBottom >= topCheck)) {
if ((currentPost === null) &&
((viewTop <= topCheck && viewBottom >= topCheck) ||
(lastBottom <= topCheck && viewTop >= topCheck))) {
percent = (topCheck - viewTop) / postHeight;
currentPost = bottomView;
}
lastBottom = viewBottom;
nearby.push(bottomView);
bottomView++;
}