File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed
components/tabs/src/hooks Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -33,26 +33,26 @@ export default function useTouchMove(
3333
3434 e . preventDefault ( ) ;
3535 const { screenX, screenY } = e . touches [ 0 ] ;
36- setTouchPosition ( { x : screenX , y : screenY } ) ;
3736 const offsetX = screenX - touchPosition . value . x ;
3837 const offsetY = screenY - touchPosition . value . y ;
3938 onOffset ( offsetX , offsetY ) ;
39+ setTouchPosition ( { x : screenX , y : screenY } ) ;
4040 const now = Date . now ( ) ;
41- setLastTimestamp ( now ) ;
4241 setLastTimeDiff ( now - lastTimestamp . value ) ;
42+ setLastTimestamp ( now ) ;
4343 setLastOffset ( { x : offsetX , y : offsetY } ) ;
4444 }
4545
4646 function onTouchEnd ( ) {
4747 if ( ! touchPosition . value ) return ;
48-
48+ const lastOffsetValue = lastOffset . value ;
4949 setTouchPosition ( null ) ;
5050 setLastOffset ( null ) ;
5151
5252 // Swipe if needed
53- if ( lastOffset . value ) {
54- const distanceX = lastOffset . value . x / lastTimeDiff . value ;
55- const distanceY = lastOffset . value . y / lastTimeDiff . value ;
53+ if ( lastOffsetValue ) {
54+ const distanceX = lastOffsetValue . x / lastTimeDiff . value ;
55+ const distanceY = lastOffsetValue . y / lastTimeDiff . value ;
5656 const absX = Math . abs ( distanceX ) ;
5757 const absY = Math . abs ( distanceY ) ;
5858
You can’t perform that action at this time.
0 commit comments