about summary refs log tree commit diff stats
path: root/js/inknswitch/ink.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/inknswitch/ink.js')
-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