Currently investigate separate treatment for label image attachments in molecular structure.
This commit is contained in:
parent
ddb4ba39d0
commit
a2d4984822
@ -243,11 +243,17 @@ public typealias ActionBlock = () -> Void
|
|||||||
let imageAttachment = Label.getTextAttachmentImage(dimension: fontSize)
|
let imageAttachment = Label.getTextAttachmentImage(dimension: fontSize)
|
||||||
|
|
||||||
let mutableString = NSMutableAttributedString()
|
let mutableString = NSMutableAttributedString()
|
||||||
if location != 0 {
|
let space = NSAttributedString(string: " ")
|
||||||
mutableString.append(NSAttributedString(string: " "))
|
let attachment = NSAttributedString(attachment: imageAttachment)
|
||||||
}
|
|
||||||
mutableString.append(NSAttributedString(attachment: imageAttachment))
|
|
||||||
|
|
||||||
|
if location == 0 {
|
||||||
|
mutableString.append(attachment)
|
||||||
|
mutableString.append(space)
|
||||||
|
} else {
|
||||||
|
mutableString.append(space)
|
||||||
|
mutableString.append(attachment)
|
||||||
|
}
|
||||||
|
|
||||||
attributedString.insert(mutableString, at: location)
|
attributedString.insert(mutableString, at: location)
|
||||||
|
|
||||||
if location < attributedString.length {
|
if location < attributedString.length {
|
||||||
@ -550,6 +556,9 @@ extension Label {
|
|||||||
guard value is NSTextAttachment else { return }
|
guard value is NSTextAttachment else { return }
|
||||||
|
|
||||||
attachmentLocations.append(range.location)
|
attachmentLocations.append(range.location)
|
||||||
|
// if range.location == 0 {
|
||||||
|
// offset = 2
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user