mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Backport pull request #5843 from jellyfin-web/release-10.9.z
Fix swipe gestures on android for book reader
Original-merge: 44afbc2357
Merged-by: thornbill <thornbill@users.noreply.github.com>
Backported-by: thornbill <thornbill@users.noreply.github.com>
This commit is contained in:
parent
371994642d
commit
75d78a96b8
1 changed files with 18 additions and 4 deletions
|
@ -7,6 +7,7 @@ import ServerConnections from '../../components/ServerConnections';
|
||||||
import Screenfull from 'screenfull';
|
import Screenfull from 'screenfull';
|
||||||
import TableOfContents from './tableOfContents';
|
import TableOfContents from './tableOfContents';
|
||||||
import { translateHtml } from '../../scripts/globalize';
|
import { translateHtml } from '../../scripts/globalize';
|
||||||
|
import browser from 'scripts/browser';
|
||||||
import * as userSettings from '../../scripts/settings/userSettings';
|
import * as userSettings from '../../scripts/settings/userSettings';
|
||||||
import TouchHelper from 'scripts/touchHelper';
|
import TouchHelper from 'scripts/touchHelper';
|
||||||
import { PluginType } from '../../types/plugin.ts';
|
import { PluginType } from '../../types/plugin.ts';
|
||||||
|
@ -45,6 +46,7 @@ export class BookPlayer {
|
||||||
this.previous = this.previous.bind(this);
|
this.previous = this.previous.bind(this);
|
||||||
this.next = this.next.bind(this);
|
this.next = this.next.bind(this);
|
||||||
this.onWindowKeyUp = this.onWindowKeyUp.bind(this);
|
this.onWindowKeyUp = this.onWindowKeyUp.bind(this);
|
||||||
|
this.addSwipeGestures = this.addSwipeGestures.bind(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
play(options) {
|
play(options) {
|
||||||
|
@ -155,6 +157,12 @@ export class BookPlayer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
addSwipeGestures(element) {
|
||||||
|
this.touchHelper = new TouchHelper(element);
|
||||||
|
Events.on(this.touchHelper, 'swipeleft', () => this.next());
|
||||||
|
Events.on(this.touchHelper, 'swiperight', () => this.previous());
|
||||||
|
}
|
||||||
|
|
||||||
onDialogClosed() {
|
onDialogClosed() {
|
||||||
this.stop();
|
this.stop();
|
||||||
}
|
}
|
||||||
|
@ -179,10 +187,12 @@ export class BookPlayer {
|
||||||
document.addEventListener('keyup', this.onWindowKeyUp);
|
document.addEventListener('keyup', this.onWindowKeyUp);
|
||||||
this.rendition?.on('keyup', this.onWindowKeyUp);
|
this.rendition?.on('keyup', this.onWindowKeyUp);
|
||||||
|
|
||||||
const player = document.getElementById('bookPlayerContainer');
|
if (browser.safari) {
|
||||||
this.touchHelper = new TouchHelper(player);
|
const player = document.getElementById('bookPlayerContainer');
|
||||||
Events.on(this.touchHelper, 'swipeleft', () => this.next());
|
this.addSwipeGestures(player);
|
||||||
Events.on(this.touchHelper, 'swiperight', () => this.previous());
|
} else {
|
||||||
|
this.rendition?.on('rendered', (e, i) => this.addSwipeGestures(i.document.documentElement));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unbindMediaElementEvents() {
|
unbindMediaElementEvents() {
|
||||||
|
@ -207,6 +217,10 @@ export class BookPlayer {
|
||||||
document.removeEventListener('keyup', this.onWindowKeyUp);
|
document.removeEventListener('keyup', this.onWindowKeyUp);
|
||||||
this.rendition?.off('keyup', this.onWindowKeyUp);
|
this.rendition?.off('keyup', this.onWindowKeyUp);
|
||||||
|
|
||||||
|
if (!browser.safari) {
|
||||||
|
this.rendition?.off('rendered', (e, i) => this.addSwipeGestures(i.document.documentElement));
|
||||||
|
}
|
||||||
|
|
||||||
this.touchHelper?.destroy();
|
this.touchHelper?.destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue