@@ -2374,6 +2374,7 @@ public class ChatTextInputPanelNode: ChatInputPanelNode, ASEditableTextNodeDeleg
23742374 contentHeight += textInputHeight
23752375 contentHeight += textFieldInsets. bottom
23762376
2377+ let previousTextInputContainerBackgroundFrame = self . textInputContainer. frame
23772378 let textInputContainerBackgroundFrame = CGRect ( x: hideOffset. x + leftInset + textFieldInsets. left, y: hideOffset. y + textFieldInsets. top, width: textInputWidth, height: contentHeight)
23782379 let textInputFrame = textInputContainerBackgroundFrame
23792380
@@ -2815,8 +2816,26 @@ public class ChatTextInputPanelNode: ChatInputPanelNode, ASEditableTextNodeDeleg
28152816 transition. updateAlpha ( node: self . recordMoreButton, alpha: recordMoreIsVisible ? 1.0 : 0.0 )
28162817 transition. updateTransformScale ( node: self . recordMoreButton, scale: recordMoreIsVisible ? 1.0 : 0.01 )
28172818
2819+ let contextPanelMaskInset : CGFloat = 32.0
2820+ let contextPanelBottomInset = floor ( minimalInputHeight * 0.5 )
2821+ let contextPanelFrame = CGRect ( origin: CGPoint ( x: textInputContainerBackgroundFrame. minX, y: contentHeight - maxOverlayHeight) , size: CGSize ( width: textInputContainerBackgroundFrame. width, height: max ( 0.0 , maxOverlayHeight - contentHeight + contextPanelBottomInset) ) )
2822+
28182823 if contextPanelNode !== previousContextPanel? . panel, let previousContextPanel {
28192824 let panelContainer = previousContextPanel. container
2825+
2826+ transition. updateFrame ( view: previousContextPanel. container, frame: contextPanelFrame)
2827+ transition. updateFrame ( view: previousContextPanel. panel. view, frame: CGRect ( origin: CGPoint ( ) , size: contextPanelFrame. size) )
2828+ transition. updateFrame ( view: previousContextPanel. mask, frame: CGRect ( origin: CGPoint ( ) , size: contextPanelFrame. size) . insetBy ( dx: - contextPanelMaskInset, dy: - contextPanelMaskInset) )
2829+
2830+ previousContextPanel. panel. updateLayout (
2831+ size: contextPanelFrame. size,
2832+ leftInset: 0.0 ,
2833+ rightInset: 0.0 ,
2834+ bottomInset: contextPanelBottomInset,
2835+ transition: transition,
2836+ interfaceState: interfaceState
2837+ )
2838+
28202839 previousContextPanel. panel. animateOut ( completion: { [ weak panelContainer] in
28212840 panelContainer? . removeFromSuperview ( )
28222841 } )
@@ -2829,37 +2848,46 @@ public class ChatTextInputPanelNode: ChatInputPanelNode, ASEditableTextNodeDeleg
28292848 }
28302849
28312850 if let contextPanel = self . contextPanel {
2832- let maskInset : CGFloat = 32.0
2833- var contextPanelTransition = transition
2851+ let previousContextPanelFrame = CGRect ( origin : CGPoint ( x : previousTextInputContainerBackgroundFrame . minX , y : contentHeight - maxOverlayHeight ) , size : CGSize ( width : previousTextInputContainerBackgroundFrame . width , height : max ( 0.0 , maxOverlayHeight - contentHeight + contextPanelBottomInset ) ) )
2852+
28342853 if contextPanel. container. superview == nil {
2835- contextPanelTransition = . immediate
28362854 self . view. insertSubview ( contextPanel. container, belowSubview: self . clippingNode. view)
28372855 contextPanel. container. addSubview ( contextPanel. panel. view)
28382856 contextPanel. container. mask = contextPanel. mask
2839- //contextPanel.container.addSubview(contextPanel.mask)
28402857 let maskSize = floor ( minimalInputHeight)
2841- contextPanel. mask. image = generateImage ( CGSize ( width: maskSize + maskInset * 2.0 , height: maskSize + maskInset * 2.0 ) , rotatedContext: { size, context in
2858+ contextPanel. mask. image = generateImage ( CGSize ( width: maskSize + contextPanelMaskInset * 2.0 , height: maskSize + contextPanelMaskInset * 2.0 ) , rotatedContext: { size, context in
28422859 context. setFillColor ( UIColor . black. cgColor)
28432860 context. fill ( CGRect ( origin: CGPoint ( ) , size: size) )
28442861 context. setBlendMode ( . copy)
28452862 context. setFillColor ( UIColor . clear. cgColor)
2846- context. fillEllipse ( in: CGRect ( origin: CGPoint ( x: maskInset, y: maskInset + maskSize * 0.5 ) , size: CGSize ( width: maskSize, height: maskSize) ) )
2847- context. fill ( CGRect ( origin: CGPoint ( x: 0.0 , y: maskInset + maskSize) , size: CGSize ( width: maskSize + maskInset * 2.0 , height: maskSize + maskInset) ) )
2848- } ) ? . stretchableImage ( withLeftCapWidth: Int ( maskInset) + Int( maskSize) / 2 , topCapHeight: Int ( maskInset) + 1 )
2863+ context. fillEllipse ( in: CGRect ( origin: CGPoint ( x: contextPanelMaskInset, y: contextPanelMaskInset + maskSize * 0.5 ) , size: CGSize ( width: maskSize, height: maskSize) ) )
2864+ context. fill ( CGRect ( origin: CGPoint ( x: 0.0 , y: contextPanelMaskInset + maskSize) , size: CGSize ( width: maskSize + contextPanelMaskInset * 2.0 , height: maskSize + contextPanelMaskInset) ) )
2865+ } ) ? . stretchableImage ( withLeftCapWidth: Int ( contextPanelMaskInset) + Int( maskSize) / 2 , topCapHeight: Int ( contextPanelMaskInset) + 1 )
2866+
2867+ contextPanel. container. frame = previousContextPanelFrame
2868+ contextPanel. panel. view. frame = CGRect ( origin: CGPoint ( ) , size: previousContextPanelFrame. size)
2869+ contextPanel. mask. frame = CGRect ( origin: CGPoint ( ) , size: previousContextPanelFrame. size) . insetBy ( dx: - contextPanelMaskInset, dy: - contextPanelMaskInset)
2870+
2871+ contextPanel. panel. updateLayout (
2872+ size: previousContextPanelFrame. size,
2873+ leftInset: 0.0 ,
2874+ rightInset: 0.0 ,
2875+ bottomInset: contextPanelBottomInset,
2876+ transition: . immediate,
2877+ interfaceState: interfaceState
2878+ )
28492879 }
2850- let contextPanelBottomInset = floor ( minimalInputHeight * 0.5 )
2851- let contextPanelFrame = CGRect ( origin: CGPoint ( x: textInputContainerBackgroundFrame. minX, y: contentHeight - maxOverlayHeight) , size: CGSize ( width: textInputContainerBackgroundFrame. width, height: max ( 0.0 , maxOverlayHeight - contentHeight + contextPanelBottomInset) ) )
28522880
2853- contextPanelTransition . updateFrame ( view: contextPanel. container, frame: contextPanelFrame)
2854- contextPanelTransition . updateFrame ( view: contextPanel. panel. view, frame: CGRect ( origin: CGPoint ( ) , size: contextPanelFrame. size) )
2855- contextPanelTransition . updateFrame ( view: contextPanel. mask, frame: CGRect ( origin: CGPoint ( ) , size: contextPanelFrame. size) . insetBy ( dx: - maskInset , dy: - maskInset ) )
2881+ transition . updateFrame ( view: contextPanel. container, frame: contextPanelFrame)
2882+ transition . updateFrame ( view: contextPanel. panel. view, frame: CGRect ( origin: CGPoint ( ) , size: contextPanelFrame. size) )
2883+ transition . updateFrame ( view: contextPanel. mask, frame: CGRect ( origin: CGPoint ( ) , size: contextPanelFrame. size) . insetBy ( dx: - contextPanelMaskInset , dy: - contextPanelMaskInset ) )
28562884
28572885 contextPanel. panel. updateLayout (
28582886 size: contextPanelFrame. size,
28592887 leftInset: 0.0 ,
28602888 rightInset: 0.0 ,
28612889 bottomInset: contextPanelBottomInset,
2862- transition: contextPanelTransition ,
2890+ transition: transition ,
28632891 interfaceState: interfaceState
28642892 )
28652893 }
0 commit comments