Add Konane, (very) early drafts of Emergo/Fanorona/Yote/Gomoku, fix repetitions detec...
[vchess.git] / client / src / components / Board.vue
index 1d650ac..cc3f6fd 100644 (file)
@@ -402,10 +402,12 @@ export default {
               this.choices = [];
               this.play(m);
             };
+            const stopPropagation = (e) => { e.stopPropagation(); }
             const onClick =
               this.mobileBrowser
-                ? { touchend: applyMove }
-                : { mouseup: applyMove };
+                // Must cancel mousedown logic:
+                ? { touchstart: stopPropagation, touchend: applyMove }
+                : { mousedown: stopPropagation, mouseup: applyMove };
             return h(
               "div",
               {
@@ -423,7 +425,7 @@ export default {
                   attrs: {
                     src:
                       "/images/pieces/" +
-                      // orientation: extra arg useful for some variants:
+                      // orientation: extra arg useful for some variants
                       this.vr.getPPpath(m, this.orientation) +
                       V.IMAGE_EXTENSION
                   },
@@ -657,8 +659,9 @@ export default {
             // Emit the click event which could be used by some variants
             const targetId =
               (withPiece ? e.target.parentNode.id : e.target.id);
-            this.$emit("click-square", getSquareFromId(targetId));
-            if (withPiece) {
+            const sq = getSquareFromId(targetId);
+            this.$emit("click-square", sq);
+            if (withPiece && !this.vr.onlyClick(sq)) {
               this.possibleMoves = this.vr.getPossibleMovesFrom(startSquare);
               // For potential drag'n drop, remember start coordinates
               // (to center the piece on mouse cursor)