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
|
case primary, secondary, brandHighlight
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum Size: String, CaseIterable {
|
public enum Size: String, EnumSubset {
|
||||||
case small
|
case small
|
||||||
case medium
|
case medium
|
||||||
|
|
||||||
public var dimensions: CGSize {
|
public var defaultValue: Icon.Size { .small }
|
||||||
switch self {
|
|
||||||
|
|
||||||
case .small:
|
|
||||||
return .init(width: 13.33, height: 13.33)
|
|
||||||
|
|
||||||
case .medium:
|
|
||||||
return .init(width: 16.67, height: 16.67)
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -126,9 +116,9 @@ open class Tooltip: Control, TooltipLaunchable {
|
|||||||
addSubview(imageView)
|
addSubview(imageView)
|
||||||
|
|
||||||
imageView.pinToSuperView()
|
imageView.pinToSuperView()
|
||||||
heightConstraint = imageView.heightAnchor.constraint(equalToConstant: size.dimensions.height)
|
heightConstraint = imageView.heightAnchor.constraint(equalToConstant: size.value.dimensions.height)
|
||||||
heightConstraint?.isActive = true
|
heightConstraint?.isActive = true
|
||||||
widthConstraint = imageView.widthAnchor.constraint(equalToConstant: size.dimensions.width)
|
widthConstraint = imageView.widthAnchor.constraint(equalToConstant: size.value.dimensions.width)
|
||||||
widthConstraint?.isActive = true
|
widthConstraint?.isActive = true
|
||||||
|
|
||||||
backgroundColor = .clear
|
backgroundColor = .clear
|
||||||
@ -160,7 +150,7 @@ open class Tooltip: Control, TooltipLaunchable {
|
|||||||
super.updateView()
|
super.updateView()
|
||||||
|
|
||||||
//set the dimensions
|
//set the dimensions
|
||||||
let dimensions = size.dimensions
|
let dimensions = size.value.dimensions
|
||||||
heightConstraint?.constant = dimensions.height
|
heightConstraint?.constant = dimensions.height
|
||||||
widthConstraint?.constant = dimensions.width
|
widthConstraint?.constant = dimensions.width
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user