mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-10-09 03:20:48 +00:00
Various fixes
This commit is contained in:
parent
f406efbd8d
commit
7b741d20a6
@ -3987,8 +3987,10 @@ final class DoneButtonComponent: CombinedComponent {
|
|||||||
)
|
)
|
||||||
|
|
||||||
let backgroundHeight: CGFloat = 33.0
|
let backgroundHeight: CGFloat = 33.0
|
||||||
|
var backgroundSize = CGSize(width: backgroundHeight, height: backgroundHeight)
|
||||||
|
|
||||||
|
let textSpacing: CGFloat = 7.0
|
||||||
|
|
||||||
var textWidth: CGFloat = 0.0
|
|
||||||
var title: _UpdatedChildComponent?
|
var title: _UpdatedChildComponent?
|
||||||
if let titleText = context.component.title {
|
if let titleText = context.component.title {
|
||||||
title = text.update(
|
title = text.update(
|
||||||
@ -4000,14 +4002,15 @@ final class DoneButtonComponent: CombinedComponent {
|
|||||||
availableSize: CGSize(width: 180.0, height: 100.0),
|
availableSize: CGSize(width: 180.0, height: 100.0),
|
||||||
transition: .immediate
|
transition: .immediate
|
||||||
)
|
)
|
||||||
textWidth = title!.size.width
|
|
||||||
|
let updatedBackgroundWidth = backgroundSize.width + textSpacing + title!.size.width
|
||||||
|
if updatedBackgroundWidth < 126.0 {
|
||||||
|
backgroundSize.width = updatedBackgroundWidth
|
||||||
|
} else {
|
||||||
|
title = nil
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var backgroundSize = CGSize(width: 33.0, height: backgroundHeight)
|
|
||||||
if !textWidth.isZero {
|
|
||||||
backgroundSize.width += textWidth + 7.0
|
|
||||||
}
|
|
||||||
|
|
||||||
let background = background.update(
|
let background = background.update(
|
||||||
component: RoundedRectangle(color: context.component.backgroundColor, cornerRadius: backgroundHeight / 2.0),
|
component: RoundedRectangle(color: context.component.backgroundColor, cornerRadius: backgroundHeight / 2.0),
|
||||||
availableSize: backgroundSize,
|
availableSize: backgroundSize,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user