Skip to content

Commit 9866cbe

Browse files
committedSep 27, 2021
Fix shape for ios 15
Fix tap area for button
1 parent 1f36593 commit 9866cbe

File tree

3 files changed

+13
-10
lines changed

3 files changed

+13
-10
lines changed
 

‎Example/ConcentricOnboardingExample/PageView.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,6 @@ struct PageView: View {
4141
.frame(width: 300, alignment: .center)
4242
.multilineTextAlignment(.center)
4343
}
44-
}.padding(60)
44+
}
4545
}
4646
}

‎Sources/ConcentricOnboarding/ConcentricOnboardingView.swift

+10-6
Original file line numberDiff line numberDiff line change
@@ -98,17 +98,21 @@ public struct ConcentricOnboardingView<Content>: View, Animatable where Content:
9898
private var shape: some View {
9999
AnimatableShape(progress: progress, radius: radius, limit: limit, direction: direction)
100100
.foregroundColor(circleColor)
101-
.frame(width: UIScreen.main.bounds.width)
102101
}
103102

104103
private var button: some View {
105-
Button(action: tapAction) {
106-
ZStack {
107-
shape
108-
nextImage
104+
ZStack {
105+
shape
106+
Button(action: tapAction) {
107+
ZStack {
108+
Circle()
109+
.foregroundColor(isAnimated ? .clear : circleColor)
110+
.frame(width: 2 * radius, height: 2 * radius)
111+
nextImage
112+
}
109113
}
114+
.disabled(isAnimated)
110115
}
111-
.disabled(isAnimated)
112116
.offset(y: 300)
113117
}
114118

‎Sources/ConcentricOnboarding/Helpers/AnimatableShape.swift

+2-3
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,8 @@ struct AnimatableShape: Shape {
4242
center = CGPoint(x: UIScreen.main.bounds.width / 2 - r + delta, y: UIScreen.main.bounds.height / 2)
4343
}
4444

45-
return Path { path in
46-
path.addArc(center: center, radius: r, startAngle: .radians(0), endAngle: .radians(.pi * 2), clockwise: true)
47-
}
45+
let rect = CGRect(x: center.x - r, y: center.y - r, width: 2 * r, height: 2 * r)
46+
return Circle().path(in: rect)
4847
}
4948

5049
// MARK: - Private

0 commit comments

Comments
 (0)
Please sign in to comment.