refactored to use new spacer extension

Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
Matt Bruce 2023-05-30 14:58:24 -05:00
parent 8b9b83791a
commit 43e9642de6

View File

@ -50,24 +50,17 @@ public class TooltipLabelAttribute: ActionLabelAttributeModel, TooltipLaunchable
frame = CGRect(x: 0, y: -1, width: size.value.dimensions.width, height: size.value.dimensions.height)
}
}
//create the frame in which to hold the icon
let spacerframe = CGRect(x: 0, y: 0, width: VDSLayout.Spacing.space1X.value, height: size.value.dimensions.height)
//create the image icon and match the color of the text
let tooltipAttribute = ImageLabelAttribute(location: location,
imageName: "info",
frame: frame,
tintColor: imageTintColor)
let spacerAttribute = ImageLabelAttribute(location: location,
imageName: "info",
frame: spacerframe,
tintColor: .clear)
let spacer = NSAttributedString.spacer(for: VDSLayout.Spacing.space1X.value)
guard let tooltip = try? tooltipAttribute.getAttachment(),
let spacer = try? spacerAttribute.getAttachment() else { return }
attributedString.append(NSAttributedString(attachment: spacer))
guard let tooltip = try? tooltipAttribute.getAttachment() else { return }
attributedString.append(spacer)
attributedString.append(NSAttributedString(attachment: tooltip))
addHandler(on: attributedString)
}