Skip to content

Commit 076fa97

Browse files
authored
Merge pull request #102 from chrilith/master
Fixed unexpected positioning swiping fast with the finger
2 parents a39ef3b + 85c417e commit 076fa97

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

Source/Animations/DissolveAnimation.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ extension DissolveAnimation {
6767
if view.layer.animationKeys() == nil {
6868
if view.superview != nil {
6969
let ratio = offsetRatio > 0.0 ? offsetRatio : (1.0 + offsetRatio)
70-
view.alpha = ratio
70+
view.alpha = min(0.0, max(1.0, ratio))
7171
}
7272
}
7373
}

Source/Animations/PopAnimation.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ extension PopAnimation {
7575
if view.layer.animationKeys() == nil {
7676
if view.superview != nil {
7777
let ratio = offsetRatio > 0.0 ? offsetRatio : (1.0 + offsetRatio)
78-
view.alpha = ratio
78+
view.alpha = min(0.0, max(1.0, ratio))
7979
}
8080
}
8181
}

Source/Animations/TransitionAnimation.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ extension TransitionAnimation {
9090
let startY = position.yInFrame(superview.bounds)
9191
let dy = destination.yInFrame(superview.bounds) - startY
9292

93-
let ratio = offsetRatio > 0.0 ? offsetRatio : (1.0 + offsetRatio)
93+
let ratio = min(0.0, max(1.0, offsetRatio > 0.0 ? offsetRatio : (1.0 + offsetRatio)))
9494
let offsetX = dx * ratio
9595
let offsetY = dy * ratio
9696

0 commit comments

Comments
 (0)