You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The card gets stuck at the top of the view when sliding quickly, Here is the fix code:
@objcfunc handlePan(_ recognizer:UIPanGestureRecognizer){
guard let swipeableView = swipeableView else{return}lettranslation= recognizer.translation(in: containerView)letlocation= recognizer.location(in: containerView)letvelocity= recognizer.velocity(in: containerView)letmovement=Movement(location: location, translation: translation, velocity: velocity)
switch recognizer.state {case.began:
guard case .snapping(_)= state else{return}
state =.moving(location)
swipeableView.didStart?(view, location)case.changed:
guard case .moving(_)= state else{return}
state =.moving(location)
swipeableView.swiping?(view, location, translation)case.ended,.cancelled:
guard case .moving(_)= state else{return}
if swipeableView.shouldSwipeView(view, movement, swipeableView){letdirectionVector=CGVector(point: translation.normalized * max(velocity.magnitude, swipeableView.minVelocityInPointPerSecond))// The reason is that fast sliding will have a directionVector of Nan, and the relevant judgment is added here
guard directionVector.dx.isNaN || directionVector.dy.isNaN else{
state =.swiping(location, directionVector)
swipeableView.swipeView(view, location: location, directionVector: directionVector)
swipeableView.didEnd?(view, location)return}}
state =snappingStateAtContainerCenter()
swipeableView.didCancel?(view)
swipeableView.didEnd?(view, location)default:
break
}}
The text was updated successfully, but these errors were encountered:
The card gets stuck at the top of the view when sliding quickly, Here is the fix code:
The text was updated successfully, but these errors were encountered: