Skip to content

Commit 3cec343

Browse files
committed
added innerCornerRadius
1 parent 9b65fae commit 3cec343

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

Sources/ComponentsKit/ProgressBar/Models/ProgressBarVM.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,11 @@ extension ProgressBarVM {
8080
}
8181
}
8282

83+
var innerCornerRadius: CGFloat {
84+
let distance: CGFloat = 3
85+
return max(0, self.computedCornerRadius - distance)
86+
}
87+
8388
var backgroundColor: UniversalColor {
8489
switch style {
8590
case .light:
@@ -106,7 +111,7 @@ extension ProgressBarVM {
106111
let stripeWidth: CGFloat = 2
107112
let stripeSpacing: CGFloat = 4
108113
let stripeAngle: Angle = .degrees(135)
109-
114+
110115
let path = CGMutablePath()
111116
let step = stripeWidth + stripeSpacing
112117
let radians = stripeAngle.radians

Sources/ComponentsKit/ProgressBar/SUProgressBar.swift

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,9 @@ public struct SUProgressBar: View {
4444
RoundedRectangle(cornerRadius: self.model.computedCornerRadius)
4545
.foregroundStyle(self.model.barColor.color)
4646
.frame(width: geometry.size.width * self.progress, height: self.model.barHeight)
47-
Rectangle()
47+
RoundedRectangle(cornerRadius: self.model.computedCornerRadius)
4848
.foregroundStyle(self.model.backgroundColor.color)
4949
.frame(width: geometry.size.width * (1 - self.progress), height: self.model.barHeight)
50-
.cornerRadius(self.model.computedCornerRadius)
5150
}
5251
.animation(.spring, value: self.progress)
5352

@@ -57,7 +56,7 @@ public struct SUProgressBar: View {
5756
.foregroundStyle(self.model.color.main.color)
5857
.frame(width: geometry.size.width, height: self.model.barHeight)
5958

60-
RoundedRectangle(cornerRadius: self.model.computedCornerRadius)
59+
RoundedRectangle(cornerRadius: self.model.innerCornerRadius)
6160
.foregroundStyle((self.model.color.contrast ?? .foreground).color)
6261
.frame(width: (geometry.size.width - 6) * self.progress, height: self.model.barHeight - 6)
6362
.padding(.vertical, self.model.contentPaddings.top)
@@ -71,7 +70,7 @@ public struct SUProgressBar: View {
7170
.foregroundStyle(self.model.color.main.color)
7271
.frame(width: geometry.size.width, height: self.model.barHeight)
7372

74-
RoundedRectangle(cornerRadius: self.model.computedCornerRadius)
73+
RoundedRectangle(cornerRadius: self.model.innerCornerRadius)
7574
.foregroundStyle(self.model.color.contrast.color)
7675
.frame(width: (geometry.size.width - 6) * self.progress, height: self.model.barHeight - 6)
7776
.padding(.vertical, self.model.contentPaddings.top)

0 commit comments

Comments
 (0)