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

View File

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