projects
/
xogo.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
e5cea9c
)
Trying to prevent horizontal swipe effect on smartphones (Chrome)
author
Benjamin Auder
<benjamin.auder@somewhere>
Fri, 19 Nov 2021 00:38:01 +0000
(
01:38
+0100)
committer
Benjamin Auder
<benjamin.auder@somewhere>
Fri, 19 Nov 2021 00:38:01 +0000
(
01:38
+0100)
base_rules.js
patch
|
blob
|
blame
|
history
diff --git
a/base_rules.js
b/base_rules.js
index
5717276
..
a39cc0a
100644
(file)
--- 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)
// Touch screen, dragend
touchLocation = e.changedTouches[0];
if (touchLocation)
- return {x: touchLocation.
pageX, y: touchLocation.page
Y};
+ return {x: touchLocation.
clientX, y: touchLocation.client
Y};
return [0, 0]; //Big trouble here =)
}
return [0, 0]; //Big trouble here =)
}
@@
-909,6
+909,9
@@
export default class ChessRules {
e.preventDefault();
centerOnCursor(curPiece, e);
}
e.preventDefault();
centerOnCursor(curPiece, e);
}
+ else if (e.changedTouches && e.changedTouches.length >= 1)
+ // Attempt to prevent horizontal swipe...
+ e.preventDefault();
};
const mouseup = (e) => {
};
const mouseup = (e) => {
@@
-949,6
+952,7
@@
export default class ChessRules {
document.addEventListener("touchmove", mousemove, {passive: false});
document.addEventListener("touchend", mouseup, {passive: false});
}
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) {
}
showChoices(moves, r) {