mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-09-12 15:26:52 +00:00
29 lines
852 B
Swift
29 lines
852 B
Swift
//: [Photo With Inset Text Overlay](PhotoWithInsetTextOverlay)
|
|
|
|
import AsyncDisplayKit
|
|
|
|
extension PhotoWithOutsetIconOverlay {
|
|
|
|
override public func layoutSpecThatFits(_ constrainedSize: ASSizeRange) -> ASLayoutSpec {
|
|
let iconWidth: CGFloat = 40
|
|
let iconHeight: CGFloat = 40
|
|
|
|
iconNode.style.preferredSize = CGSize(width: iconWidth, height: iconWidth)
|
|
photoNode.style.preferredSize = CGSize(width: 150, height: 150)
|
|
|
|
let x: CGFloat = 150
|
|
let y: CGFloat = 0
|
|
|
|
iconNode.style.layoutPosition = CGPoint(x: x, y: y)
|
|
photoNode.style.layoutPosition = CGPoint(x: iconWidth * 0.5, y: iconHeight * 0.5);
|
|
|
|
let absoluteLayoutSpec = ASAbsoluteLayoutSpec(children: [photoNode, iconNode])
|
|
return absoluteLayoutSpec;
|
|
}
|
|
|
|
}
|
|
|
|
PhotoWithOutsetIconOverlay().show()
|
|
|
|
//: [Horizontal Stack With Spacer](HorizontalStackWithSpacer)
|