Created
March 5, 2020 13:33
-
-
Save sueLan/4883477e115184460ecebc0641a4882e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for (let idx = first; idx <= last; idx++) { | |
const metrics = getFrameMetrics(idx); | |
if (!metrics) { | |
continue; | |
} | |
// The top of current item cell, relative to the screen | |
const top = metrics.offset - scrollOffset; | |
// The bottom of current item cell | |
const bottom = top + metrics.length; | |
if (top < viewportHeight && bottom > 0) { | |
firstVisible = idx; | |
if ( | |
_isViewable( | |
viewAreaMode, | |
viewablePercentThreshold, | |
top, | |
bottom, | |
viewportHeight, | |
metrics.length, | |
) | |
) { | |
viewableIndices.push(idx); | |
} | |
} else if (firstVisible >= 0) { | |
break; | |
} | |
} | |
return viewableIndices; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment