@@ -41,20 +41,21 @@ export default function ListeningRect({
4141} ) {
4242 const anchor = useRef ( null ) ;
4343
44- const [ scrollPosition , setScrollPosition ] = useState ( 0 ) ;
44+ // const [scrollPosition, setScrollPosition] = useState(0);
4545
46- const handleScroll = ( ) => {
47- const position = window . pageYOffset ;
48- setScrollPosition ( position ) ;
49- } ;
46+ // const handleScroll = () => {
47+ // const position = window.pageYOffset;
48+ // setScrollPosition(position);
49+ // };
5050
51- useEffect ( ( ) => {
52- window . addEventListener ( 'scroll' , handleScroll , { passive : true } ) ;
51+ // useEffect(() => {
52+ // window.addEventListener('scroll', handleScroll, { passive: true });
53+
54+ // return () => {
55+ // window.removeEventListener('scroll', handleScroll);
56+ // };
57+ // }, []);
5358
54- return ( ) => {
55- window . removeEventListener ( 'scroll' , handleScroll ) ;
56- } ;
57- } , [ ] ) ;
5859 const tooltipState : toolTipState = {
5960 cursorX : 0 ,
6061 cursorY : 0 ,
@@ -123,7 +124,7 @@ export default function ListeningRect({
123124 }
124125
125126 tooltipState . distanceFromTop =
126- tooltipState . cursorY + margin . top - scrollPosition ;
127+ tooltipState . cursorY + margin . top ;
127128 tooltipState . distanceFromRight =
128129 width - ( margin . left + tooltipState . cursorX ) ;
129130 tooltipState . distanceFromLeft = margin . left + tooltipState . cursorX ;
0 commit comments