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. /// 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. /// Sets the background color for the component.
open var color: BackgroundColor? { didSet { setNeedsUpdate() } } open var color: BackgroundColor? { didSet { setNeedsUpdate() } }
@ -290,7 +290,7 @@ open class TileContainerBase<PaddingType: DefaultValuing>: Control where Padding
super.reset() super.reset()
shouldUpdateView = false shouldUpdateView = false
color = .white color = .white
aspectRatio = .ratio1x1 aspectRatio = .none
imageFallbackColor = .light imageFallbackColor = .light
width = nil width = nil
height = 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. /// Called once when a view is initialized and is used to Setup additional UI or other constants and configurations.
open override func setup() { open override func setup() {
super.setup() super.setup()
aspectRatio = .none
color = .black color = .black
addContentView(stackView) addContentView(stackView)
@ -386,7 +385,6 @@ open class Tilelet: TileContainerBase<Tilelet.Padding> {
/// Resets to default settings. /// Resets to default settings.
open override func reset() { open override func reset() {
shouldUpdateView = false shouldUpdateView = false
aspectRatio = .none
color = .black color = .black
//models //models
badgeModel = nil badgeModel = nil
@ -405,11 +403,7 @@ open class Tilelet: TileContainerBase<Tilelet.Padding> {
updateBadge() updateBadge()
updateTitleLockup() updateTitleLockup()
updateIcons() updateIcons()
///Content-driven height Tilelets - Minimum height is configurable. updateTextPositionAlignment()
///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()
}
setNeedsLayout() setNeedsLayout()
} }
@ -584,6 +578,7 @@ open class Tilelet: TileContainerBase<Tilelet.Padding> {
} }
private func updateTextPositionAlignment() { private func updateTextPositionAlignment() {
guard width != nil && (aspectRatio != .none || height != nil) else { return }
switch textPostion { switch textPostion {
case .top: case .top:
titleLockupTopConstraint?.activate() titleLockupTopConstraint?.activate()