visionOS: Fix timeline jump button appearance

This commit is contained in:
Shadowfacts 2023-11-07 22:31:57 -05:00
parent 1da25300ca
commit a93a4fccc1
1 changed files with 11 additions and 4 deletions

View File

@ -13,15 +13,23 @@ class TimelineJumpButton: UIView {
var action: ((Mode) async -> Void)?
override var intrinsicContentSize: CGSize {
#if os(visionOS)
CGSize(width: 44, height: 44)
#else
CGSize(width: UIView.noIntrinsicMetric, height: 44)
#endif
}
private let button: UIButton = {
#if os(visionOS)
var config = UIButton.Configuration.borderedProminent()
#else
var config = UIButton.Configuration.plain()
config.image = UIImage(systemName: "arrow.up")
config.contentInsets = .zero
// We don't want a background for this button, even when accessibility button shapes are enabled, because it's in the navbar.
config.background.backgroundColor = .clear
#endif
config.image = UIImage(systemName: "arrow.up")
config.contentInsets = .zero
return UIButton(configuration: config)
}()
@ -101,8 +109,7 @@ class TimelineJumpButton: UIView {
}
self.mode = mode
var config = UIButton.Configuration.plain()
config.contentInsets = .zero
var config = button.configuration!
switch mode {
case .jump:
config.image = UIImage(systemName: "arrow.up")