Attempt to fix promotions on mobile browsers
authorBenjamin Auder <benjamin.auder@somewhere>
Fri, 13 Mar 2020 09:36:19 +0000 (10:36 +0100)
committerBenjamin Auder <benjamin.auder@somewhere>
Fri, 13 Mar 2020 09:36:19 +0000 (10:36 +0100)
client/src/components/Board.vue

index 5080e84..f2fd44c 100644 (file)
@@ -294,7 +294,16 @@ export default {
           }
         },
         this.choices.map(m => {
-          //a "choice" is a move
+          // A "choice" is a move
+          const applyMove = (e) => {
+            e.stopPropagation();
+            this.play(m);
+            this.choices = [];
+          };
+          const onClick =
+            this.mobileBrowser
+              ? { touchend: applyMove }
+              : { mouseup: applyMove };
           return h(
             "div",
             {
@@ -316,12 +325,7 @@ export default {
                     ".svg"
                 },
                 class: { "choice-piece": true },
-                on: {
-                  click: () => {
-                    this.play(m);
-                    this.choices = [];
-                  }
-                }
+                on: onClick
               })
             ]
           );