diff --git a/Framework/Sources/FloatingPanel.swift b/Framework/Sources/FloatingPanel.swift index f71a9c5..187ed33 100644 --- a/Framework/Sources/FloatingPanel.swift +++ b/Framework/Sources/FloatingPanel.swift @@ -313,7 +313,7 @@ class FloatingPanel: NSObject, UIGestureRecognizerDelegate, UIScrollViewDelegate return } - if let animator = self.animator { + if let animator = self.animator, animator.isInterruptible { animator.stopAnimation(true) self.animator = nil } @@ -491,6 +491,7 @@ class FloatingPanel: NSObject, UIGestureRecognizerDelegate, UIScrollViewDelegate } private func startAnimation(to targetPosition: FloatingPanelPosition, at distance: CGFloat, with velocity: CGPoint) { + log.debug("startAnimation", targetPosition, distance, velocity) let targetY = layoutAdapter.positionY(for: targetPosition) let velocityVector = (distance != 0) ? CGVector(dx: 0, dy: max(min(velocity.y/distance, 30.0), -30.0)) : .zero let animator = behavior.interactionAnimator(self.viewcontroller, to: targetPosition, with: velocityVector) diff --git a/Framework/Sources/FloatingPanelBehavior.swift b/Framework/Sources/FloatingPanelBehavior.swift index 0b88062..e529821 100644 --- a/Framework/Sources/FloatingPanelBehavior.swift +++ b/Framework/Sources/FloatingPanelBehavior.swift @@ -85,7 +85,9 @@ public extension FloatingPanelBehavior { class FloatingPanelDefaultBehavior: FloatingPanelBehavior { func interactionAnimator(_ fpc: FloatingPanelController, to targetPosition: FloatingPanelPosition, with velocity: CGVector) -> UIViewPropertyAnimator { let timing = timeingCurve(with: velocity) - return UIViewPropertyAnimator(duration: 0, timingParameters: timing) + let animator = UIViewPropertyAnimator(duration: 0, timingParameters: timing) + animator.isInterruptible = false + return animator } private func timeingCurve(with velocity: CGVector) -> UITimingCurveProvider {