mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 22:55:00 +00:00
Improve context panels appearance animation
This commit is contained in:
@@ -120,6 +120,7 @@ final class CommandMenuChatInputContextPanelNode: ChatInputContextPanelNode {
|
||||
if sendImmediately {
|
||||
interfaceInteraction.sendBotCommand(command.peer, "/" + command.command.text)
|
||||
} else {
|
||||
interfaceInteraction.updateShowCommands { _ in return false }
|
||||
interfaceInteraction.updateTextInputStateAndMode { textInputState, inputMode in
|
||||
var commandQueryRange: NSRange?
|
||||
inner: for (range, type, _) in textInputStateContextQueryRangeAndType(textInputState) {
|
||||
@@ -128,7 +129,6 @@ final class CommandMenuChatInputContextPanelNode: ChatInputContextPanelNode {
|
||||
break inner
|
||||
}
|
||||
}
|
||||
|
||||
if let range = commandQueryRange {
|
||||
let inputText = NSMutableAttributedString(attributedString: textInputState.inputText)
|
||||
|
||||
@@ -143,7 +143,6 @@ final class CommandMenuChatInputContextPanelNode: ChatInputContextPanelNode {
|
||||
let selectionPosition = (inputText.string as NSString).length + 1
|
||||
return (ChatTextInputState(inputText: inputText, selectionRange: selectionPosition ..< selectionPosition), inputMode)
|
||||
}
|
||||
return (textInputState, inputMode)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -193,7 +192,10 @@ final class CommandMenuChatInputContextPanelNode: ChatInputContextPanelNode {
|
||||
|
||||
if let topItemOffset = topItemOffset {
|
||||
let position = strongSelf.listView.layer.position
|
||||
strongSelf.listView.layer.animatePosition(from: CGPoint(x: position.x, y: position.y + (strongSelf.listView.bounds.size.height - topItemOffset)), to: position, duration: 0.3, timingFunction: kCAMediaTimingFunctionSpring)
|
||||
strongSelf.listView.position = CGPoint(x: position.x, y: position.y + (strongSelf.listView.bounds.size.height - topItemOffset))
|
||||
ContainedViewLayoutTransition.animated(duration: 0.3, curve: .spring).animateView {
|
||||
strongSelf.listView.position = position
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user