Clean up reveal line logic

This commit is contained in:
Matt Bierner 2018-02-16 13:48:02 -08:00
parent 57e5420127
commit 7398d3be89

View file

@ -156,9 +156,9 @@
if (next) {
const betweenProgress = (offset - window.scrollY - previous.element.getBoundingClientRect().top) / (next.element.getBoundingClientRect().top - previous.element.getBoundingClientRect().top);
const line = previous.line + betweenProgress * (next.line - previous.line);
return (0 <= line) ? line : 0;
return Math.max(line, 0);
} else {
return (0 <= previous.line) ? previous.line : 0;
return Math.max(previous.line, 0);
}
}
return null;