From 2f67be588e0e3e1db3c7a6da445ea584b9c950c6 Mon Sep 17 00:00:00 2001 From: Kyle <41976328+ImKyle4815@users.noreply.github.com> Date: Thu, 15 Aug 2019 16:51:37 -0700 Subject: [PATCH] Update life.js --- data/life/life.js | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/data/life/life.js b/data/life/life.js index 4fcd0b8d..331e2c96 100644 --- a/data/life/life.js +++ b/data/life/life.js @@ -332,12 +332,15 @@ function switchToTouchEvents() { window.addEventListener("touchend", endTouch, true) } function startTouch() { - if (!clicking) { - if (event.touches.length > 0) { - clicking = true + touchX = [], touchY = [] + for (var i = 0; i < event.touches.length; i ++) { + touchX[i] = event.touches[i].clientX + touchY[i] = event.touches[i].clientY + } + if (event.touches.length > 0) { + if (!clicking) { + updatePlayerBoxes() } - updatePlayerBoxes() - } else if (event.touches.length > 0) { clicking = true } } @@ -349,6 +352,11 @@ function moveTouch() { } } function endTouch() { + touchX = [], touchY = [] + for (var i = 0; i < event.touches.length; i ++) { + touchX[i] = event.touches[i].clientX + touchY[i] = event.touches[i].clientY + } clearTimeout(loop) clearTimers() if (event.touches.length < 1) {