Merge branch 'bugfix/widthHeightLimitations' into 'develop'

Added minor fix for max width & height

See merge request BPHV_MIPS/vds_ios_sample!54
This commit is contained in:
Bruce, Matt R 2024-02-22 17:34:54 +00:00
commit 09f4fa7545

View File

@ -183,6 +183,9 @@ class TileContainerViewController: BaseViewController<TileContainer> {
$0.textStyle = .boldBodyLarge
$0.text = "This object does NOT reflect normal \"surface\" changes, all properties are maually set"
})
formStackView.addArrangedSubview(Label().with {
$0.text = "For testing max width is limited to 85% of view's width & 65% view's height."
})
addFormRow(label: "Surface", view: surfacePickerSelectorView)
addFormRow(label: "Clickable", view: clickableSwitch)
addFormRow(label: "Width", view: widthTextField)
@ -242,15 +245,21 @@ class TileContainerViewController: BaseViewController<TileContainer> {
heightTextField
.numberPublisher
.sink { [weak self] number in
self?.component.height = number?.cgFloatValue
self?.component.layoutIfNeeded()
guard let self else { return }
if let value = number?.cgFloatValue, value >= 100 && value < self.view.frame.height * 0.65 {
self.component.height = value
self.component.layoutIfNeeded()
}
}.store(in: &subscribers)
widthTextField
.numberPublisher
.sink { [weak self] number in
self?.component.width = number?.cgFloatValue
self?.component.layoutIfNeeded()
guard let self else { return }
if let value = number?.cgFloatValue, value >= 100 && value < self.view.frame.width * 0.85 {
self.component.width = value
self.component.layoutIfNeeded()
}
}.store(in: &subscribers)
}