Skip to content

Commit d43f05d

Browse files
committed
Various fixes
1 parent 2dfe959 commit d43f05d

File tree

2 files changed

+14
-12
lines changed

2 files changed

+14
-12
lines changed

submodules/AttachmentTextInputPanelNode/Sources/AttachmentTextInputPanelNode.swift

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -908,7 +908,9 @@ public class AttachmentTextInputPanelNode: ASDisplayNode, TGCaptionPanelView, AS
908908
}
909909
self.textPlaceholderNode.isHidden = inputHasText
910910

911-
let textInputFrame = CGRect(x: leftInset + textFieldInsets.left, y: textFieldInsets.top, width: baseWidth - textFieldInsets.left - textFieldInsets.right, height: panelHeight - textFieldInsets.top - textFieldInsets.bottom)
911+
let additionalRightInset = self.updateFieldAndButtonsLayout(inputHasText: inputHasText, panelHeight: panelHeight, transition: transition)
912+
913+
let textInputFrame = CGRect(x: leftInset + textFieldInsets.left, y: textFieldInsets.top, width: baseWidth - textFieldInsets.left - textFieldInsets.right - additionalRightInset, height: panelHeight - textFieldInsets.top - textFieldInsets.bottom)
912914
transition.updateFrame(node: self.textInputContainer, frame: textInputFrame)
913915

914916
if let textInputNode = self.textInputNode {
@@ -923,16 +925,14 @@ public class AttachmentTextInputPanelNode: ASDisplayNode, TGCaptionPanelView, AS
923925
}
924926
}
925927

926-
self.updateFieldAndButtonsLayout(inputHasText: inputHasText, panelHeight: panelHeight, transition: transition)
927-
928928
self.actionButtons.updateAccessibility()
929929

930930
return panelHeight
931931
}
932932

933-
private func updateFieldAndButtonsLayout(inputHasText: Bool, panelHeight: CGFloat, transition: ContainedViewLayoutTransition) {
933+
private func updateFieldAndButtonsLayout(inputHasText: Bool, panelHeight: CGFloat, transition: ContainedViewLayoutTransition) -> CGFloat {
934934
guard let (width, leftInset, rightInset, additionalSideInsets, _, metrics, _) = self.validLayout else {
935-
return
935+
return 0.0
936936
}
937937
var textFieldMinHeight: CGFloat = 33.0
938938
if let presentationInterfaceState = self.presentationInterfaceState {
@@ -954,6 +954,11 @@ public class AttachmentTextInputPanelNode: ASDisplayNode, TGCaptionPanelView, AS
954954
let baseWidth = width - leftInset - rightInset
955955
let textInputFrame = self.textInputContainer.frame
956956

957+
var textFieldInsets = self.textFieldInsets(metrics: metrics)
958+
if additionalSideInsets.right > 0.0 {
959+
textFieldInsets.right += additionalSideInsets.right / 3.0
960+
}
961+
957962
var textBackgroundInset: CGFloat = 0.0
958963
let actionButtonsSize: CGSize
959964
if let presentationInterfaceState = self.presentationInterfaceState {
@@ -973,11 +978,6 @@ public class AttachmentTextInputPanelNode: ASDisplayNode, TGCaptionPanelView, AS
973978
actionButtonsSize = CGSize(width: 44.0, height: minimalHeight)
974979
}
975980

976-
var textFieldInsets = self.textFieldInsets(metrics: metrics)
977-
if additionalSideInsets.right > 0.0 {
978-
textFieldInsets.right += additionalSideInsets.right / 3.0
979-
}
980-
981981
let actionButtonsFrame = CGRect(origin: CGPoint(x: width - rightInset - actionButtonsSize.width + 1.0 - UIScreenPixel + composeButtonsOffset, y: panelHeight - minimalHeight), size: actionButtonsSize)
982982
transition.updateFrame(node: self.actionButtons, frame: actionButtonsFrame)
983983

@@ -1027,6 +1027,8 @@ public class AttachmentTextInputPanelNode: ASDisplayNode, TGCaptionPanelView, AS
10271027
placeholderFrame = CGRect(origin: CGPoint(x: leftInset + textFieldInsets.left + self.textInputViewInternalInsets.left, y: textFieldInsets.top + self.textInputViewInternalInsets.top + textInputViewRealInsets.top + UIScreenPixel), size: self.textPlaceholderNode.frame.size)
10281028
}
10291029
transition.updateFrame(node: self.textPlaceholderNode, frame: placeholderFrame)
1030+
1031+
return textBackgroundInset
10301032
}
10311033

10321034
private var skipUpdate = false
@@ -1387,7 +1389,7 @@ public class AttachmentTextInputPanelNode: ASDisplayNode, TGCaptionPanelView, AS
13871389

13881390
let panelHeight = self.updateTextHeight(animated: animated)
13891391
if self.isAttachment, let panelHeight = panelHeight {
1390-
self.updateFieldAndButtonsLayout(inputHasText: inputHasText, panelHeight: panelHeight, transition: .animated(duration: 0.2, curve: .easeInOut))
1392+
let _ = self.updateFieldAndButtonsLayout(inputHasText: inputHasText, panelHeight: panelHeight, transition: .animated(duration: 0.2, curve: .easeInOut))
13911393
}
13921394
}
13931395

submodules/TelegramUI/Sources/ChatRecordingPreviewInputPanelNode.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ final class ChatRecordingPreviewInputPanelNode: ChatInputPanelNode {
426426
}
427427

428428
if let view = self.scrubber.view {
429-
view.frame = CGRect(origin: CGPoint(x: max(leftInset + 45.0, floorToScreenPixels((width - view.bounds.width) / 2.0)), y: 7.0 - UIScreenPixel), size: view.bounds.size)
429+
view.frame = CGRect(origin: CGPoint(x: min(width - innerSize.width - view.bounds.width, max(leftInset + 45.0, floorToScreenPixels((width - view.bounds.width) / 2.0))), y: 7.0 - UIScreenPixel), size: view.bounds.size)
430430
}
431431

432432
let panelHeight = defaultHeight(metrics: metrics)

0 commit comments

Comments
 (0)