Skip to content

Commit

Permalink
Swipe fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ZXY101 committed Jun 5, 2023
1 parent 69184af commit 24d3690
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions mokuro/script.mobile.js
Original file line number Diff line number Diff line change
Expand Up @@ -577,10 +577,12 @@ document.addEventListener('touchcancel', handleTouchCancel);
let startX;
let startY;
const ongoingTouches = [];
let distance;
let distanceX;
let distanceY;

function removeTouch(event) {
const touches = event.changedTouches;

for (let i = 0; i < touches.length; i++) {
const touch = touches[i];
const touchIndex = ongoingTouches.indexOf(touch.identifier);
Expand All @@ -594,14 +596,12 @@ function removeTouch(event) {
function handleTouchStart(event) {
const touches = event.changedTouches;

distance = 0;
distanceY = 0;
distanceX = 0;
startX = event.touches[0].clientX;
startY = event.touches[0].clientY;
running = false;

for (let i = 0; i < touches.length; i++) {
ongoingTouches.push(touches[i].identifier);
}
ongoingTouches.push(touches[0].identifier);
}

function handleTouchMove(event) {
Expand Down

0 comments on commit 24d3690

Please sign in to comment.