From 05d9049778acfa0e85ac83e9dc7a1c1d1f005585 Mon Sep 17 00:00:00 2001 From: John Factotum <50942278+johnfactotum@users.noreply.github.com> Date: Mon, 7 Oct 2024 11:06:32 +0800 Subject: [PATCH] Media Overlay: keep highlight when pausing --- src/book-viewer.js | 2 ++ src/foliate-js | 2 +- src/tts.js | 9 +++++++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/book-viewer.js b/src/book-viewer.js index 89fb4732..9b6cc434 100644 --- a/src/book-viewer.js +++ b/src/book-viewer.js @@ -397,6 +397,7 @@ GObject.registerClass({ mediaOverlayStart() { return this.#exec('reader.view.startMediaOverlay') } mediaOverlayPause() { return this.#exec('reader.view.mediaOverlay.pause') } mediaOverlayResume() { return this.#exec('reader.view.mediaOverlay.resume') } + mediaOverlayStop() { return this.#exec('reader.view.mediaOverlay.stop') } mediaOverlayPrev() { return this.#exec('reader.view.mediaOverlay.prev') } mediaOverlayNext() { return this.#exec('reader.view.mediaOverlay.next') } mediaOverlaySetVolume(x) { return this.#exec('reader.view.mediaOverlay.setVolume', x) } @@ -655,6 +656,7 @@ export const BookViewer = GObject.registerClass({ 'start': () => this._view.mediaOverlayStart(), 'pause': () => this._view.mediaOverlayPause(), 'resume': () => this._view.mediaOverlayResume(), + 'stop': () => this._view.mediaOverlayStop(), 'backward': () => this._view.mediaOverlayPrev(), 'forward': () => this._view.mediaOverlayNext(), 'notify::volume': box => this._view.mediaOverlaySetVolume(box.volume), diff --git a/src/foliate-js b/src/foliate-js index 693341f0..7cbc36b4 160000 --- a/src/foliate-js +++ b/src/foliate-js @@ -1 +1 @@ -Subproject commit 693341f0080e2aacce8cb3552928b619039f27e1 +Subproject commit 7cbc36b4890510e3e38842e70844cc384aaf2428 diff --git a/src/tts.js b/src/tts.js index 0cb3a218..f914286d 100644 --- a/src/tts.js +++ b/src/tts.js @@ -135,6 +135,7 @@ GObject.registerClass({ 'start': {}, 'pause': {}, 'resume': {}, + 'stop': {}, 'backward': {}, 'forward': {}, }, @@ -182,12 +183,16 @@ GObject.registerClass({ this.state = 'paused' this.emit('pause') } + stop() { + this.state = 'stopped' + this.emit('stop') + } backward() { - this.state = 'playing' + if (this.state === 'stopped') this.state = 'playing' this.emit('backward') } forward() { - this.state = 'playing' + if (this.state === 'stopped') this.state = 'playing' this.emit('forward') } })