X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=public%2Fjavascripts%2Fcomponents%2Fgame.js;h=1e8d9fd204410a4d98cc6ee0ef4a99bc62c38974;hb=98ccb376074052c83a1a0fd51262ab5ffe82c8b3;hp=308d415e9eec0e220832167a5e402c90ef2985fc;hpb=5bd679d562f992cad856099fbc98014dc4556801;p=vchess.git diff --git a/public/javascripts/components/game.js b/public/javascripts/components/game.js index 308d415e..1e8d9fd2 100644 --- a/public/javascripts/components/game.js +++ b/public/javascripts/components/game.js @@ -413,9 +413,24 @@ Vue.component('my-game', { { attrs: { id: "pgn-game" }, on: { click: this.download }, - domProps: { - innerHTML: this.pgnTxt - } + domProps: { innerHTML: this.pgnTxt } + } + ) + ] + ) + ); + } + else if (this.mode != "idle") + { + // Show current FEN (at least for debug) + elementArray.push( + h('div', + { attrs: { id: "fen-div" } }, + [ + h('p', + { + attrs: { id: "fen-string" }, + domProps: { innerHTML: this.vr.getBaseFen() } } ) ] @@ -432,14 +447,14 @@ Vue.component('my-game', { "col-lg-6":true, "col-lg-offset-3":true, }, - // NOTE: click = mousedown + mouseup --> what about smartphone?! + // NOTE: click = mousedown + mouseup on: { mousedown: this.mousedown, mousemove: this.mousemove, mouseup: this.mouseup, - touchdown: this.mousedown, - touchmove: this.mousemove, - touchup: this.mouseup, +// touchstart: this.mousedown, //TODO... +// touchmove: this.mousemove, +// touchend: this.mouseup, }, }, elementArray @@ -736,6 +751,19 @@ Vue.component('my-game', { }, mousedown: function(e) { e = e || window.event; + let ingame = false; + let elem = e.target; + while (!ingame && elem !== null) + { + if (elem.classList.contains("game")) + { + ingame = true; + break; + } + elem = elem.parentElement; + } + if (!ingame) //let default behavior (click on button...) + return; e.preventDefault(); //disable native drag & drop if (!this.selectedPiece && e.target.classList.contains("piece")) {