mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-10-09 03:20:48 +00:00
Use velocity when switching sticker packs in preview
This commit is contained in:
parent
a9e36a8c55
commit
a5a87436dd
@ -639,9 +639,13 @@ private final class StickerPackScreenNode: ViewControllerTracingNode {
|
||||
}
|
||||
case .ended, .cancelled:
|
||||
let translation = recognizer.translation(in: self.view)
|
||||
let velocity = recognizer.velocity(in: self.view)
|
||||
if abs(translation.x) > 30.0 {
|
||||
let deltaIndex = translation.x > 0 ? -1 : 1
|
||||
self.selectedStickerPackIndex = max(0, min(self.containers.count - 1, Int(self.selectedStickerPackIndex + deltaIndex)))
|
||||
} else if abs(velocity.x) > 100.0 {
|
||||
let deltaIndex = velocity.x > 0 ? -1 : 1
|
||||
self.selectedStickerPackIndex = max(0, min(self.containers.count - 1, Int(self.selectedStickerPackIndex + deltaIndex)))
|
||||
}
|
||||
self.relativeToSelectedStickerPackTransition = 0.0
|
||||
if let layout = self.validLayout {
|
||||
|
Loading…
x
Reference in New Issue
Block a user