forked from shadowfacts/Tusker
visionOS: Fix timeline jump button appearance
This commit is contained in:
parent
1da25300ca
commit
a93a4fccc1
|
@ -13,15 +13,23 @@ class TimelineJumpButton: UIView {
|
||||||
var action: ((Mode) async -> Void)?
|
var action: ((Mode) async -> Void)?
|
||||||
|
|
||||||
override var intrinsicContentSize: CGSize {
|
override var intrinsicContentSize: CGSize {
|
||||||
|
#if os(visionOS)
|
||||||
|
CGSize(width: 44, height: 44)
|
||||||
|
#else
|
||||||
CGSize(width: UIView.noIntrinsicMetric, height: 44)
|
CGSize(width: UIView.noIntrinsicMetric, height: 44)
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
private let button: UIButton = {
|
private let button: UIButton = {
|
||||||
|
#if os(visionOS)
|
||||||
|
var config = UIButton.Configuration.borderedProminent()
|
||||||
|
#else
|
||||||
var config = UIButton.Configuration.plain()
|
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.
|
// 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
|
config.background.backgroundColor = .clear
|
||||||
|
#endif
|
||||||
|
config.image = UIImage(systemName: "arrow.up")
|
||||||
|
config.contentInsets = .zero
|
||||||
return UIButton(configuration: config)
|
return UIButton(configuration: config)
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
@ -101,8 +109,7 @@ class TimelineJumpButton: UIView {
|
||||||
}
|
}
|
||||||
self.mode = mode
|
self.mode = mode
|
||||||
|
|
||||||
var config = UIButton.Configuration.plain()
|
var config = button.configuration!
|
||||||
config.contentInsets = .zero
|
|
||||||
switch mode {
|
switch mode {
|
||||||
case .jump:
|
case .jump:
|
||||||
config.image = UIImage(systemName: "arrow.up")
|
config.image = UIImage(systemName: "arrow.up")
|
||||||
|
|
Loading…
Reference in New Issue