File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed
Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -60,16 +60,21 @@ function AnimatedTooltipComponent({
6060 // Use currentTarget (which is correctly typed) instead of target to avoid TS2339
6161 const handleMouseMove = ( event : React . MouseEvent < HTMLImageElement > ) => {
6262 if ( ! isClient ) return ;
63+
64+ const target = event . currentTarget ;
65+ const halfWidth = target . offsetWidth / 2 ;
66+ const offsetX = event . nativeEvent . offsetX ;
67+
6368 if ( animationFrameRef . current ) {
6469 cancelAnimationFrame ( animationFrameRef . current ) ;
6570 }
71+
6672 animationFrameRef . current = requestAnimationFrame ( ( ) => {
67- const halfWidth = event . currentTarget . offsetWidth / 2 ;
68- x . set ( event . nativeEvent . offsetX - halfWidth ) ;
73+ x . set ( offsetX - halfWidth ) ;
6974 } ) ;
7075 } ;
7176
72-
77+
7378 const getPositionClasses = ( ) => {
7479 switch ( position ) {
7580 case 'top' :
You can’t perform that action at this time.
0 commit comments