1
0
mirror of https://github.com/misskey-dev/misskey.git synced 2026-07-25 17:55:06 +02:00
This commit is contained in:
syuilo
2026-07-10 20:13:59 +09:00
parent 965a7bcc41
commit b7be82bd41
2 changed files with 29 additions and 0 deletions

View File

@@ -10,8 +10,11 @@ SPDX-License-Identifier: AGPL-3.0-only
@pointerdown.passive="onPointerdown"
@pointermove.passive="onPointermove"
@pointerup.passive="onPointerup"
@pointercancel.passive="cancelPointerGesture"
@touchstart.passive="onTouchstart"
@touchmove.passive="onTouchmove"
@touchcancel.passive="cancelPointerGesture"
@contextmenu="cancelPointerGesture"
@wheel="onWheel"
@click="onCLick"
>
@@ -383,6 +386,26 @@ const doubleTapDetector = makeDoubleTapDetector((ev) => {
}
});
function cancelPointerGesture() {
const wasVerticalSwiping = isVerticalSwiping;
const wasHorizontalSwiping = isHorizontalSwiping;
pointerEventCache.clear();
prevTwoTouchPointsDistance = 0;
currentPointerId = null;
isDragging = false;
isClick = false;
pointerVec = { x: 0, y: 0 };
verticalSwipeDelta = 0;
horizontalSwipeDelta = 0;
isVerticalSwiping = false;
isHorizontalSwiping = false;
doubleTapDetector.reset();
if (wasVerticalSwiping) resetToNeutral();
if (wasHorizontalSwiping) emit('cancelHorizontalSwipe');
}
function onTouchstart(ev: TouchEvent) {
ev.preventDefault();
ev.stopPropagation();

View File

@@ -43,8 +43,14 @@ export function makeDoubleTapDetector(onDoubletap: (event: TouchEvent) => void)
}
}
function reset() {
lastTapTime = 0;
lastTapPosition = { x: 0, y: 0 };
}
return {
onTouchstart,
onTouchmove,
reset,
};
}