mirror of
https://github.com/FBukovina/Atoll.git
synced 2026-10-27 15:14:33 +00:00
Fix: Janky Animation
This commit is contained in:
parent
7578ccae60
commit
8d7cc2ed58
3 changed files with 37 additions and 9 deletions
|
|
@ -102,12 +102,21 @@ class DynamicIslandViewCoordinator: ObservableObject {
|
|||
static let shared = DynamicIslandViewCoordinator()
|
||||
private var cancellables = Set<AnyCancellable>()
|
||||
|
||||
private static let tabOrder: [NotchViews] = [.home, .shelf, .timer, .stats, .colorPicker, .notes, .clipboard, .extensionExperience]
|
||||
|
||||
/// Direction of the most recent tab switch (true = forward/right, false = backward/left)
|
||||
@Published var tabSwitchForward: Bool = true
|
||||
|
||||
@Published var currentView: NotchViews = .home {
|
||||
didSet {
|
||||
if Defaults[.enableMinimalisticUI] && currentView != .home {
|
||||
currentView = .home
|
||||
return
|
||||
}
|
||||
// Track direction before SwiftUI re-renders
|
||||
let oldIdx = Self.tabOrder.firstIndex(of: oldValue) ?? 0
|
||||
let newIdx = Self.tabOrder.firstIndex(of: currentView) ?? 0
|
||||
tabSwitchForward = newIdx >= oldIdx
|
||||
handleStatsTabTransition(from: oldValue, to: currentView)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue