diff options
| author | bobzel <zzzman@gmail.com> | 2024-04-01 11:14:24 -0400 |
|---|---|---|
| committer | bobzel <zzzman@gmail.com> | 2024-04-01 11:14:24 -0400 |
| commit | e4854bdb361f1d9e0ae85ee46327e2919117fc48 (patch) | |
| tree | 229d97be0f65cb89f7928c10aae151973daa5978 /src/Utils.ts | |
| parent | 108e27f0d08a8d6d3b3fcd456d6cca999c077e8b (diff) | |
revert back to old style of forced text scrolling - doesn't work for pres trails.
Diffstat (limited to 'src/Utils.ts')
| -rw-r--r-- | src/Utils.ts | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/Utils.ts b/src/Utils.ts index 38325a463..21c91278f 100644 --- a/src/Utils.ts +++ b/src/Utils.ts @@ -653,13 +653,14 @@ export function smoothScroll(duration: number, element: HTMLElement | HTMLElemen const animateScroll = () => { const currentDate = new Date().getTime(); const currentTime = currentDate - startDate; - elements.map((element, i) => (element.scrollTop = easeFunc(transition, currentTime, starts[i], to - starts[i], duration))); + const setScrollTop = (element: HTMLElement, value: number) => (element.scrollTop = value); + elements.forEach((element, i) => currentTime && setScrollTop(element, easeFunc(transition, Math.min(currentTime, duration), starts[i], to - starts[i], duration))); if (!_stop) { if (currentTime < duration) { requestAnimationFrame(animateScroll); } else { - elements.forEach(element => (element.scrollTop = to)); + elements.forEach(element => setScrollTop(element, to)); } } }; |
