From 1d3431da2c8ca122878318c5a8cd5413dd734087 Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Fri, 14 Apr 2023 16:28:05 -0500 Subject: [PATCH] updated frame Signed-off-by: Matt Bruce --- .../Label/Attributes/ImageLabelAttribute.swift | 4 +++- .../Label/Attributes/ToolTipLabelAttribute.swift | 10 +++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/VDS/Components/Label/Attributes/ImageLabelAttribute.swift b/VDS/Components/Label/Attributes/ImageLabelAttribute.swift index f46e2e8c..dcd98629 100644 --- a/VDS/Components/Label/Attributes/ImageLabelAttribute.swift +++ b/VDS/Components/Label/Attributes/ImageLabelAttribute.swift @@ -46,7 +46,9 @@ public struct ImageLabelAttribute: AttachmentLabelAttributeModel { private func imageAttachment(image: UIImage) -> NSTextAttachment { let attachment = NSTextAttachment() 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 } diff --git a/VDS/Components/Label/Attributes/ToolTipLabelAttribute.swift b/VDS/Components/Label/Attributes/ToolTipLabelAttribute.swift index 4a31f070..9b3f19e7 100644 --- a/VDS/Components/Label/Attributes/ToolTipLabelAttribute.swift +++ b/VDS/Components/Label/Attributes/ToolTipLabelAttribute.swift @@ -20,9 +20,13 @@ public struct ToolTipLabelAttribute: ActionLabelAttributeModel { public var size: Tooltip.Size public func setAttribute(on attributedString: NSMutableAttributedString) { - let size = size.dimensions.height - var yPos = (lineHeight / 2) - size - if yPos < 0 { yPos = 0 } + var size = size.dimensions.height + var yPos = (lineHeight - size) / 2 + print("tooltip yPos: \(yPos)") + if yPos < 0 { + yPos = 0 + size = lineHeight + } let image = ImageLabelAttribute(location: location, length: length, imageName: "info",