added custom padding
This commit is contained in:
parent
97a110381a
commit
785c9b28c6
@ -55,12 +55,13 @@ open class TileContainer: Control {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Enum used to describe the padding choices used for this component.
|
/// Enum used to describe the padding choices used for this component.
|
||||||
public enum Padding: String, CaseIterable {
|
public enum Padding {
|
||||||
case padding2X
|
case padding2X
|
||||||
case padding4X
|
case padding4X
|
||||||
case padding6X
|
case padding6X
|
||||||
case padding8X
|
case padding8X
|
||||||
case padding12X
|
case padding12X
|
||||||
|
case custom(CGFloat)
|
||||||
|
|
||||||
public var value: CGFloat {
|
public var value: CGFloat {
|
||||||
switch self {
|
switch self {
|
||||||
@ -74,6 +75,8 @@ open class TileContainer: Control {
|
|||||||
return VDSLayout.Spacing.space8X.value
|
return VDSLayout.Spacing.space8X.value
|
||||||
case .padding12X:
|
case .padding12X:
|
||||||
return VDSLayout.Spacing.space12X.value
|
return VDSLayout.Spacing.space12X.value
|
||||||
|
case .custom(let padding):
|
||||||
|
return padding
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -231,9 +234,9 @@ open class TileContainer: Control {
|
|||||||
backgroundImageView.isHidden = true
|
backgroundImageView.isHidden = true
|
||||||
|
|
||||||
containerTopConstraint = containerView.pinTop(anchor: layoutGuide.topAnchor, constant: padding.value)
|
containerTopConstraint = containerView.pinTop(anchor: layoutGuide.topAnchor, constant: padding.value)
|
||||||
containerBottomConstraint = containerView.pinBottom(anchor: layoutGuide.bottomAnchor, constant: padding.value)
|
containerBottomConstraint = layoutGuide.pinBottom(anchor: containerView.bottomAnchor, constant: padding.value)
|
||||||
containerLeadingConstraint = containerView.pinLeading(anchor: layoutGuide.leadingAnchor, constant: padding.value)
|
containerLeadingConstraint = containerView.pinLeading(anchor: layoutGuide.leadingAnchor, constant: padding.value)
|
||||||
containerTrailingConstraint = containerView.pinTrailing(anchor: layoutGuide.trailingAnchor, constant: padding.value)
|
containerTrailingConstraint = layoutGuide.pinTrailing(anchor: containerView.trailingAnchor, constant: padding.value)
|
||||||
|
|
||||||
highlightView.pin(layoutGuide)
|
highlightView.pin(layoutGuide)
|
||||||
highlightView.isHidden = true
|
highlightView.isHidden = true
|
||||||
@ -282,8 +285,8 @@ open class TileContainer: Control {
|
|||||||
|
|
||||||
containerTopConstraint?.constant = padding.value
|
containerTopConstraint?.constant = padding.value
|
||||||
containerLeadingConstraint?.constant = padding.value
|
containerLeadingConstraint?.constant = padding.value
|
||||||
containerBottomConstraint?.constant = -padding.value
|
containerBottomConstraint?.constant = padding.value
|
||||||
containerTrailingConstraint?.constant = -padding.value
|
containerTrailingConstraint?.constant = padding.value
|
||||||
|
|
||||||
if let width, aspectRatio == .none && height == nil{
|
if let width, aspectRatio == .none && height == nil{
|
||||||
widthConstraint?.constant = width
|
widthConstraint?.constant = width
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user