mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-07-25 17:55:06 +02:00
fix
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -43,8 +43,14 @@ export function makeDoubleTapDetector(onDoubletap: (event: TouchEvent) => void)
|
||||
}
|
||||
}
|
||||
|
||||
function reset() {
|
||||
lastTapTime = 0;
|
||||
lastTapPosition = { x: 0, y: 0 };
|
||||
}
|
||||
|
||||
return {
|
||||
onTouchstart,
|
||||
onTouchmove,
|
||||
reset,
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user