mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-10-09 03:20:48 +00:00
Update offset animation
This commit is contained in:
parent
0f2e9e955c
commit
62296c85ff
@ -161,24 +161,27 @@ private final class StickerPackContainer: ASDisplayNode {
|
||||
guard let strongSelf = self, !strongSelf.isDismissed else {
|
||||
return
|
||||
}
|
||||
let contentOffset = targetOffset
|
||||
let insets = strongSelf.gridNode.scrollView.contentInset
|
||||
var modalProgress: CGFloat = 0.0
|
||||
|
||||
if contentOffset.y < 0.0 && contentOffset.y >= -insets.top {
|
||||
if contentOffset.y > -insets.top / 2.0 || velocity.y <= -100.0 {
|
||||
strongSelf.gridNode.scrollView.setContentOffset(CGPoint(x: 0.0, y: 0.0), animated: true)
|
||||
DispatchQueue.main.async {
|
||||
let contentOffset = targetOffset
|
||||
let insets = strongSelf.gridNode.scrollView.contentInset
|
||||
var modalProgress: CGFloat = 0.0
|
||||
|
||||
if contentOffset.y < 0.0 && contentOffset.y >= -insets.top {
|
||||
strongSelf.gridNode.scrollView.stopScrollingAnimation()
|
||||
if contentOffset.y > -insets.top / 2.0 || velocity.y <= -100.0 {
|
||||
strongSelf.gridNode.scrollView.setContentOffset(CGPoint(x: 0.0, y: 0.0), animated: true)
|
||||
modalProgress = 1.0
|
||||
} else {
|
||||
strongSelf.gridNode.scrollView.setContentOffset(CGPoint(x: 0.0, y: -insets.top), animated: true)
|
||||
}
|
||||
} else if contentOffset.y >= 0.0 {
|
||||
modalProgress = 1.0
|
||||
} else {
|
||||
strongSelf.gridNode.scrollView.setContentOffset(CGPoint(x: 0.0, y: -insets.top), animated: true)
|
||||
}
|
||||
} else if contentOffset.y >= 0.0 {
|
||||
modalProgress = 1.0
|
||||
}
|
||||
|
||||
if abs(strongSelf.modalProgress - modalProgress) > CGFloat.ulpOfOne {
|
||||
strongSelf.modalProgress = modalProgress
|
||||
strongSelf.expandProgressUpdated(strongSelf, .animated(duration: 0.4, curve: .spring))
|
||||
|
||||
if abs(strongSelf.modalProgress - modalProgress) > CGFloat.ulpOfOne {
|
||||
strongSelf.modalProgress = modalProgress
|
||||
strongSelf.expandProgressUpdated(strongSelf, .animated(duration: 0.4, curve: .spring))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user