refactored to remove height now the a hit area exists
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
1e44d9738d
commit
81f7341148
@ -17,7 +17,6 @@ open class TextLink: ButtonBase {
|
||||
//--------------------------------------------------
|
||||
// MARK: - Private Properties
|
||||
//--------------------------------------------------
|
||||
private var heightConstraint: NSLayoutConstraint?
|
||||
private var lineHeightConstraint: NSLayoutConstraint?
|
||||
|
||||
//--------------------------------------------------
|
||||
@ -83,9 +82,6 @@ open class TextLink: ButtonBase {
|
||||
lineHeightConstraint = line.heightAnchor.constraint(equalToConstant: 1.0)
|
||||
lineHeightConstraint?.isActive = true
|
||||
}
|
||||
|
||||
heightConstraint = heightAnchor.constraint(equalToConstant: height)
|
||||
heightConstraint?.isActive = true
|
||||
}
|
||||
|
||||
open override func reset() {
|
||||
@ -99,18 +95,15 @@ open class TextLink: ButtonBase {
|
||||
// MARK: - Overrides
|
||||
//--------------------------------------------------
|
||||
open override var intrinsicContentSize: CGSize {
|
||||
let size = titleLabel?.intrinsicContentSize ?? super.intrinsicContentSize
|
||||
return CGSize(width: size.width, height: height)
|
||||
return titleLabel?.intrinsicContentSize ?? super.intrinsicContentSize
|
||||
}
|
||||
|
||||
open override func updateView() {
|
||||
//need to set the properties so the super class
|
||||
//can render out the label correctly
|
||||
heightConstraint?.constant = height
|
||||
line.backgroundColor = textColor
|
||||
|
||||
//always call last so the label is rendered
|
||||
super.updateView()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -21,12 +21,10 @@ open class TextLinkCaret: ButtonBase {
|
||||
//--------------------------------------------------
|
||||
// MARK: - Private Properties
|
||||
//--------------------------------------------------
|
||||
private var heightConstraint: NSLayoutConstraint?
|
||||
|
||||
open override var typograpicalStyle: TypographicalStyle {
|
||||
TypographicalStyle.BoldBodyLarge
|
||||
}
|
||||
|
||||
|
||||
private var caretView = CaretView().with {
|
||||
$0.size = CaretView.CaretSize.small(.vertical)
|
||||
$0.lineWidth = 2
|
||||
@ -64,7 +62,7 @@ open class TextLinkCaret: ButtonBase {
|
||||
open override var textColor: UIColor {
|
||||
textColorConfiguration.getColor(self)
|
||||
}
|
||||
|
||||
|
||||
private var textColorConfiguration = ControlColorConfiguration().with {
|
||||
$0.setSurfaceColors(VDSColor.elementsPrimaryOnlight, VDSColor.elementsPrimaryOndark, forState: .normal)
|
||||
$0.setSurfaceColors(VDSColor.elementsSecondaryOnlight, VDSColor.elementsSecondaryOndark, forState: .disabled)
|
||||
@ -91,9 +89,7 @@ open class TextLinkCaret: ButtonBase {
|
||||
//--------------------------------------------------
|
||||
open override func setup() {
|
||||
super.setup()
|
||||
//constraints
|
||||
heightAnchor.constraint(greaterThanOrEqualToConstant: height).isActive = true
|
||||
|
||||
|
||||
let size = caretView.size!.dimensions()
|
||||
caretView.frame = .init(x: 0, y: 0, width: size.width, height: size.height)
|
||||
}
|
||||
@ -115,9 +111,9 @@ open class TextLinkCaret: ButtonBase {
|
||||
if let caretWidth = caretView.size?.dimensions().width {
|
||||
itemWidth += caretWidth
|
||||
}
|
||||
return CGSize(width: itemWidth, height: height)
|
||||
return CGSize(width: itemWidth, height: size.height)
|
||||
}
|
||||
|
||||
|
||||
open override func updateView() {
|
||||
|
||||
let updatedText = text ?? ""
|
||||
@ -129,9 +125,9 @@ open class TextLinkCaret: ButtonBase {
|
||||
let location = iconPosition == .right ? updatedText.count : 0
|
||||
|
||||
imageAttribute = ImageLabelAttribute(location: location,
|
||||
image: image,
|
||||
tintColor: textColor)
|
||||
|
||||
image: image,
|
||||
tintColor: textColor)
|
||||
|
||||
super.updateView()
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user