mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-24 07:05:35 +00:00
UI improvements
This commit is contained in:
@@ -127,6 +127,12 @@ public class ImageNode: ASDisplayNode {
|
||||
private var first = true
|
||||
private let enableEmpty: Bool
|
||||
|
||||
private let _contentReady = Promise<Bool>()
|
||||
private var didSetReady: Bool = false
|
||||
public var contentReady: Signal<Bool, NoError> {
|
||||
return self._contentReady.get()
|
||||
}
|
||||
|
||||
public var ready: Signal<Bool, NoError> {
|
||||
if let hasImage = self.hasImage {
|
||||
return hasImage.get()
|
||||
@@ -171,6 +177,10 @@ public class ImageNode: ASDisplayNode {
|
||||
hasImage.set(true)
|
||||
}
|
||||
}
|
||||
if !strongSelf.didSetReady {
|
||||
strongSelf.didSetReady = true
|
||||
strongSelf._contentReady.set(.single(true))
|
||||
}
|
||||
}
|
||||
}
|
||||
}))
|
||||
|
||||
@@ -905,6 +905,7 @@ public class TextNode: ASDisplayNode {
|
||||
var strikethroughs: [TextNodeStrikethrough] = []
|
||||
|
||||
var lineConstrainedWidth = constrainedSize.width
|
||||
var lineConstrainedWidthDelta: CGFloat = 0.0
|
||||
var lineOriginY = floorToScreenPixels(layoutSize.height + fontAscent)
|
||||
if !first {
|
||||
lineOriginY += fontLineSpacing
|
||||
@@ -915,6 +916,7 @@ public class TextNode: ASDisplayNode {
|
||||
if cutoutEnabled {
|
||||
if lineOriginY - fontLineHeight < cutoutMaxY && lineOriginY + fontLineHeight > cutoutMinY {
|
||||
lineConstrainedWidth = max(1.0, lineConstrainedWidth - cutoutWidth)
|
||||
lineConstrainedWidthDelta = -cutoutWidth
|
||||
lineCutoutOffset = cutoutOffset
|
||||
lineAdditionalWidth = cutoutWidth
|
||||
}
|
||||
@@ -945,6 +947,7 @@ public class TextNode: ASDisplayNode {
|
||||
let originalLine = CTTypesetterCreateLineWithOffset(typesetter, lineRange, 0.0)
|
||||
|
||||
var lineConstrainedSize = constrainedSize
|
||||
lineConstrainedSize.width += lineConstrainedWidthDelta
|
||||
if bottomCutoutEnabled {
|
||||
lineConstrainedSize.width -= bottomCutoutSize.width
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user