From b3c658ea0b252f72ed2aeb248d2712419f0350b6 Mon Sep 17 00:00:00 2001 From: Kyle <41976328+ImKyle4815@users.noreply.github.com> Date: Sat, 10 Aug 2019 16:15:59 -0700 Subject: [PATCH] life --- data/life/life.js | 24 ++++++++++++------------ life.html | 2 +- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/data/life/life.js b/data/life/life.js index 2353ba56..bea943eb 100644 --- a/data/life/life.js +++ b/data/life/life.js @@ -143,16 +143,16 @@ function playerBox(playerBoxID, canvasRotation, wide) { this.canvas.classList.add("widePlayerBox") } document.getElementById("mainGrid").appendChild(this.canvas) - this.canvas.addEventListener("mousedown", function() { - mouseDownPlayerBox(this, event.clientX, event.clientY) - alert("It's still clicking!") - }) - document.addEventListener("mouseup", function() { - mouseUpPlayerBox(this) - }) - window.addEventListener("touchstart", function() { - switchToTouchEvents() - }) + this.canvas.addEventListener("mousedown", decoyMouseDownFunction) + document.addEventListener("mouseup", decoyMouseUpFunction) + window.addEventListener("touchstart", switchToTouchEvents) +} +function decoyMouseDownFunction() { + alert("IT'S STILL CLICKING") + mouseDownPlayerBox(this, event.clientX, event.clientY) +} +function decoyMouseUpFunction() { + mouseUpPlayerBox(this) } function configurePlayerBox(playerBoxID) { var currentPlayer = playerList[playerBoxID - 1] @@ -224,8 +224,8 @@ function updateBackgroundColor(color) { function switchToTouchEvents() { - document.removeEventListener("mousedown") - document.removeEventListener("mouseup") + document.removeEventListener("mousedown", decoyMouseDownFunction) + document.removeEventListener("mouseup", decoyMouseUpFunction) document.addEventListener("touchstart", function() { mouseDownPlayerBox(this, event.clientX, event.clientY) }) diff --git a/life.html b/life.html index ec3c6eb3..f75f131e 100644 --- a/life.html +++ b/life.html @@ -197,7 +197,7 @@ margin: 90pt 0px 0px 0px; padding: 20pt; overflow-y: scroll; - max-height: calc(100% - 90pt); + height: calc(100% - 90pt); border: 1px solid white; } .menuOption {