mirror of
https://github.com/yattee/yattee.git
synced 2026-05-12 18:35:05 +00:00
Keep macOS play pause control visible
This commit is contained in:
@@ -832,11 +832,7 @@ struct ControlsSectionRenderer: View {
|
|||||||
// MARK: - Transport State
|
// MARK: - Transport State
|
||||||
|
|
||||||
private var isTransportDisabled: Bool {
|
private var isTransportDisabled: Bool {
|
||||||
let state = actions.playerState
|
actions.playerState.isTransportDisabled
|
||||||
return state.playbackState == .loading ||
|
|
||||||
state.playbackState == .buffering ||
|
|
||||||
!state.isFirstFrameReady ||
|
|
||||||
!state.isBufferReady
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: - Playback Speed Menu
|
// MARK: - Playback Speed Menu
|
||||||
|
|||||||
@@ -54,10 +54,7 @@ struct MacOSControlBar: View {
|
|||||||
|
|
||||||
/// Whether transport controls should be disabled
|
/// Whether transport controls should be disabled
|
||||||
private var isTransportDisabled: Bool {
|
private var isTransportDisabled: Bool {
|
||||||
playerState.playbackState == .loading ||
|
playerState.isTransportDisabled
|
||||||
playerState.playbackState == .buffering ||
|
|
||||||
!playerState.isFirstFrameReady ||
|
|
||||||
!playerState.isBufferReady
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private var playPauseIcon: String {
|
private var playPauseIcon: String {
|
||||||
@@ -167,22 +164,18 @@ struct MacOSControlBar: View {
|
|||||||
.disabled(isTransportDisabled)
|
.disabled(isTransportDisabled)
|
||||||
|
|
||||||
// Play/Pause
|
// Play/Pause
|
||||||
if !isTransportDisabled {
|
Button {
|
||||||
Button {
|
onPlayPause()
|
||||||
onPlayPause()
|
} label: {
|
||||||
} label: {
|
Image(systemName: playPauseIcon)
|
||||||
Image(systemName: playPauseIcon)
|
.font(.system(size: 16, weight: .medium))
|
||||||
.font(.system(size: 16, weight: .medium))
|
|
||||||
.frame(width: 32, height: 32)
|
|
||||||
.contentShape(Rectangle())
|
|
||||||
.contentTransition(.symbolEffect(.replace, options: .speed(2)))
|
|
||||||
}
|
|
||||||
.buttonStyle(MacOSControlButtonStyle())
|
|
||||||
} else {
|
|
||||||
// Spacer to maintain layout
|
|
||||||
Color.clear
|
|
||||||
.frame(width: 32, height: 32)
|
.frame(width: 32, height: 32)
|
||||||
|
.contentShape(Rectangle())
|
||||||
|
.contentTransition(.symbolEffect(.replace, options: .speed(2)))
|
||||||
}
|
}
|
||||||
|
.buttonStyle(MacOSControlButtonStyle())
|
||||||
|
.disabled(isTransportDisabled)
|
||||||
|
.opacity(isTransportDisabled ? 0.3 : 1.0)
|
||||||
|
|
||||||
// Skip forward
|
// Skip forward
|
||||||
Button {
|
Button {
|
||||||
|
|||||||
Reference in New Issue
Block a user