2021-08-25 00:19:05 +02:00
|
|
|
/*
|
|
|
|
* https://github.com/morethanwords/tweb
|
|
|
|
* Copyright (C) 2019-2021 Eduard Kuzmenko
|
|
|
|
* https://github.com/morethanwords/tweb/blob/master/LICENSE
|
|
|
|
*/
|
|
|
|
|
|
|
|
import { cancelContextMenuOpening } from "../../components/misc";
|
2021-10-21 15:16:43 +02:00
|
|
|
import handleHorizontalSwipe, { SwipeHandlerHorizontalOptions } from "./handleHorizontalSwipe";
|
2021-08-25 00:19:05 +02:00
|
|
|
|
2021-10-21 15:16:43 +02:00
|
|
|
export default function handleTabSwipe(options: SwipeHandlerHorizontalOptions) {
|
|
|
|
return handleHorizontalSwipe({
|
|
|
|
...options,
|
2021-08-25 00:19:05 +02:00
|
|
|
onSwipe: (xDiff, yDiff, e) => {
|
|
|
|
if(Math.abs(xDiff) > 50) {
|
2021-10-21 15:16:43 +02:00
|
|
|
options.onSwipe(xDiff, yDiff, e);
|
2021-08-25 00:19:05 +02:00
|
|
|
cancelContextMenuOpening();
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2021-10-21 15:16:43 +02:00
|
|
|
}
|
2021-08-25 00:19:05 +02:00
|
|
|
});
|
2021-10-21 15:16:43 +02:00
|
|
|
}
|