Skip to content

Commit

Permalink
toolbar: increased opacity of dim view
Browse files Browse the repository at this point in the history
Also made animation smooth for transition back to visible.
  • Loading branch information
osy committed Jan 11, 2022
1 parent b65c9f6 commit 0a2e1f2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
20 changes: 12 additions & 8 deletions Platform/iOS/Display/VMToolbarActions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -128,23 +128,27 @@ import SwiftUI
}
}

private func setIsUserInteracting(_ value: Bool) {
if #available(iOS 14, *), !UIAccessibility.isReduceMotionEnabled {
withAnimation {
self.isUserInteracting = value
}
} else {
self.isUserInteracting = value
}
}

func assertUserInteraction() {
guard !hasLegacyToolbar else {
return
}
if let task = longIdleTask {
task.cancel()
}
isUserInteracting = true
setIsUserInteracting(true)
longIdleTask = DispatchWorkItem {
self.longIdleTask = nil
if #available(iOS 14, *), !UIAccessibility.isReduceMotionEnabled {
withAnimation {
self.isUserInteracting = false
}
} else {
self.isUserInteracting = false
}
self.setIsUserInteracting(false)
}
DispatchQueue.main.asyncAfter(deadline: .now() + 15, execute: longIdleTask!)
}
Expand Down
2 changes: 1 addition & 1 deletion Platform/iOS/Display/VMToolbarView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ struct VMToolbarView: View {
if !state.isUserInteracting {
return 0
} else if isIdle {
return 0.2
return 0.4
} else {
return 1
}
Expand Down

0 comments on commit 0a2e1f2

Please sign in to comment.