Various fixes

This commit is contained in:
Ilya Laktyushin
2022-08-29 05:25:29 +02:00
parent b4e057f444
commit e15dca9bcc
13 changed files with 438 additions and 183 deletions

View File

@@ -2136,21 +2136,21 @@ open class TextView: UIView {
}
}
if !line.strikethroughs.isEmpty {
for strikethrough in line.strikethroughs {
var textColor: UIColor?
layout.attributedString?.enumerateAttributes(in: NSMakeRange(line.range.location, line.range.length), options: []) { attributes, range, _ in
if range == strikethrough.range, let color = attributes[NSAttributedString.Key.foregroundColor] as? UIColor {
textColor = color
}
}
if let textColor = textColor {
context.setFillColor(textColor.cgColor)
}
let frame = strikethrough.frame.offsetBy(dx: lineFrame.minX, dy: lineFrame.minY)
context.fill(CGRect(x: frame.minX, y: frame.minY - 5.0, width: frame.width, height: 1.0))
}
}
// if !line.strikethroughs.isEmpty {
// for strikethrough in line.strikethroughs {
// var textColor: UIColor?
// layout.attributedString?.enumerateAttributes(in: NSMakeRange(line.range.location, line.range.length), options: []) { attributes, range, _ in
// if range == strikethrough.range, let color = attributes[NSAttributedString.Key.foregroundColor] as? UIColor {
// textColor = color
// }
// }
// if let textColor = textColor {
// context.setFillColor(textColor.cgColor)
// }
// let frame = strikethrough.frame.offsetBy(dx: lineFrame.minX, dy: lineFrame.minY)
// context.fill(CGRect(x: frame.minX, y: frame.minY - 5.0, width: frame.width, height: 1.0))
// }
// }
if !line.spoilers.isEmpty {
if layout.displaySpoilers {