mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Various Fixes
This commit is contained in:
parent
98f30de9fb
commit
d99dbbffb7
@ -542,6 +542,24 @@ public final class ChatMessageBubbleBackdrop: ASDisplayNode {
|
|||||||
self.backgroundContent?.offsetSpring(value: value, duration: duration, damping: damping)
|
self.backgroundContent?.offsetSpring(value: value, duration: duration, damping: damping)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public func updateFrame(_ value: CGRect, animator: ControlledTransitionAnimator, completion: @escaping () -> Void = {}) {
|
||||||
|
if let maskView = self.maskView {
|
||||||
|
animator.updateFrame(layer: maskView.layer, frame: CGRect(origin: CGPoint(x: 0.0, y: 0.0), size: CGSize(width: value.size.width, height: value.size.height)).insetBy(dx: -maskInset, dy: -maskInset), completion: nil)
|
||||||
|
}
|
||||||
|
if let backgroundContent = self.backgroundContent {
|
||||||
|
animator.updateFrame(layer: backgroundContent.layer, frame: CGRect(origin: CGPoint(x: 0.0, y: 0.0), size: CGSize(width: value.size.width, height: value.size.height)), completion: nil)
|
||||||
|
if let (rect, containerSize) = self.absolutePosition {
|
||||||
|
var backgroundFrame = backgroundContent.frame
|
||||||
|
backgroundFrame.origin.x += rect.minX
|
||||||
|
backgroundFrame.origin.y += rect.minY
|
||||||
|
backgroundContent.update(rect: backgroundFrame, within: containerSize, transition: .animated(duration: animator.duration, curve: .spring))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
animator.updateFrame(layer: self.layer, frame: value, completion: { _ in
|
||||||
|
completion()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
public func updateFrame(_ value: CGRect, transition: ContainedViewLayoutTransition, completion: @escaping () -> Void = {}) {
|
public func updateFrame(_ value: CGRect, transition: ContainedViewLayoutTransition, completion: @escaping () -> Void = {}) {
|
||||||
if let maskView = self.maskView {
|
if let maskView = self.maskView {
|
||||||
transition.updateFrame(view: maskView, frame: CGRect(origin: CGPoint(x: 0.0, y: 0.0), size: CGSize(width: value.size.width, height: value.size.height)).insetBy(dx: -maskInset, dy: -maskInset))
|
transition.updateFrame(view: maskView, frame: CGRect(origin: CGPoint(x: 0.0, y: 0.0), size: CGSize(width: value.size.width, height: value.size.height)).insetBy(dx: -maskInset, dy: -maskInset))
|
||||||
|
@ -2764,31 +2764,37 @@ class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewItemNode
|
|||||||
shareButtonNode.removeFromSupernode()
|
shareButtonNode.removeFromSupernode()
|
||||||
}
|
}
|
||||||
|
|
||||||
if case .System = animation/*, !strongSelf.mainContextSourceNode.isExtractedToContextPreview*/ {
|
if case let .System(duration, _) = animation/*, !strongSelf.mainContextSourceNode.isExtractedToContextPreview*/ {
|
||||||
if !strongSelf.backgroundNode.frame.equalTo(backgroundFrame) {
|
if !strongSelf.backgroundNode.frame.equalTo(backgroundFrame) {
|
||||||
animation.animator.updateFrame(layer: strongSelf.backgroundNode.layer, frame: backgroundFrame, completion: nil)
|
if useDisplayLinkAnimations {
|
||||||
animation.animator.updatePosition(layer: strongSelf.clippingNode.layer, position: backgroundFrame.center, completion: nil)
|
let backgroundAnimation = ListViewAnimation(from: strongSelf.backgroundNode.frame, to: backgroundFrame, duration: duration * UIView.animationDurationFactor(), curve: strongSelf.preferredAnimationCurve, beginAt: beginAt, update: { [weak strongSelf] _, frame in
|
||||||
strongSelf.clippingNode.clipsToBounds = true
|
if let strongSelf = strongSelf {
|
||||||
animation.animator.updateBounds(layer: strongSelf.clippingNode.layer, bounds: CGRect(origin: CGPoint(x: backgroundFrame.minX, y: backgroundFrame.minY), size: backgroundFrame.size), completion: { [weak strongSelf] _ in
|
strongSelf.backgroundNode.frame = frame
|
||||||
let _ = strongSelf
|
strongSelf.clippingNode.position = CGPoint(x: frame.midX, y: frame.midY)
|
||||||
//strongSelf?.clippingNode.clipsToBounds = false
|
strongSelf.clippingNode.bounds = CGRect(origin: CGPoint(x: frame.minX, y: frame.minY), size: frame.size)
|
||||||
})
|
|
||||||
|
strongSelf.backgroundNode.updateLayout(size: frame.size, transition: .immediate)
|
||||||
|
strongSelf.backgroundWallpaperNode.updateFrame(frame, transition: .immediate)
|
||||||
|
strongSelf.shadowNode.updateLayout(backgroundFrame: frame, transition: .immediate)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
strongSelf.setAnimationForKey("backgroundNodeFrame", animation: backgroundAnimation)
|
||||||
|
} else {
|
||||||
|
animation.animator.updateFrame(layer: strongSelf.backgroundNode.layer, frame: backgroundFrame, completion: nil)
|
||||||
|
animation.animator.updatePosition(layer: strongSelf.clippingNode.layer, position: backgroundFrame.center, completion: nil)
|
||||||
|
strongSelf.clippingNode.clipsToBounds = true
|
||||||
|
animation.animator.updateBounds(layer: strongSelf.clippingNode.layer, bounds: CGRect(origin: CGPoint(x: backgroundFrame.minX, y: backgroundFrame.minY), size: backgroundFrame.size), completion: { [weak strongSelf] _ in
|
||||||
|
let _ = strongSelf
|
||||||
|
//strongSelf?.clippingNode.clipsToBounds = false
|
||||||
|
})
|
||||||
|
|
||||||
strongSelf.backgroundNode.updateLayout(size: backgroundFrame.size, transition: animation)
|
strongSelf.backgroundNode.updateLayout(size: backgroundFrame.size, transition: animation)
|
||||||
animation.animator.updateFrame(layer: strongSelf.backgroundWallpaperNode.layer, frame: backgroundFrame, completion: nil)
|
animation.animator.updateFrame(layer: strongSelf.backgroundWallpaperNode.layer, frame: backgroundFrame, completion: nil)
|
||||||
strongSelf.shadowNode.updateLayout(backgroundFrame: backgroundFrame, transition: animation.transition)
|
strongSelf.shadowNode.updateLayout(backgroundFrame: backgroundFrame, transition: animation.transition)
|
||||||
strongSelf.backgroundWallpaperNode.updateFrame(backgroundFrame, transition: animation.transition)
|
strongSelf.backgroundWallpaperNode.updateFrame(backgroundFrame, transition: animation.transition)
|
||||||
|
}
|
||||||
|
|
||||||
if let _ = strongSelf.backgroundNode.type {
|
if let _ = strongSelf.backgroundNode.type {
|
||||||
/*var incomingOffset: CGFloat = 0.0
|
|
||||||
switch type {
|
|
||||||
case .incoming:
|
|
||||||
incomingOffset = 5.0
|
|
||||||
default:
|
|
||||||
break
|
|
||||||
}*/
|
|
||||||
//strongSelf.mainContextSourceNode.contentRect = backgroundFrame.offsetBy(dx: incomingOffset, dy: 0.0)
|
|
||||||
//strongSelf.mainContainerNode.targetNodeForActivationProgressContentRect = strongSelf.mainContextSourceNode.contentRect
|
|
||||||
if !strongSelf.mainContextSourceNode.isExtractedToContextPreview {
|
if !strongSelf.mainContextSourceNode.isExtractedToContextPreview {
|
||||||
if let (rect, size) = strongSelf.absoluteRect {
|
if let (rect, size) = strongSelf.absoluteRect {
|
||||||
strongSelf.updateAbsoluteRect(rect, within: size)
|
strongSelf.updateAbsoluteRect(rect, within: size)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user