Skip to content

Commit 169973d

Browse files
committed
fix stripes angle drawing
1 parent a808258 commit 169973d

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

Sources/ComponentsKit/Components/CircularProgress/Models/CircularProgressVM.swift

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -90,15 +90,12 @@ extension CircularProgressVM {
9090
let step = stripeWidth + stripeSpacing
9191
let radians = stripeAngle.radians
9292

93-
let startY = -rect.width
94-
let endY = rect.height + rect.width
95-
96-
for y in stride(from: startY, through: endY, by: step) {
97-
let topLeft = CGPoint(x: 0, y: y)
98-
let topRight = CGPoint(x: 0, y: y + stripeWidth)
99-
100-
let bottomLeft = CGPoint(x: rect.width, y: y + tan(radians) * rect.width)
101-
let bottomRight = CGPoint(x: rect.width, y: (y + stripeWidth) + tan(radians) * rect.width)
93+
let dx: CGFloat = rect.height * tan(radians)
94+
for x in stride(from: 0, through: rect.width + rect.height, by: step) {
95+
let topLeft = CGPoint(x: x, y: 0)
96+
let topRight = CGPoint(x: x + stripeWidth, y: 0)
97+
let bottomLeft = CGPoint(x: x + dx, y: rect.height)
98+
let bottomRight = CGPoint(x: x + stripeWidth + dx, y: rect.height)
10299

103100
path.move(to: topLeft)
104101
path.addLine(to: topRight)

0 commit comments

Comments
 (0)