0
Guys how do i get the clientX and clientY in this code
I tought it was e.clientX but not working cvs.addEventListener('touchstart',(e)=>{ console.dir(e) console.log(e.clientX) })
2 Answers
+ 3
e.touches[0].clientX
TouchEvent is different from MouseEvent. For MouseEvent, only one target; For TouchEvent, more than one target.
So need to get the first touch target from touches with [0]
+ 2
Use pointerdown instead of touchstart