Skip to content

Commit

Permalink
fix: correct edge case behavior on non zero browser zoom levels
Browse files Browse the repository at this point in the history
  • Loading branch information
theKashey committed Oct 9, 2023
1 parent 55d302b commit cd24189
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/handleScroll.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,15 @@ export const handleScroll = (
(targetInLock && (endTarget.contains(target) || endTarget === target))
);

if (isDeltaPositive && ((noOverscroll && availableScroll === 0) || (!noOverscroll && delta > availableScroll))) {
// handle epsilon around 0 (non standard zoom levels)
if (
isDeltaPositive &&
((noOverscroll && Math.abs(availableScroll) < 1) || (!noOverscroll && delta > availableScroll))
) {
shouldCancelScroll = true;
} else if (
!isDeltaPositive &&
((noOverscroll && availableScrollTop === 0) || (!noOverscroll && -delta > availableScrollTop))
((noOverscroll && Math.abs(availableScrollTop) < 1) || (!noOverscroll && -delta > availableScrollTop))
) {
shouldCancelScroll = true;
}
Expand Down

0 comments on commit cd24189

Please sign in to comment.