Skip to content

Commit

Permalink
ensure no popup is rendered on top the playback window (#400)
Browse files Browse the repository at this point in the history
Resolves #399.

Fix rendering issue with `image` feature when a popup is rendered on top of the cover image. This PR updates the UI logic to ensure that the whole playback window is always visible from the UI.
  • Loading branch information
aome510 authored Mar 23, 2024
1 parent ad37326 commit 174876f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 19 deletions.
4 changes: 0 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ jobs:
matrix:
os: [macOS-latest, windows-latest, ubuntu-latest]
toolchain: [stable]
include:
- os: ubuntu-latest
toolchain: beta

runs-on: ${{ matrix.os }}

Expand Down Expand Up @@ -61,4 +58,3 @@ jobs:

- name: Cargo clippy without features
run: cargo clippy --no-default-features -- -D warnings

8 changes: 5 additions & 3 deletions spotify_player/src/ui/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,17 @@ fn render_application(
ui: &mut UIStateGuard,
rect: Rect,
) -> Result<()> {
// rendering order: help popup -> other popups -> playback window -> main layout
// rendering order: shortcut help popup -> playback window -> other popups -> main layout

let rect = popup::render_shortcut_help_popup(frame, state, ui, rect);

let (rect, is_active) = popup::render_popup(frame, state, ui, rect);

// render playback window before other popups to ensure no popup is rendered on top
// of the playback window
let (playback_rect, rect) = playback::split_rect_for_playback_window(rect, state);
playback::render_playback_window(frame, state, ui, playback_rect)?;

let (rect, is_active) = popup::render_popup(frame, state, ui, rect);

render_main_layout(is_active, frame, state, ui, rect)?;
Ok(())
}
Expand Down
16 changes: 4 additions & 12 deletions spotify_player/src/ui/popup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,20 +82,12 @@ pub fn render_popup(
(chunks[0], true)
}
PopupState::CommandHelp { .. } => {
// the command help popup will cover the entire main layout
let chunks =
Layout::vertical([Constraint::Fill(0), Constraint::Length(0)]).split(rect);

render_commands_help_popup(frame, state, ui, chunks[0]);
(chunks[1], false)
render_commands_help_popup(frame, state, ui, rect);
(Rect::default(), false)
}
PopupState::Queue { .. } => {
// the queue popup will cover the entire main layout
let chunks =
Layout::vertical([Constraint::Fill(0), Constraint::Length(0)]).split(rect);

render_queue_popup(frame, state, ui, chunks[0]);
(chunks[1], false)
render_queue_popup(frame, state, ui, rect);
(Rect::default(), false)
}
PopupState::ActionList(item, _) => {
let rect = render_list_popup(
Expand Down

0 comments on commit 174876f

Please sign in to comment.