mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-24 07:05:35 +00:00
Use velocity when switching sticker packs in preview
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user