From b9d0f67a50a57acbf5d70bee25273f558707af14 Mon Sep 17 00:00:00 2001 From: Adrian Schoenig Date: Sat, 11 Sep 2021 18:16:41 +1000 Subject: [PATCH] Fixes when pairing with nav bar 1. Don't account twice for the top overlap, keeping extended close to the nav bar. 2. Fix landscape where card content was always faded out --- .../TGCardViewController.swift | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/Sources/TGCardViewController/TGCardViewController.swift b/Sources/TGCardViewController/TGCardViewController.swift index 4441e8a..9ea0044 100644 --- a/Sources/TGCardViewController/TGCardViewController.swift +++ b/Sources/TGCardViewController/TGCardViewController.swift @@ -607,12 +607,12 @@ open class TGCardViewController: UIViewController { // Add it a bit of extra space around the switch-over to still detect // same position after hiding/showing bars - let peakMargin = peakY - 44 - let collapsedMargin = collapsedMinY - 44 + let peakMargin = max(extendedMinY, peakY - 44) + let collapsedMargin = max(peakY, collapsedMinY - 44) switch (cardY, traitCollection.verticalSizeClass) { - case (0.. 0 { - value += Constants.minMapSpaceWithHomeIndicator - } else if mode == .floating { - value += Constants.minMapSpace + if mode == .floating { + let bottomMinSpace = view.safeAreaInsets.bottom > 0 ? Constants.minMapSpaceWithHomeIndicator : Constants.minMapSpace + value += bottomMinSpace } return value