Added minor fix for max width & height

This commit is contained in:
Krishna Kishore Bandaru 2024-02-22 22:46:44 +05:30
parent 719ae8b9fc
commit cc52dcb0c6

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)
}