From c150f0d4b2626802bae67cfa599fce88f73e5307 Mon Sep 17 00:00:00 2001 From: Felix Mau Date: Thu, 23 Sep 2021 20:55:38 +0200 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20::=20Adapt=20height=20of?= =?UTF-8?q?=20notch=20bar=20to=20basic=20bar?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Classes/NotchGradientLoadingBarController.swift | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/GradientLoadingBar/Classes/NotchGradientLoadingBarController.swift b/GradientLoadingBar/Classes/NotchGradientLoadingBarController.swift index 889616e..45954fd 100644 --- a/GradientLoadingBar/Classes/NotchGradientLoadingBarController.swift +++ b/GradientLoadingBar/Classes/NotchGradientLoadingBarController.swift @@ -20,7 +20,7 @@ open class NotchGradientLoadingBarController: GradientLoadingBarController { /// Values for the iPhone 13 are based on testing in the simulator. private enum Config { /// The width of the iPhone notch. - static let notchWidth: CGFloat = UIDevice.isAnyIPhone13 ? 162 : 209 + static let notchWidth: CGFloat = UIDevice.isAnyIPhone13 ? 162 : 210 /// The radius of the small circle on the outside of the notch. static let smallCircleRadius: CGFloat = 6 @@ -100,7 +100,7 @@ open class NotchGradientLoadingBarController: GradientLoadingBarController { // // But for the iPhone 13 we reduce this value: ‟iPhone 13 notch is 20% smaller in width, but it is also a little taller in height‟. // See . - let verticalOffsetForLargeCircle: CGFloat = UIDevice.isAnyIPhone13 ? 1 : 3 + let verticalOffsetForLargeCircle: CGFloat = UIDevice.isAnyIPhone13 ? 1 : 2 // Draw the large circle right to the `leftNotchPoint`. bezierPath.addArc(withCenter: CGPoint(x: leftNotchPoint + Config.largeCircleRadius, @@ -134,9 +134,6 @@ open class NotchGradientLoadingBarController: GradientLoadingBarController { bezierPath.addLineTo(x: screenWidth, y: 0) // And all the way back.. - // Therefore we always have to offset the given `height` by the user. - // To visually align the height with the "basic" `GradientLoadingBar`, we have to add one point here. - let height = self.height + 1 // Have the small-circle at the bottom-path only one third of the size of the upper-path produced visually better results. let bottomPathSmallCircleRadius = Config.smallCircleRadius / 3