Fixes incorrect corner radius animation for AppViewController + HeaderContentViewController

This commit is contained in:
Riley Testut
2024-02-15 17:18:53 -06:00
committed by Magesh K
parent fc5355345e
commit d3d609550e
2 changed files with 25 additions and 3 deletions

View File

@@ -266,7 +266,18 @@ final class AppViewController: UIViewController
}
let difference = self.scrollView.contentOffset.y - showNavigationBarThreshold
let range = (headerFrame.height + padding) - (self.navigationController?.navigationBar.bounds.height ?? self.view.safeAreaInsets.top)
let range: Double
if self.presentingViewController == nil && self.parent?.presentingViewController == nil
{
// Not presented modally, so rely on safe area + navigation bar height.
range = (headerFrame.height + padding) - (self.navigationController?.navigationBar.bounds.height ?? self.view.safeAreaInsets.top)
}
else
{
// Presented modally, so rely on maximumContentY.
range = maximumContentY - (maximumContentY - padding - headerFrame.height) - inset
}
let fractionComplete = min(difference, range) / range
self.navigationBarAnimator?.fractionComplete = fractionComplete