fixed width issue
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
5e932000da
commit
d5cca1626e
@ -447,33 +447,6 @@ open class TileContainerBase<PaddingType: DefaultValuing & Valuing>: View where
|
||||
//-------------------------------------------------------------------------
|
||||
//Overriding Nil Width Rules
|
||||
//-------------------------------------------------------------------------
|
||||
//Rule 1:
|
||||
//In the scenario where we only have a height but the multiplie is nil, we
|
||||
//want to set the width with the parent's width which will more or less "fill"
|
||||
//the container horizontally
|
||||
//- height is set
|
||||
//- width is not set
|
||||
//- aspectRatio is not set
|
||||
if let superviewWidth, superviewWidth > 0,
|
||||
containerViewHeight != nil,
|
||||
containerViewWidth == nil,
|
||||
multiplier == nil {
|
||||
containerViewWidth = superviewWidth
|
||||
}
|
||||
|
||||
//Rule 2:
|
||||
//In the scenario where no width and height is set, want to set the width with the
|
||||
//parent's width which will more or less "fill" the container horizontally
|
||||
//- height is not set
|
||||
//- width is not set
|
||||
else if let superviewWidth, superviewWidth > 0,
|
||||
containerViewWidth == nil,
|
||||
containerViewHeight == nil {
|
||||
containerViewWidth = superviewWidth
|
||||
}
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//Width + AspectRatio Constraint
|
||||
//-------------------------------------------------------------------------
|
||||
@ -499,6 +472,14 @@ open class TileContainerBase<PaddingType: DefaultValuing & Valuing>: View where
|
||||
aspectRatioConstraint = widthAnchor.constraint(equalTo: heightAnchor, multiplier: multiplier)
|
||||
aspectRatioConstraint?.activate()
|
||||
|
||||
}
|
||||
//-------------------------------------------------------------------------
|
||||
//Multiplier, meaning it was pinned with width only Constraint
|
||||
//-------------------------------------------------------------------------
|
||||
else if let multiplier {
|
||||
aspectRatioConstraint = heightAnchor.constraint(equalTo: widthAnchor, multiplier: multiplier)
|
||||
aspectRatioConstraint?.activate()
|
||||
|
||||
} else {
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
@ -520,12 +501,6 @@ open class TileContainerBase<PaddingType: DefaultValuing & Valuing>: View where
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// This is the size of the superview's allowed space for this container first by constrained size which would include padding/inset values an
|
||||
private var superviewWidth: CGFloat? {
|
||||
horizontalPinnedWidth() ?? superview?.frame.size.width
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
extension TileContainerBase {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user