mirror of
https://github.com/divkit/divkit.git
synced 2026-06-06 20:07:59 +00:00
36 lines
833 B
Swift
36 lines
833 B
Swift
import CoreGraphics
|
|
|
|
import CommonCore
|
|
import LayoutKit
|
|
|
|
extension DivDrawable {
|
|
func makeBlock(
|
|
context: DivBlockModelingContext,
|
|
widthTrait: DivDrawableWidthTrait = .fixed,
|
|
corners: CGRect.Corners
|
|
) throws -> Block {
|
|
switch self {
|
|
case let .divShapeDrawable(shapeDrawable):
|
|
return try shapeDrawable.makeBlock(
|
|
context: context,
|
|
widthTrait: widthTrait,
|
|
corners: corners
|
|
)
|
|
}
|
|
}
|
|
|
|
func getWidth(context: DivBlockModelingContext) -> CGFloat {
|
|
switch self {
|
|
case let .divShapeDrawable(shapeDrawable):
|
|
return shapeDrawable.getWidth(context: context)
|
|
}
|
|
}
|
|
|
|
func getHeight(context: DivBlockModelingContext) -> CGFloat {
|
|
switch self {
|
|
case let .divShapeDrawable(shapeDrawable):
|
|
return shapeDrawable.getHeight(context: context)
|
|
}
|
|
}
|
|
}
|