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
|
||||
|
||||
private var isTransportDisabled: Bool {
|
||||
let state = actions.playerState
|
||||
return state.playbackState == .loading ||
|
||||
state.playbackState == .buffering ||
|
||||
!state.isFirstFrameReady ||
|
||||
!state.isBufferReady
|
||||
actions.playerState.isTransportDisabled
|
||||
}
|
||||
|
||||
// MARK: - Playback Speed Menu
|
||||
|
||||
@@ -54,10 +54,7 @@ struct MacOSControlBar: View {
|
||||
|
||||
/// Whether transport controls should be disabled
|
||||
private var isTransportDisabled: Bool {
|
||||
playerState.playbackState == .loading ||
|
||||
playerState.playbackState == .buffering ||
|
||||
!playerState.isFirstFrameReady ||
|
||||
!playerState.isBufferReady
|
||||
playerState.isTransportDisabled
|
||||
}
|
||||
|
||||
private var playPauseIcon: String {
|
||||
@@ -167,22 +164,18 @@ struct MacOSControlBar: View {
|
||||
.disabled(isTransportDisabled)
|
||||
|
||||
// Play/Pause
|
||||
if !isTransportDisabled {
|
||||
Button {
|
||||
onPlayPause()
|
||||
} label: {
|
||||
Image(systemName: playPauseIcon)
|
||||
.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
|
||||
Button {
|
||||
onPlayPause()
|
||||
} label: {
|
||||
Image(systemName: playPauseIcon)
|
||||
.font(.system(size: 16, weight: .medium))
|
||||
.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
|
||||
Button {
|
||||
|
||||
Reference in New Issue
Block a user