about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorelioat <elioat@tilde.institute>2024-01-12 22:14:01 -0500
committerelioat <elioat@tilde.institute>2024-01-12 22:14:01 -0500
commit7d678797e20d6897c8a287c91d99864dd8c84e0b (patch)
tree2d73e5f7ee1b809d82337d5cf4bc43b6471232ef
parent5126d4ceccd89cbc78359c2f5c5e675c9af83e2e (diff)
downloadtour-7d678797e20d6897c8a287c91d99864dd8c84e0b.tar.gz
*
-rw-r--r--js/inknswitch/ink.js20
1 files changed, 10 insertions, 10 deletions
diff --git a/js/inknswitch/ink.js b/js/inknswitch/ink.js
index 3a48ce6..cd0c540 100644
--- a/js/inknswitch/ink.js
+++ b/js/inknswitch/ink.js
@@ -166,15 +166,15 @@ let touchStartCount;
 document.addEventListener('touchstart', function(e) {
     touchStartTimestamp = Date.now();
     touchStartCount = e.touches.length;
-}, false);
-
-document.addEventListener('touchend', function(e) {
-    const touchEndTimestamp = Date.now();
-    const touchEndCount = e.touches.length;
-
-    // Check if the touch event was a two-finger tap
-    if (touchStartCount === 2 && touchEndCount === 0 && touchEndTimestamp - touchStartTimestamp < 500) {
-        // Two-finger tap detected
-        toggleMode();
+    if (touchStartCount === 2) {
+        // Check if the touches are on either side of the screen
+        const touch1 = e.touches[0];
+        const touch2 = e.touches[1];
+        const screenWidth = window.innerWidth;
+        if ((touch1.clientX < screenWidth / 2 && touch2.clientX > screenWidth / 2) ||
+            (touch2.clientX < screenWidth / 2 && touch1.clientX > screenWidth / 2)) {
+            // The touches are on either side of the screen
+            toggleMode();
+        }
     }
 }, false);
\ No newline at end of file
57'>157 158 159 160 161 162 163 164 165 166 167 168 169