reset to start with none

Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
Matt Bruce 2024-06-26 13:29:45 -05:00
parent a432534e1a
commit db3ba4f1a1
2 changed files with 4 additions and 9 deletions

View File

@ -126,7 +126,7 @@ open class TileContainerBase<PaddingType: DefaultValuing>: Control where Padding
}
/// This controls the aspect ratio for the component.
open var aspectRatio: AspectRatio = .ratio1x1 { didSet { setNeedsUpdate() } }
open var aspectRatio: AspectRatio = .none { didSet { setNeedsUpdate() } }
/// Sets the background color for the component.
open var color: BackgroundColor? { didSet { setNeedsUpdate() } }
@ -290,7 +290,7 @@ open class TileContainerBase<PaddingType: DefaultValuing>: Control where Padding
super.reset()
shouldUpdateView = false
color = .white
aspectRatio = .ratio1x1
aspectRatio = .none
imageFallbackColor = .light
width = nil
height = nil

View File

@ -302,7 +302,6 @@ open class Tilelet: TileContainerBase<Tilelet.Padding> {
/// Called once when a view is initialized and is used to Setup additional UI or other constants and configurations.
open override func setup() {
super.setup()
aspectRatio = .none
color = .black
addContentView(stackView)
@ -386,7 +385,6 @@ open class Tilelet: TileContainerBase<Tilelet.Padding> {
/// Resets to default settings.
open override func reset() {
shouldUpdateView = false
aspectRatio = .none
color = .black
//models
badgeModel = nil
@ -405,11 +403,7 @@ open class Tilelet: TileContainerBase<Tilelet.Padding> {
updateBadge()
updateTitleLockup()
updateIcons()
///Content-driven height Tilelets - Minimum height is configurable.
///if width != nil && (aspectRatio != .none || height != nil) then tilelet is not self growing, so we can apply text position alignments.
if width != nil && (aspectRatio != .none || height != nil) {
updateTextPositionAlignment()
}
updateTextPositionAlignment()
setNeedsLayout()
}
@ -584,6 +578,7 @@ open class Tilelet: TileContainerBase<Tilelet.Padding> {
}
private func updateTextPositionAlignment() {
guard width != nil && (aspectRatio != .none || height != nil) else { return }
switch textPostion {
case .top:
titleLockupTopConstraint?.activate()