From 25ff2b9176c465328eafb6350a931d032a56fa74 Mon Sep 17 00:00:00 2001 From: Lim Chee Aun Date: Sun, 12 Feb 2023 17:46:20 +0800 Subject: [PATCH] Smarter distancing for useScroll --- src/utils/useScroll.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/utils/useScroll.js b/src/utils/useScroll.js index d546a9cb..af45ece9 100644 --- a/src/utils/useScroll.js +++ b/src/utils/useScroll.js @@ -41,10 +41,12 @@ export default function useScroll({ const distanceFromStartPx = Math.min( clientDimension * distanceFromStart, scrollDimension, + scrollStart, ); const distanceFromEndPx = Math.min( clientDimension * distanceFromEnd, scrollDimension, + scrollDimension - scrollStart - clientDimension, ); if (