X-Git-Url: https://git.auder.net/?p=xogo.git;a=blobdiff_plain;f=base_rules.js;h=a39cc0a835b54e0598fbf44005aa71ecbd327b92;hp=5717276b0cee3ee4e46eb706bc7f1d3029ddfc47;hb=11625344340edd1519ef27b886c1f3b7b9b22804;hpb=e5cea9ca0c427305223cf75b2df6a533e640510f diff --git a/base_rules.js b/base_rules.js index 5717276..a39cc0a 100644 --- a/base_rules.js +++ b/base_rules.js @@ -859,7 +859,7 @@ export default class ChessRules { // Touch screen, dragend touchLocation = e.changedTouches[0]; if (touchLocation) - return {x: touchLocation.pageX, y: touchLocation.pageY}; + return {x: touchLocation.clientX, y: touchLocation.clientY}; return [0, 0]; //Big trouble here =) } @@ -909,6 +909,9 @@ export default class ChessRules { e.preventDefault(); centerOnCursor(curPiece, e); } + else if (e.changedTouches && e.changedTouches.length >= 1) + // Attempt to prevent horizontal swipe... + e.preventDefault(); }; const mouseup = (e) => { @@ -949,6 +952,7 @@ export default class ChessRules { document.addEventListener("touchmove", mousemove, {passive: false}); document.addEventListener("touchend", mouseup, {passive: false}); } + // TODO: onpointerdown/move/up ? See reveal.js /controllers/touch.js } showChoices(moves, r) {