added height

Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
Matt Bruce 2022-12-20 12:21:40 -06:00
parent ce6c492f60
commit e3420da41b

View File

@ -37,6 +37,7 @@ class TileContainerViewController: BaseViewController {
var showBackgroundImageSwitch = Toggle()
var showBorderSwitch = Toggle()
var showDropShadowSwitch = Toggle()
var heightTextField = TextField()
var widthTextField = TextField()
var tileContainer = TileContainer()
@ -51,11 +52,16 @@ class TileContainerViewController: BaseViewController {
setupModel()
}
override func allTextFields() -> [UITextField]? { [widthTextField] }
override func allTextFields() -> [UITextField]? { [widthTextField, heightTextField] }
func setupForm(){
formStackView.addArrangedSubview(Label().with{
$0.typograpicalStyle = .BoldBodyLarge
$0.text = "This object does NOT reflect normal \"surface\" changes, all properties are maually set"
})
addFormRow(label: "Surface", view: surfacePickerSelectorView)
addFormRow(label: "Width", view: widthTextField)
addFormRow(label: "Height", view: heightTextField)
addFormRow(label: "Show Border", view: showBorderSwitch)
//addFormRow(label: "Show Drop Shadow", view: showDropShadowSwitch)
addFormRow(label: "Background Color", view: backgroundColorPickerSelectorView)
@ -86,6 +92,16 @@ class TileContainerViewController: BaseViewController {
self?.tileContainer.showDropShadows = sender.isOn
}.store(in: &subscribers)
heightTextField
.textPublisher
.sink { [weak self] text in
if let n = NumberFormatter().number(from: text) {
self?.tileContainer.height = CGFloat(truncating: n)
} else {
self?.tileContainer.height = nil
}
}.store(in: &subscribers)
widthTextField
.textPublisher
.sink { [weak self] text in
@ -102,6 +118,7 @@ class TileContainerViewController: BaseViewController {
paddingPickerSelectorView.text = tileContainer.containerPadding.rawValue
scalingTypePickerSelectorView.text = tileContainer.aspectRatio.rawValue
widthTextField.text = "\(tileContainer.width)"
heightTextField.text = tileContainer.height != nil ? "\(tileContainer.height!)" : ""
}
func setupPicker(){