mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-08-01 07:57:01 +00:00
Fix corner radius
This commit is contained in:
parent
e64016553e
commit
f03c3b6cad
@ -77,6 +77,7 @@ private func generateRectsImage(color: UIColor, rects: [CGRect], inset: CGFloat,
|
||||
|
||||
context.setBlendMode(.copy)
|
||||
|
||||
if useModernPathCalculation {
|
||||
var rects = rects.map { $0.insetBy(dx: -inset, dy: -inset).offsetBy(dx: -topLeft.x, dy: -topLeft.y) }
|
||||
if rects.count > 1 {
|
||||
let minRadius: CGFloat = 2.0
|
||||
@ -121,7 +122,6 @@ private func generateRectsImage(color: UIColor, rects: [CGRect], inset: CGFloat,
|
||||
}
|
||||
}
|
||||
|
||||
if useModernPathCalculation {
|
||||
context.move(to: CGPoint(x: rects[0].midX, y: rects[0].minY))
|
||||
context.addLine(to: CGPoint(x: rects[0].maxX - outerRadius, y: rects[0].minY))
|
||||
context.addArc(tangent1End: rects[0].topRight, tangent2End: CGPoint(x: rects[0].maxX, y: rects[0].minY + outerRadius), radius: outerRadius)
|
||||
@ -181,13 +181,13 @@ private func generateRectsImage(color: UIColor, rects: [CGRect], inset: CGFloat,
|
||||
|
||||
context.fillPath()
|
||||
return
|
||||
}
|
||||
} else {
|
||||
let path = UIBezierPath(roundedRect: rects[0], cornerRadius: outerRadius).cgPath
|
||||
context.addPath(path)
|
||||
context.fillPath()
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
for i in 0 ..< rects.count {
|
||||
let rect = rects[i].insetBy(dx: -inset, dy: -inset)
|
||||
|
Loading…
x
Reference in New Issue
Block a user