removed min/max, you only need width + calculations
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
3859c8eeb7
commit
18090871ee
@ -106,8 +106,6 @@ open class DropdownSelect: EntryFieldBase {
|
||||
//--------------------------------------------------
|
||||
// MARK: - Constraints
|
||||
//--------------------------------------------------
|
||||
internal var maxWidthConstraint: NSLayoutConstraint?
|
||||
internal var minWidthConstraint: NSLayoutConstraint?
|
||||
internal var inlineWidthConstraint: NSLayoutConstraint?
|
||||
internal var titleLabelWidthConstraint: NSLayoutConstraint?
|
||||
|
||||
@ -123,9 +121,7 @@ open class DropdownSelect: EntryFieldBase {
|
||||
/// 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()
|
||||
minWidthConstraint = containerView.widthGreaterThanEqualTo(constant: containerSize.width)
|
||||
maxWidthConstraint = containerView.width(constant: containerSize.width)
|
||||
|
||||
|
||||
titleLabel.setContentCompressionResistancePriority(.required, for: .horizontal)
|
||||
titleLabel.setContentHuggingPriority(.required, for: .horizontal)
|
||||
titleLabelWidthConstraint = titleLabel.width(constant: 0)
|
||||
@ -196,17 +192,11 @@ open class DropdownSelect: EntryFieldBase {
|
||||
selectedOptionLabel.isEnabled = isEnabled
|
||||
|
||||
//set the width constraints
|
||||
if let width, width > minWidth {
|
||||
let maxwidth = frame.size.width
|
||||
if let width, width > minWidth && width < maxwidth {
|
||||
widthConstraint?.constant = width
|
||||
widthConstraint?.isActive = true
|
||||
minWidthConstraint?.isActive = false
|
||||
maxWidthConstraint?.isActive = false
|
||||
} else {
|
||||
minWidthConstraint?.constant = minWidth
|
||||
maxWidthConstraint?.constant = frame.width
|
||||
widthConstraint?.isActive = false
|
||||
minWidthConstraint?.isActive = true
|
||||
maxWidthConstraint?.isActive = true
|
||||
widthConstraint?.constant = maxwidth >= minWidth ? maxwidth : minWidth
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -210,10 +210,7 @@ open class EntryFieldBase: Control, Changeable, FormFieldInternalValidatable {
|
||||
addSubview(stackView)
|
||||
|
||||
//create the wrapping view
|
||||
heightConstraint = containerView.heightAnchor.constraint(greaterThanOrEqualToConstant: containerSize.height)
|
||||
heightConstraint?.priority = .defaultHigh
|
||||
heightConstraint?.isActive = true
|
||||
|
||||
heightConstraint = containerView.heightGreaterThanEqualTo(constant: containerSize.height)
|
||||
widthConstraint = containerView.width(constant: 0)
|
||||
|
||||
let leftStackView = UIStackView().with {
|
||||
|
||||
@ -32,8 +32,6 @@ open class TextArea: EntryFieldBase {
|
||||
//--------------------------------------------------
|
||||
// MARK: - Private Properties
|
||||
//--------------------------------------------------
|
||||
internal var maxWidthConstraint: NSLayoutConstraint?
|
||||
internal var minWidthConstraint: NSLayoutConstraint?
|
||||
internal var textViewHeightConstraint: NSLayoutConstraint?
|
||||
|
||||
internal var inputFieldStackView: UIStackView = {
|
||||
@ -140,8 +138,6 @@ open class TextArea: EntryFieldBase {
|
||||
open override func setup() {
|
||||
super.setup()
|
||||
fieldStackView.pinToSuperView(.uniform(VDSFormControls.spaceInset))
|
||||
minWidthConstraint = containerView.widthGreaterThanEqualTo(constant: containerSize.width)
|
||||
maxWidthConstraint = containerView.width(constant: containerSize.width)
|
||||
|
||||
textView.isScrollEnabled = true
|
||||
textView.autocorrectionType = .no
|
||||
@ -173,10 +169,6 @@ open class TextArea: EntryFieldBase {
|
||||
characterCounterLabel.textColorConfiguration = primaryColorConfiguration.eraseToAnyColorable()
|
||||
bottomContainerStackView.spacing = VDSLayout.space2X
|
||||
|
||||
widthConstraint?.isActive = false
|
||||
minWidthConstraint?.isActive = true
|
||||
maxWidthConstraint?.isActive = true
|
||||
|
||||
}
|
||||
|
||||
/// Resets to default settings.
|
||||
@ -196,8 +188,9 @@ open class TextArea: EntryFieldBase {
|
||||
textView.surface = surface
|
||||
|
||||
//set the width constraints
|
||||
minWidthConstraint?.constant = containerSize.width
|
||||
maxWidthConstraint?.constant = frame.width
|
||||
let maxwidth = frame.size.width
|
||||
let minWidth = containerSize.width
|
||||
widthConstraint?.constant = maxwidth >= minWidth ? maxwidth : minWidth
|
||||
textViewHeightConstraint?.constant = minHeight.value
|
||||
|
||||
characterCounterLabel.text = getCharacterCounterText()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user