mirror of
https://github.com/booklore-app/booklore.git
synced 2026-02-18 00:17:53 +01:00
Merge branch 'master' into develop
* master: Fix touch issues with ebook reader (#2395) Fix failing book cover search due to HTTP 403
This commit is contained in:
@@ -48,6 +48,7 @@ export class ReaderEventService {
|
||||
private isTextSelectionInProgress = false;
|
||||
private touchStartTime = 0;
|
||||
private selectionChangeTimeout: ReturnType<typeof setTimeout> | null = null;
|
||||
private lastTouchTime = 0;
|
||||
|
||||
private eventSubject = new Subject<ViewEvent>();
|
||||
public events$ = this.eventSubject.asObservable();
|
||||
@@ -158,6 +159,11 @@ export class ReaderEventService {
|
||||
});
|
||||
|
||||
doc.addEventListener('click', (event: MouseEvent) => {
|
||||
// Ignore synthesized mouse events that follow touch events
|
||||
if (Date.now() - this.lastTouchTime < 500) {
|
||||
return;
|
||||
}
|
||||
|
||||
const iframe = doc.defaultView?.frameElement as HTMLIFrameElement | null;
|
||||
if (!iframe) return;
|
||||
|
||||
@@ -275,6 +281,7 @@ export class ReaderEventService {
|
||||
private handleTouchEnd(event: TouchEvent, doc: Document): void {
|
||||
const touchEndTime = Date.now();
|
||||
const touchDuration = touchEndTime - this.touchStartTime;
|
||||
this.lastTouchTime = touchEndTime;
|
||||
|
||||
const selection = doc.defaultView?.getSelection();
|
||||
const hasSelection = selection && !selection.isCollapsed && selection.rangeCount > 0;
|
||||
|
||||
Reference in New Issue
Block a user