Skip to content

Commit da4e1d2

Browse files
authored
Fix quick pull down (#385)
1 parent 2ce1375 commit da4e1d2

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

Framework/Sources/FloatingPanelCore.swift

+7-1
Original file line numberDiff line numberDiff line change
@@ -618,7 +618,13 @@ class FloatingPanelCore: NSObject, UIGestureRecognizerDelegate {
618618
endInteraction(for: targetPosition)
619619

620620
if isRemovalInteractionEnabled, isBottomState {
621-
let velocityVector = (distance != 0) ? CGVector(dx: 0, dy: min(velocity.y/distance, behavior.removalVelocity)) : .zero
621+
let velocityVector: CGVector
622+
if distance == 0 {
623+
velocityVector = .zero
624+
} else {
625+
let dy = min(velocity.y / abs(distance), behavior.removalVelocity)
626+
velocityVector = CGVector(dx: 0, dy: dy)
627+
}
622628
// `velocityVector` will be replaced by just a velocity(not vector) when FloatingPanelRemovalInteraction will be added.
623629
if shouldStartRemovalAnimation(with: velocityVector), let vc = viewcontroller {
624630
vc.delegate?.floatingPanelDidEndDraggingToRemove(vc, withVelocity: velocity)

0 commit comments

Comments
 (0)