0

Can anybody tell me how to get touch coordinates in hammerjs? Following code is giving error:

hammerEvent.on('pan', (ev) => {
  console.log('x, y: ', ev.clientX, ev.clientY);
}
Mayank Kataria
  • 870
  • 2
  • 12
  • 22
  • try ev.deltaX, ev.deltaY – Haydar C. Nov 16 '20 at 11:47
  • @AhbapAldirmaz They are not touch coordinates. – Mayank Kataria Nov 16 '20 at 11:49
  • Inside the ev object there is a PointerEvent named changedPointers. There are clientX and clientY values. ev.changedPointers[0].clientX, ev.changedPointers[0].clientY, Look at this. – Haydar C. Nov 20 '20 at 02:43
  • Yes but only one touch coordinate is coming. You touch screen with four fingers than also length of changedPointers is 1 only. I think its a bug. – Mayank Kataria Nov 20 '20 at 09:55
  • Any luck for this? ev.changedPointers[0].clientX, ev.changedPointers[0].clientY, values of these to properties jump sometimes. Like 1 instance it was 325...326...327...410 Which property gives the exact cords? – Jivan Jun 18 '21 at 11:00

0 Answers0