mirror of
https://github.com/divkit/divkit.git
synced 2026-06-06 20:07:59 +00:00
73 lines
1.5 KiB
Swift
73 lines
1.5 KiB
Swift
import Foundation
|
|
|
|
import BaseUI
|
|
import CommonCore
|
|
import LayoutKit
|
|
|
|
final class BlockWithFixedWrapContent: BlockWithTraits {
|
|
var width: CGFloat
|
|
var height: CGFloat
|
|
|
|
init(
|
|
width: CGFloat = 0,
|
|
height: CGFloat = 0,
|
|
constrainedHorizontally: Bool = false,
|
|
constrainedVertically: Bool = false
|
|
) {
|
|
self.width = width
|
|
self.height = height
|
|
self.widthTrait = .intrinsic(
|
|
constrained: constrainedHorizontally,
|
|
minSize: 0,
|
|
maxSize: .infinity
|
|
)
|
|
self.heightTrait = .intrinsic(
|
|
constrained: constrainedVertically,
|
|
minSize: 0,
|
|
maxSize: .infinity
|
|
)
|
|
}
|
|
|
|
var widthTrait: LayoutTrait
|
|
|
|
var heightTrait: LayoutTrait
|
|
|
|
var intrinsicContentWidth: CGFloat {
|
|
width
|
|
}
|
|
|
|
func intrinsicContentHeight(forWidth _: CGFloat) -> CGFloat {
|
|
height
|
|
}
|
|
}
|
|
|
|
extension BlockWithFixedWrapContent {
|
|
func equals(_: LayoutKit.Block) -> Bool {
|
|
false
|
|
}
|
|
|
|
func configureBlockView(
|
|
_: LayoutKit.BlockView,
|
|
observer _: LayoutKit.ElementStateObserver?,
|
|
overscrollDelegate _: Base.ScrollDelegate?,
|
|
renderingDelegate _: LayoutKit.RenderingDelegate?
|
|
) {}
|
|
|
|
var debugDescription: String { "" }
|
|
|
|
static func makeBlockView() -> BlockView {
|
|
TextBlock.makeBlockView()
|
|
}
|
|
|
|
func canConfigureBlockView(_: BlockView) -> Bool {
|
|
false
|
|
}
|
|
|
|
func getImageHolders() -> [Base.ImageHolder] {
|
|
[]
|
|
}
|
|
}
|
|
|
|
extension BlockWithFixedWrapContent: LayoutCachingDefaultImpl {}
|
|
extension BlockWithFixedWrapContent: ElementStateUpdatingDefaultImpl {}
|