From 3130967f31a09dfc12cb7e28e2e4b572b21d4e41 Mon Sep 17 00:00:00 2001 From: Kyle <41976328+ImKyle4815@users.noreply.github.com> Date: Sat, 10 Aug 2019 16:46:21 -0700 Subject: [PATCH] Update life.js --- data/life/life.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/data/life/life.js b/data/life/life.js index 030caafe..94f43694 100644 --- a/data/life/life.js +++ b/data/life/life.js @@ -6,7 +6,7 @@ var playerCount, startingLifeTotal, firstPlayerWide = false, lastPlayerWide = fa if ((typeof window.orientation !== "undefined") || (navigator.userAgent.indexOf('IEMobile') !== -1)) { isMobile = true } -window.addEventListener("touchstart", switchToTouchEvents) +window.addEventListener("touchstart", switchToTouchEvents, true) //This function sets everything up function fullscreen() { //Full screen! @@ -144,8 +144,8 @@ function playerBox(playerBoxID, canvasRotation, wide) { this.canvas.classList.add("widePlayerBox") } document.getElementById("mainGrid").appendChild(this.canvas) - this.canvas.addEventListener("mousedown", decoyMouseDownFunction) - document.addEventListener("mouseup", decoyMouseUpFunction) + this.canvas.addEventListener("mousedown", decoyMouseDownFunction, true) + document.addEventListener("mouseup", decoyMouseUpFunction, true) } function decoyMouseDownFunction() { alert("IT'S STILL CLICKING") @@ -224,16 +224,16 @@ function updateBackgroundColor(color) { function switchToTouchEvents() { - window.removeEventListener("touchstart", switchToTouchEvents) - document.removeEventListener("mouseup", decoyMouseUpFunction) - alert("switch!!!!") + window.removeEventListener("touchstart", switchToTouchEvents, true) + document.removeEventListener("mouseup", decoyMouseUpFunction, true) for (var i = 1; i <= playerCount; i++) { - alert(playerList[i - 1].canvas.removeEventListener("mousedown", decoyMouseDownFunction)) + alert("Currently being dumb: " + i) + playerList[i - 1].canvas.removeEventListener("mousedown", decoyMouseDownFunction, true) playerList[i - 1].canvas.addEventListener("touchstart", function() { mouseDownPlayerBox(this, event.clientX, event.clientY) - }) + }, true) playerList[i - 1].canvas.addEventListener("touchend", function() { mouseUpPlayerBox(this) - }) + }, true) } } \ No newline at end of file