From 74da483bc581fce6c779061e2020f1e6ad959d59 Mon Sep 17 00:00:00 2001 From: Maxim Stewart Date: Sun, 28 Jun 2020 23:04:16 -0500 Subject: [PATCH] fixed click, mod rate changes --- README.md | 3 +-- src/core/static/js/events.js | 20 ++++++++++++++------ 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index b6767d7..9b24e12 100644 --- a/README.md +++ b/README.md @@ -37,5 +37,4 @@ Windows ![1 Interface.... ](images/pic1.png) # TODO -* Fix typing input -* Fix clicking lockup issues during touch +8 n/a diff --git a/src/core/static/js/events.js b/src/core/static/js/events.js index d734bfc..aa40fac 100644 --- a/src/core/static/js/events.js +++ b/src/core/static/js/events.js @@ -2,7 +2,7 @@ const socket = io(); let intervalTimer = null; let px = 0; let py = 0; -let mod = 1; +let mod = 0; socket.on('connect', function() { @@ -78,21 +78,29 @@ function touchHandler(event) { function beginTimerModBump() { intervalTimer = setInterval(function () { - mod += 1; - }, 800); + mod += 2; + }, 600); } function endTimerModBump() { clearInterval(intervalTimer); - mod = 1; + mod = 0; +} + +function singleClick() { + socket.emit('single_click', ""); +} + +function doubleClick() { + socket.emit('double_click', ""); } document.addEventListener("mousedown", beginTimerModBump, true); document.addEventListener("mouseup", endTimerModBump, true); - - document.addEventListener("touchstart", touchHandler, true); document.addEventListener("touchmove", touchHandler, true); document.addEventListener("touchend", touchHandler, true); document.addEventListener("touchcancel", touchHandler, true); +document.getElementById("singleClickBtn").addEventListener("mouseup", singleClick, true); +document.getElementById("doubleClickBtn").addEventListener("mouseup", doubleClick, true);