Currently investigate separate treatment for label image attachments in molecular structure.

This commit is contained in:
Kevin G Christiano 2019-07-27 18:11:57 -04:00
parent ddb4ba39d0
commit a2d4984822

View File

@ -243,11 +243,17 @@ public typealias ActionBlock = () -> Void
let imageAttachment = Label.getTextAttachmentImage(dimension: fontSize)
let mutableString = NSMutableAttributedString()
if location != 0 {
mutableString.append(NSAttributedString(string: " "))
}
mutableString.append(NSAttributedString(attachment: imageAttachment))
let space = NSAttributedString(string: " ")
let attachment = NSAttributedString(attachment: imageAttachment)
if location == 0 {
mutableString.append(attachment)
mutableString.append(space)
} else {
mutableString.append(space)
mutableString.append(attachment)
}
attributedString.insert(mutableString, at: location)
if location < attributedString.length {
@ -550,6 +556,9 @@ extension Label {
guard value is NSTextAttachment else { return }
attachmentLocations.append(range.location)
// if range.location == 0 {
// offset = 2
// }
}
}