X-Git-Url: https://git.auder.net/pieces/Checkered/cp.svg?a=blobdiff_plain;f=client%2Fsrc%2Fcomponents%2FBoard.vue;h=0c12620b6f4b3fa0ab91eb0e5d8d8cbccdf935a0;hb=4b26ecb89dfd85ea1e5c664b0aedc5c11d41a635;hp=0f6bae3fd1f0e888afcb7edeaee1911b10c696da;hpb=1d06a8b9c4ba69bd56d9b08841fcd52b5ac409e9;p=vchess.git diff --git a/client/src/components/Board.vue b/client/src/components/Board.vue index 0f6bae3f..0c12620b 100644 --- a/client/src/components/Board.vue +++ b/client/src/components/Board.vue @@ -75,8 +75,6 @@ export default { 'class': { 'choice-piece': true }, on: { "click": e => { this.play(m); this.choices=[]; }, - // NOTE: add 'touchstart' event to fix a problem on smartphones - //"touchstart": e => { this.play(m); this.choices=[]; }, }, }) ] @@ -246,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: { -// mousedown: this.mousedown, -// mousemove: this.mousemove, -// mouseup: this.mouseup, touchstart: this.mousedown, touchmove: this.mousemove, touchend: this.mouseup, }, - }, + }; + } + else + { + onEvents = { + on: { + mousedown: this.mousedown, + mousemove: this.mousemove, + mouseup: this.mouseup, + }, + }; + } + return h( + 'div', + onEvents, elementArray ); },