refactored tooltip to use icon

Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
Matt Bruce 2023-08-17 14:16:50 -05:00
parent d5489dc9af
commit e186b77763
2 changed files with 11 additions and 25 deletions

View File

@ -200,7 +200,7 @@ open class Tabs: View {
/// Function used to make changes to the View based off a change events or from local properties.
open override func updateView() {
super.updateView()
updateStackView()
updateTabs()
updateContentView()

View File

@ -38,10 +38,10 @@ open class Tooltip: Control, TooltipLaunchable {
//--------------------------------------------------
// MARK: - Public Properties
//--------------------------------------------------
open var imageView = UIImageView().with {
$0.translatesAutoresizingMaskIntoConstraints = false
$0.contentMode = .scaleAspectFill
$0.clipsToBounds = true
open var icon = Icon().with {
$0.name = .info
$0.size = .small
$0.isUserInteractionEnabled = false
}
open var closeButtonText: String = "Close" { didSet { setNeedsUpdate() }}
@ -111,18 +111,8 @@ open class Tooltip: Control, TooltipLaunchable {
open override func setup() {
super.setup()
if let image = BundleManager.shared.image(for: "info") {
infoImage = image
}
addSubview(imageView)
imageView.pinToSuperView()
heightConstraint = imageView.heightAnchor.constraint(equalToConstant: size.value.dimensions.height)
heightConstraint?.isActive = true
widthConstraint = imageView.widthAnchor.constraint(equalToConstant: size.value.dimensions.width)
widthConstraint?.isActive = true
addSubview(icon)
icon.pinToSuperView()
backgroundColor = .clear
isAccessibilityElement = true
@ -149,7 +139,6 @@ open class Tooltip: Control, TooltipLaunchable {
content = ""
fillColor = .primary
closeButtonText = "Close"
imageView.image = nil
shouldUpdateView = true
setNeedsUpdate()
}
@ -157,15 +146,12 @@ open class Tooltip: Control, TooltipLaunchable {
/// Function used to make changes to the View based off a change events or from local properties.
open override func updateView() {
super.updateView()
//set the dimensions
let dimensions = size.value.dimensions
heightConstraint?.constant = dimensions.height
widthConstraint?.constant = dimensions.width
//get the size
icon.size = size.value
//get the color for the image
let imageColor = iconColorConfiguration.getColor(self)
imageView.image = infoImage.withTintColor(imageColor)
icon.color = iconColorConfiguration.getColor(self)
}
open override func updateAccessibility() {