( velocity: number, flickThreshold: number, direction: SwipeDirection, slideVertically: boolean )
| 65 | * Determines whether a swipe gesture qualifies as a "flick" (fast swipe). |
| 66 | */ |
| 67 | export function isFlickSwipe( |
| 68 | velocity: number, |
| 69 | flickThreshold: number, |
| 70 | direction: SwipeDirection, |
| 71 | slideVertically: boolean |
| 72 | ): boolean { |
| 73 | const isSwipeUpOrDown = direction === "Up" || direction === "Down"; |
| 74 | const isSwipeLeftOrRight = direction === "Left" || direction === "Right"; |
| 75 | const isLeftRightFlick = velocity > flickThreshold && !isSwipeUpOrDown; |
| 76 | const isTopDownFlick = velocity > flickThreshold && !isSwipeLeftOrRight; |
| 77 | return slideVertically ? isTopDownFlick : isLeftRightFlick; |
| 78 | } |
| 79 | |
| 80 | /** |
| 81 | * Computes the target slide index after a swipe ends. |
no outgoing calls
no test coverage detected