mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-08-02 00:17:02 +00:00
Attachment menu improvements
This commit is contained in:
parent
953624e278
commit
555c097d07
@ -344,7 +344,6 @@ public class AttachmentController: ViewController {
|
|||||||
snapshotView.frame = self.container.container.frame
|
snapshotView.frame = self.container.container.frame
|
||||||
self.container.clipNode.view.addSubview(snapshotView)
|
self.container.clipNode.view.addSubview(snapshotView)
|
||||||
|
|
||||||
let alreadyAnimating = self.animating
|
|
||||||
self.animating = true
|
self.animating = true
|
||||||
|
|
||||||
let _ = (controller.ready.get()
|
let _ = (controller.ready.get()
|
||||||
@ -358,19 +357,25 @@ public class AttachmentController: ViewController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if case .compact = layout.metrics.widthClass {
|
if case .compact = layout.metrics.widthClass {
|
||||||
if !alreadyAnimating {
|
let offset = 25.0
|
||||||
let offset = 25.0
|
|
||||||
strongSelf.container.clipNode.layer.animatePosition(from: CGPoint(), to: CGPoint(x: 0.0, y: offset), duration: 0.15, removeOnCompletion: false, additive: true, completion: { [weak self] finished in
|
let initialPosition = strongSelf.container.clipNode.layer.position
|
||||||
if let strongSelf = self, finished {
|
let targetPosition = initialPosition.offsetBy(dx: 0.0, dy: offset)
|
||||||
strongSelf.container.clipNode.layer.animateSpring(from: NSValue(cgPoint: CGPoint(x: 0.0, y: 0.0)), to: NSValue(cgPoint: CGPoint(x: 0.0, y: -offset)), keyPath: "position", duration: 0.45, delay: 0.0, initialVelocity: 0.0, damping: 70.0, removeOnCompletion: false, additive: true, completion: { [weak self] finished in
|
var startPosition = initialPosition
|
||||||
if finished {
|
if let presentation = strongSelf.container.clipNode.layer.presentation() {
|
||||||
self?.container.clipNode.layer.removeAllAnimations()
|
startPosition = presentation.position
|
||||||
self?.animating = false
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
strongSelf.container.clipNode.layer.animatePosition(from: startPosition, to: targetPosition, duration: 0.2, removeOnCompletion: false, completion: { [weak self] finished in
|
||||||
|
if let strongSelf = self, finished {
|
||||||
|
strongSelf.container.clipNode.layer.animateSpring(from: NSValue(cgPoint: targetPosition), to: NSValue(cgPoint: initialPosition), keyPath: "position", duration: 0.4, delay: 0.0, initialVelocity: 0.0, damping: 70.0, removeOnCompletion: false, completion: { [weak self] finished in
|
||||||
|
if finished {
|
||||||
|
self?.container.clipNode.layer.removeAllAnimations()
|
||||||
|
self?.animating = false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
} else {
|
} else {
|
||||||
strongSelf.animating = false
|
strongSelf.animating = false
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user