Skip to content

Commit

Permalink
fix(ViewportProvider): do not change direction when the scroll value …
Browse files Browse the repository at this point in the history
…does not change

In internet explorer a lot of times the same values comes in and toggling
the direction actually does not make any sense in this situation. On other browsers
this was not a huge issue because if will only happen in really rare situations.
  • Loading branch information
garthenweb committed Sep 23, 2018
1 parent a9bd1af commit 06d2bfd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/ViewportProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ const getXDir = (x: number, prev: IPrivateScroll) => {
case x > prev.x:
return SCROLL_DIR_RIGHT;
case x === prev.x:
return prev.xDir === SCROLL_DIR_LEFT ? SCROLL_DIR_RIGHT : SCROLL_DIR_LEFT;
return prev.xDir;
default:
throw new Error('Could not calculate xDir');
}
Expand All @@ -91,7 +91,7 @@ const getYDir = (y: number, prev: IPrivateScroll) => {
case y > prev.y:
return SCROLL_DIR_DOWN;
case y === prev.y:
return prev.yDir === SCROLL_DIR_UP ? SCROLL_DIR_DOWN : SCROLL_DIR_UP;
return prev.yDir;
default:
throw new Error('Could not calculate yDir');
}
Expand Down

0 comments on commit 06d2bfd

Please sign in to comment.