updated frame

Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
Matt Bruce 2023-04-14 16:28:05 -05:00
parent 24bad2c371
commit 1d3431da2c
2 changed files with 10 additions and 4 deletions

View File

@ -46,7 +46,9 @@ public struct ImageLabelAttribute: AttachmentLabelAttributeModel {
private func imageAttachment(image: UIImage) -> NSTextAttachment { private func imageAttachment(image: UIImage) -> NSTextAttachment {
let attachment = NSTextAttachment() let attachment = NSTextAttachment()
attachment.image = tintColor != nil ? image.withTintColor(tintColor!) : image attachment.image = tintColor != nil ? image.withTintColor(tintColor!) : image
attachment.bounds = frame ?? .init(x: 0, y: 0, width: image.size.width, height: image.size.height) if let frame {
attachment.bounds = frame
}
return attachment return attachment
} }

View File

@ -20,9 +20,13 @@ public struct ToolTipLabelAttribute: ActionLabelAttributeModel {
public var size: Tooltip.Size public var size: Tooltip.Size
public func setAttribute(on attributedString: NSMutableAttributedString) { public func setAttribute(on attributedString: NSMutableAttributedString) {
let size = size.dimensions.height var size = size.dimensions.height
var yPos = (lineHeight / 2) - size var yPos = (lineHeight - size) / 2
if yPos < 0 { yPos = 0 } print("tooltip yPos: \(yPos)")
if yPos < 0 {
yPos = 0
size = lineHeight
}
let image = ImageLabelAttribute(location: location, let image = ImageLabelAttribute(location: location,
length: length, length: length,
imageName: "info", imageName: "info",