Skip to content
This repository was archived by the owner on Jan 19, 2022. It is now read-only.

Commit 321e62d

Browse files
Aleksei Minaevluispadron
authored andcommitted
Add borderWidth to outer radius when having 'bordered' style (#202)
Prevent outer circle border to be drawn with additional empty space border. This fix allows to draw border right within bounds without additional space in between of bounds and circle border.
1 parent d371ac4 commit 321e62d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/UICircularProgressRing/UICircularRingLayer.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ class UICircularRingLayer: CAShapeLayer {
178178
let start: CGFloat = ring.fullCircle ? 0 : ring.startAngle.rads
179179
let end: CGFloat = ring.fullCircle ? .pi * 2 : ring.endAngle.rads
180180
let outerPath = UIBezierPath(arcCenter: center,
181-
radius: outerRadius,
181+
radius: outerRadius + borderWidth,
182182
startAngle: start,
183183
endAngle: end,
184184
clockwise: true)
@@ -275,7 +275,7 @@ class UICircularRingLayer: CAShapeLayer {
275275
let start: CGFloat = ring.fullCircle ? 0 : borderStartAngle.rads
276276
let end: CGFloat = ring.fullCircle ? .pi * 2 : borderEndAngle.rads
277277
let borderPath = UIBezierPath(arcCenter: center,
278-
radius: outerRadius,
278+
radius: outerRadius + borderWidth,
279279
startAngle: start,
280280
endAngle: end,
281281
clockwise: true)
@@ -330,7 +330,7 @@ class UICircularRingLayer: CAShapeLayer {
330330
radiusIn = (min(bounds.width - difference, bounds.height - difference) / 2) - offSet
331331
case .bordered(let borderWidth, _):
332332
let offSet = (max(ring.outerRingWidth, ring.innerRingWidth) / 2) + (knobSize / 4) + (borderWidth * 2)
333-
radiusIn = (min(bounds.width, bounds.height) / 2) - offSet
333+
radiusIn = (min(bounds.width, bounds.height) / 2) - offSet + borderWidth
334334
default:
335335
let offSet = (max(ring.outerRingWidth, ring.innerRingWidth) / 2) + (knobSize / 4)
336336
radiusIn = (min(bounds.width, bounds.height) / 2) - offSet

0 commit comments

Comments
 (0)