Experimental fix attempt in Board.vue (bad behavior on smartphones)
authorBenjamin Auder <benjamin.auder@somewhere>
Sun, 16 Feb 2020 18:13:54 +0000 (19:13 +0100)
committerBenjamin Auder <benjamin.auder@somewhere>
Sun, 16 Feb 2020 18:13:54 +0000 (19:13 +0100)
client/src/components/Board.vue

index 8b57095..0c12620 100644 (file)
@@ -244,19 +244,31 @@ export default {
       );
       elementArray.push(reserves);
     }
-    return h(
-      'div',
-      {
-        // NOTE: click = mousedown + mouseup
+    let onEvents = {};
+    // NOTE: click = mousedown + mouseup
+    if ('ontouchstart' in window)
+    {
+      onEvents = {
+        on: {
+          touchstart: this.mousedown,
+          touchmove: this.mousemove,
+          touchend: this.mouseup,
+        },
+      };
+    }
+    else
+    {
+      onEvents = {
         on: {
           mousedown: this.mousedown,
           mousemove: this.mousemove,
           mouseup: this.mouseup,
-//          touchstart: this.mousedown,
-          touchmove: this.mousemove,
-//          touchend: this.mouseup,
         },
-      },
+      };
+    }
+    return h(
+      'div',
+      onEvents,
       elementArray
     );
   },