@@ -17,8 +17,8 @@ class ScrollInfoProvider extends Component {
1717 xPercentage : 0 ,
1818 yPercentage : 0 ,
1919 totalPercentage : 0 ,
20- count : 0 ,
2120 eventsFired : 0 ,
21+ animationsFired : 0 ,
2222 } ;
2323 }
2424
@@ -35,16 +35,16 @@ class ScrollInfoProvider extends Component {
3535 const {
3636 x : lastScrollX ,
3737 y : lastScrollY ,
38- count : scrollCount ,
3938 eventsFired,
39+ animationsFired,
4040 } = this . state ;
4141
4242 // Set to zero on first iteration for cross-browser compatibility
4343 // The inconsistencies occur when the window is reloaded with a cached scroll position
4444 // Chrome mounts with the cached window.pageOffset
4545 // Safari and FireFox don't populate it until the first scroll event which is triggered by the browser
46- const currentScrollX = eventsFired > 0 ? window . pageXOffset : 0 ;
47- const currentScrollY = eventsFired > 0 ? window . pageYOffset : 0 ;
46+ const currentScrollX = animationsFired > 0 ? window . pageXOffset : 0 ;
47+ const currentScrollY = animationsFired > 0 ? window . pageYOffset : 0 ;
4848
4949 const xDifference = currentScrollX - lastScrollX ;
5050 const yDifference = currentScrollY - lastScrollY ;
@@ -65,15 +65,15 @@ class ScrollInfoProvider extends Component {
6565 xPercentage,
6666 yPercentage,
6767 totalPercentage,
68- count : scrollHasChanged ? scrollCount + 1 : scrollCount ,
68+ eventsFired : scrollHasChanged ? eventsFired + 1 : eventsFired ,
6969 } ) ;
7070 } ;
7171
7272 requestAnimation = ( ) => {
73- const { animationScheduled, eventsFired } = this . state ;
73+ const { animationScheduled, animationsFired } = this . state ;
7474 if ( ! animationScheduled ) {
7575 requestAnimationFrame ( this . updateScrollInfo ) ;
76- this . setState ( { animationScheduled : true , eventsFired : eventsFired + 1 } ) ;
76+ this . setState ( { animationScheduled : true , animationsFired : animationsFired + 1 } ) ;
7777 }
7878 }
7979
@@ -89,7 +89,7 @@ class ScrollInfoProvider extends Component {
8989 xPercentage,
9090 yPercentage,
9191 totalPercentage,
92- count ,
92+ eventsFired ,
9393 } = this . state ;
9494
9595 return (
@@ -105,7 +105,7 @@ class ScrollInfoProvider extends Component {
105105 xPercentage,
106106 yPercentage,
107107 totalPercentage,
108- count ,
108+ eventsFired ,
109109 } ,
110110 } }
111111 >
0 commit comments