updated tooltip to use subset enums of Icon
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
8e93c84060
commit
3e812cb4a1
@ -21,21 +21,11 @@ open class Tooltip: Control, TooltipLaunchable {
|
||||
case primary, secondary, brandHighlight
|
||||
}
|
||||
|
||||
public enum Size: String, CaseIterable {
|
||||
public enum Size: String, EnumSubset {
|
||||
case small
|
||||
case medium
|
||||
|
||||
public var dimensions: CGSize {
|
||||
switch self {
|
||||
|
||||
case .small:
|
||||
return .init(width: 13.33, height: 13.33)
|
||||
|
||||
case .medium:
|
||||
return .init(width: 16.67, height: 16.67)
|
||||
|
||||
}
|
||||
}
|
||||
public var defaultValue: Icon.Size { .small }
|
||||
}
|
||||
|
||||
//--------------------------------------------------
|
||||
@ -126,9 +116,9 @@ open class Tooltip: Control, TooltipLaunchable {
|
||||
addSubview(imageView)
|
||||
|
||||
imageView.pinToSuperView()
|
||||
heightConstraint = imageView.heightAnchor.constraint(equalToConstant: size.dimensions.height)
|
||||
heightConstraint = imageView.heightAnchor.constraint(equalToConstant: size.value.dimensions.height)
|
||||
heightConstraint?.isActive = true
|
||||
widthConstraint = imageView.widthAnchor.constraint(equalToConstant: size.dimensions.width)
|
||||
widthConstraint = imageView.widthAnchor.constraint(equalToConstant: size.value.dimensions.width)
|
||||
widthConstraint?.isActive = true
|
||||
|
||||
backgroundColor = .clear
|
||||
@ -160,7 +150,7 @@ open class Tooltip: Control, TooltipLaunchable {
|
||||
super.updateView()
|
||||
|
||||
//set the dimensions
|
||||
let dimensions = size.dimensions
|
||||
let dimensions = size.value.dimensions
|
||||
heightConstraint?.constant = dimensions.height
|
||||
widthConstraint?.constant = dimensions.width
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user