From bbc8a7cf4abb214a07cb49b144af581b2e8335a6 Mon Sep 17 00:00:00 2001 From: Florrie Date: Sat, 8 Dec 2018 02:59:10 -0400 Subject: Mouse controls over playback info element Scroll up/down to seek, click to toggle pause. --- ui.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/ui.js b/ui.js index 1a64253..775dbcc 100644 --- a/ui.js +++ b/ui.js @@ -70,6 +70,10 @@ class AppElement extends FocusElement { this.playbackInfoElement = new PlaybackInfoElement() this.playbackPane.addChild(this.playbackInfoElement) + this.playbackInfoElement.on('seek back', () => this.seekBack(5)) + this.playbackInfoElement.on('seek ahead', () => this.seekAhead(5)) + this.playbackInfoElement.on('toggle pause', () => this.togglePause()) + // Dialogs this.openPlaylistDialog = new OpenPlaylistDialog() @@ -1330,6 +1334,16 @@ class PlaybackInfoElement extends DisplayElement { centerX(this.downloadLabel) } + clicked(button) { + if (button === 'scroll-up') { + this.emit('seek back') + } else if (button === 'scroll-down') { + this.emit('seek ahead') + } else if (button === 'left') { + this.emit('toggle pause') + } + } + updateProgress({timeDone, timeLeft, duration, lenSecTotal, curSecTotal}) { this.progressBarLabel.text = '-'.repeat(Math.floor(this.w / lenSecTotal * curSecTotal)) this.progressTextLabel.text = timeDone + ' / ' + duration -- cgit 1.3.0-6-gf8a5