Skip to content

Commit

Permalink
hook up keyboard scrolling to Now Playing page tracklists
Browse files Browse the repository at this point in the history
  • Loading branch information
dweymouth committed Jul 13, 2024
1 parent 15811e6 commit 69a1900
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
12 changes: 12 additions & 0 deletions ui/browsing/nowplayingpage.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,18 @@ func (a *NowPlayingPage) Route() controller.Route {
return controller.NowPlayingRoute("")
}

var _ Scrollable = (*NowPlayingPage)(nil)

func (a *NowPlayingPage) Scroll(delta float32) {
switch a.tabs.SelectedIndex() {
case 0: /*play queue*/
a.queueList.Scroll(delta)
case 1: /*lyrics*/
case 2: /*related*/
a.relatedList.Scroll(delta)
}
}

var _ CanShowNowPlaying = (*NowPlayingPage)(nil)

func (a *NowPlayingPage) OnSongChange(song mediaprovider.MediaItem, lastScrobbledIfAny *mediaprovider.Track) {
Expand Down
4 changes: 4 additions & 0 deletions ui/widgets/playqueuelist.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,10 @@ func (p *PlayQueueList) UnselectAll() {
p.list.Refresh()
}

func (p *PlayQueueList) Scroll(amount float32) {
p.list.ScrollToOffset(p.list.GetScrollOffset() + amount)
}

func (p *PlayQueueList) Refresh() {
p.list.EnableDragging = p.Reorderable
p.BaseWidget.Refresh()
Expand Down

0 comments on commit 69a1900

Please sign in to comment.