mirror of
https://github.com/danog/telegram-tt.git
synced 2025-01-22 05:11:55 +01:00
Chat List: Fix swipe gesture spoils scroll
This commit is contained in:
parent
ea20abb74b
commit
3c9ad43581
@ -45,6 +45,7 @@ export function captureEvents(element: HTMLElement, options: CaptureOptions) {
|
|||||||
let captureEvent: MouseEvent | RealTouchEvent | undefined;
|
let captureEvent: MouseEvent | RealTouchEvent | undefined;
|
||||||
let hasMoved = false;
|
let hasMoved = false;
|
||||||
let hasSwiped = false;
|
let hasSwiped = false;
|
||||||
|
let initialSwipeAxis: TSwipeAxis | undefined;
|
||||||
|
|
||||||
function onCapture(e: MouseEvent | RealTouchEvent) {
|
function onCapture(e: MouseEvent | RealTouchEvent) {
|
||||||
if (options.excludedClosestSelector && (
|
if (options.excludedClosestSelector && (
|
||||||
@ -194,6 +195,13 @@ export function captureEvents(element: HTMLElement, options: CaptureOptions) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!initialSwipeAxis) {
|
||||||
|
initialSwipeAxis = axis;
|
||||||
|
} else if (initialSwipeAxis !== axis) {
|
||||||
|
// Prevent horizontal swipe after vertical to prioritize scroll
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return processSwipe(e, axis, dragOffsetX, dragOffsetY, options.onSwipe!);
|
return processSwipe(e, axis, dragOffsetX, dragOffsetY, options.onSwipe!);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user