mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 14:45:21 +00:00
Location view fixes
This commit is contained in:
@@ -5,6 +5,7 @@ import Display
|
||||
import TelegramPresentationData
|
||||
|
||||
private let textFont = Font.with(size: 13.0, design: .round, traits: [.bold])
|
||||
private let smallTextFont = Font.with(size: 11.0, design: .round, traits: [.bold])
|
||||
|
||||
private class ChatMessageLiveLocationTimerNodeParams: NSObject {
|
||||
let backgroundColor: UIColor
|
||||
@@ -119,10 +120,16 @@ public final class ChatMessageLiveLocationTimerNode: ASDisplayNode {
|
||||
path.lineCapStyle = .round
|
||||
path.stroke()
|
||||
|
||||
let attributes: [NSAttributedString.Key: Any] = [.font: textFont, .foregroundColor: parameters.foregroundColor]
|
||||
let attributes: [NSAttributedString.Key: Any] = [.font: parameters.string.count > 2 ? smallTextFont : textFont, .foregroundColor: parameters.foregroundColor]
|
||||
let nsString = parameters.string as NSString
|
||||
let size = nsString.size(withAttributes: attributes)
|
||||
nsString.draw(at: CGPoint(x: floor((bounds.size.width - size.width) / 2.0), y: floor((bounds.size.height - size.height) / 2.0)), withAttributes: attributes)
|
||||
|
||||
var offset: CGFloat = 0.0
|
||||
if parameters.string.count > 2 {
|
||||
offset = UIScreenPixel
|
||||
}
|
||||
|
||||
nsString.draw(at: CGPoint(x: floor((bounds.size.width - size.width) / 2.0), y: floor((bounds.size.height - size.height) / 2.0) + offset), withAttributes: attributes)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user