mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-11-09 02:03:43 +00:00
Draw effects on top of the keyboard
This commit is contained in:
parent
ad9a903f21
commit
1b1846dc63
@ -2034,7 +2034,7 @@ public class ChatMessageAnimatedStickerItemNode: ChatMessageItemView {
|
|||||||
additionalAnimationNode.transform = CATransform3DMakeScale(-1.0, 1.0, 1.0)
|
additionalAnimationNode.transform = CATransform3DMakeScale(-1.0, 1.0, 1.0)
|
||||||
}
|
}
|
||||||
|
|
||||||
let decorationNode = transitionNode.add(decorationView: additionalAnimationNode.view, itemNode: self)
|
let decorationNode = transitionNode.add(decorationView: additionalAnimationNode.view, itemNode: self, aboveEverything: true)
|
||||||
additionalAnimationNode.completed = { [weak self, weak decorationNode, weak transitionNode] _ in
|
additionalAnimationNode.completed = { [weak self, weak decorationNode, weak transitionNode] _ in
|
||||||
guard let decorationNode = decorationNode else {
|
guard let decorationNode = decorationNode else {
|
||||||
return
|
return
|
||||||
|
|||||||
@ -1007,7 +1007,7 @@ open class ChatMessageItemView: ListViewItemNode, ChatMessageItemNodeProtocol {
|
|||||||
additionalAnimationNode.transform = CATransform3DMakeScale(-1.0, 1.0, 1.0)
|
additionalAnimationNode.transform = CATransform3DMakeScale(-1.0, 1.0, 1.0)
|
||||||
}
|
}
|
||||||
|
|
||||||
let decorationNode = transitionNode.add(decorationView: additionalAnimationNode.view, itemNode: self)
|
let decorationNode = transitionNode.add(decorationView: additionalAnimationNode.view, itemNode: self, aboveEverything: true)
|
||||||
additionalAnimationNode.completed = { [weak self, weak decorationNode, weak transitionNode] _ in
|
additionalAnimationNode.completed = { [weak self, weak decorationNode, weak transitionNode] _ in
|
||||||
guard let decorationNode = decorationNode else {
|
guard let decorationNode = decorationNode else {
|
||||||
return
|
return
|
||||||
|
|||||||
@ -10,6 +10,6 @@ public protocol ChatMessageTransitionNodeDecorationItemNode: ASDisplayNode {
|
|||||||
public protocol ChatMessageTransitionNode: AnyObject {
|
public protocol ChatMessageTransitionNode: AnyObject {
|
||||||
typealias DecorationItemNode = ChatMessageTransitionNodeDecorationItemNode
|
typealias DecorationItemNode = ChatMessageTransitionNodeDecorationItemNode
|
||||||
|
|
||||||
func add(decorationView: UIView, itemNode: ChatMessageItemNodeProtocol) -> DecorationItemNode
|
func add(decorationView: UIView, itemNode: ChatMessageItemNodeProtocol, aboveEverything: Bool) -> DecorationItemNode
|
||||||
func remove(decorationNode: DecorationItemNode)
|
func remove(decorationNode: DecorationItemNode)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -243,6 +243,8 @@ public final class ChatMessageTransitionNodeImpl: ASDisplayNode, ChatMessageTran
|
|||||||
final class DecorationItemNodeImpl: ASDisplayNode, ChatMessageTransitionNode.DecorationItemNode {
|
final class DecorationItemNodeImpl: ASDisplayNode, ChatMessageTransitionNode.DecorationItemNode {
|
||||||
let itemNode: ChatMessageItemNodeProtocol
|
let itemNode: ChatMessageItemNodeProtocol
|
||||||
let contentView: UIView
|
let contentView: UIView
|
||||||
|
var globalPortalSourceView: PortalSourceView?
|
||||||
|
let aboveEverything: Bool
|
||||||
private let getContentAreaInScreenSpace: () -> CGRect
|
private let getContentAreaInScreenSpace: () -> CGRect
|
||||||
|
|
||||||
private let scrollingContainer: ASDisplayNode
|
private let scrollingContainer: ASDisplayNode
|
||||||
@ -251,9 +253,10 @@ public final class ChatMessageTransitionNodeImpl: ASDisplayNode, ChatMessageTran
|
|||||||
|
|
||||||
fileprivate weak var overlayController: OverlayTransitionContainerController?
|
fileprivate weak var overlayController: OverlayTransitionContainerController?
|
||||||
|
|
||||||
init(itemNode: ChatMessageItemNodeProtocol, contentView: UIView, getContentAreaInScreenSpace: @escaping () -> CGRect) {
|
init(itemNode: ChatMessageItemNodeProtocol, contentView: UIView, aboveEverything: Bool, getContentAreaInScreenSpace: @escaping () -> CGRect) {
|
||||||
self.itemNode = itemNode
|
self.itemNode = itemNode
|
||||||
self.contentView = contentView
|
self.contentView = contentView
|
||||||
|
self.aboveEverything = aboveEverything
|
||||||
self.getContentAreaInScreenSpace = getContentAreaInScreenSpace
|
self.getContentAreaInScreenSpace = getContentAreaInScreenSpace
|
||||||
|
|
||||||
self.clippingNode = ASDisplayNode()
|
self.clippingNode = ASDisplayNode()
|
||||||
@ -267,14 +270,26 @@ public final class ChatMessageTransitionNodeImpl: ASDisplayNode, ChatMessageTran
|
|||||||
self.addSubnode(self.clippingNode)
|
self.addSubnode(self.clippingNode)
|
||||||
self.clippingNode.addSubnode(self.scrollingContainer)
|
self.clippingNode.addSubnode(self.scrollingContainer)
|
||||||
self.scrollingContainer.addSubnode(self.containerNode)
|
self.scrollingContainer.addSubnode(self.containerNode)
|
||||||
|
|
||||||
|
if aboveEverything {
|
||||||
|
let globalPortalSourceView = PortalSourceView()
|
||||||
|
globalPortalSourceView.needsGlobalPortal = true
|
||||||
|
self.globalPortalSourceView = globalPortalSourceView
|
||||||
|
globalPortalSourceView.addSubview(self.contentView)
|
||||||
|
self.containerNode.view.addSubview(globalPortalSourceView)
|
||||||
|
} else {
|
||||||
self.containerNode.view.addSubview(self.contentView)
|
self.containerNode.view.addSubview(self.contentView)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func updateLayout(size: CGSize) {
|
func updateLayout(size: CGSize) {
|
||||||
self.clippingNode.frame = CGRect(origin: CGPoint(), size: size)
|
self.clippingNode.frame = CGRect(origin: CGPoint(), size: size)
|
||||||
|
|
||||||
let absoluteRect = self.itemNode.view.convert(self.itemNode.view.bounds, to: self.itemNode.supernode?.supernode?.view)
|
let absoluteRect = self.itemNode.view.convert(self.itemNode.view.bounds, to: self.itemNode.supernode?.supernode?.view)
|
||||||
self.containerNode.frame = absoluteRect
|
self.containerNode.frame = absoluteRect
|
||||||
|
if let globalPortalSourceView = self.globalPortalSourceView {
|
||||||
|
globalPortalSourceView.frame = CGRect(origin: CGPoint(), size: size)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func addExternalOffset(offset: CGFloat, transition: ContainedViewLayoutTransition) {
|
func addExternalOffset(offset: CGFloat, transition: ContainedViewLayoutTransition) {
|
||||||
@ -962,8 +977,8 @@ public final class ChatMessageTransitionNodeImpl: ASDisplayNode, ChatMessageTran
|
|||||||
self.listNode.setCurrentSendAnimationCorrelationIds(correlationIds)
|
self.listNode.setCurrentSendAnimationCorrelationIds(correlationIds)
|
||||||
}
|
}
|
||||||
|
|
||||||
public func add(decorationView: UIView, itemNode: ChatMessageItemNodeProtocol) -> DecorationItemNode {
|
public func add(decorationView: UIView, itemNode: ChatMessageItemNodeProtocol, aboveEverything: Bool) -> DecorationItemNode {
|
||||||
let decorationItemNode = DecorationItemNodeImpl(itemNode: itemNode, contentView: decorationView, getContentAreaInScreenSpace: self.getContentAreaInScreenSpace)
|
let decorationItemNode = DecorationItemNodeImpl(itemNode: itemNode, contentView: decorationView, aboveEverything: aboveEverything, getContentAreaInScreenSpace: self.getContentAreaInScreenSpace)
|
||||||
decorationItemNode.updateLayout(size: self.bounds.size)
|
decorationItemNode.updateLayout(size: self.bounds.size)
|
||||||
|
|
||||||
self.decorationItemNodes.append(decorationItemNode)
|
self.decorationItemNodes.append(decorationItemNode)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user