mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-08-02 00:17:02 +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)
|
context.setBlendMode(.copy)
|
||||||
|
|
||||||
|
if useModernPathCalculation {
|
||||||
var rects = rects.map { $0.insetBy(dx: -inset, dy: -inset).offsetBy(dx: -topLeft.x, dy: -topLeft.y) }
|
var rects = rects.map { $0.insetBy(dx: -inset, dy: -inset).offsetBy(dx: -topLeft.x, dy: -topLeft.y) }
|
||||||
if rects.count > 1 {
|
if rects.count > 1 {
|
||||||
let minRadius: CGFloat = 2.0
|
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.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.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)
|
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()
|
context.fillPath()
|
||||||
return
|
return
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
let path = UIBezierPath(roundedRect: rects[0], cornerRadius: outerRadius).cgPath
|
let path = UIBezierPath(roundedRect: rects[0], cornerRadius: outerRadius).cgPath
|
||||||
context.addPath(path)
|
context.addPath(path)
|
||||||
context.fillPath()
|
context.fillPath()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for i in 0 ..< rects.count {
|
for i in 0 ..< rects.count {
|
||||||
let rect = rects[i].insetBy(dx: -inset, dy: -inset)
|
let rect = rects[i].insetBy(dx: -inset, dy: -inset)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user