mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-15 21:45:19 +00:00
Fix managed animation frame advancement
This commit is contained in:
parent
fdf3a1705b
commit
53ddac7c14
@ -190,13 +190,18 @@ open class ManagedAnimationNode: ASDisplayNode {
|
||||
|
||||
self.addSubnode(self.imageNode)
|
||||
|
||||
var previousTimestamp = CACurrentMediaTime()
|
||||
displayLinkUpdate = { [weak self] in
|
||||
if let strongSelf = self {
|
||||
let currentTimestamp = CACurrentMediaTime()
|
||||
strongSelf.delta = currentTimestamp - previousTimestamp
|
||||
let delta: Double
|
||||
if let previousTimestamp = strongSelf.previousTimestamp {
|
||||
delta = currentTimestamp - previousTimestamp
|
||||
} else {
|
||||
delta = 1.0 / 60.0
|
||||
}
|
||||
strongSelf.delta = delta
|
||||
strongSelf.updateAnimation()
|
||||
previousTimestamp = currentTimestamp
|
||||
strongSelf.previousTimestamp = currentTimestamp
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -216,6 +221,7 @@ open class ManagedAnimationNode: ASDisplayNode {
|
||||
}
|
||||
|
||||
self.didTryAdvancingState = false
|
||||
self.previousTimestamp = CACurrentMediaTime()
|
||||
self.displayLink.isPaused = false
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user