Files
divkit/client/ios/DivKit/Extensions/DivDrawable/DivDrawableExtensions.swift
T
2022-09-07 19:33:26 +03:00

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)
}
}
}