How can I get e.offsetX on mobile/iPad
You can use clientX or pageX, see here
The correct answer based on the comments in the suggested answer:
e.offsetX = e.touches[0].pageX - e.touches[0].target.offsetLeft;
e.offsetY = e.touches[0].pageY - e.touches[0].target.offsetTop;
This ignores any transformations such as rotations or scaling. Also be sure to check if there are any touches.
Thanks, @Kontiki - this is the solution that finally fixed things for me:
if("touchmove" == e.type)
{
let r = canvas.getBoundingClientRect();
currX = e.touches[0].clientX - r.left;
currY = e.touches[0].clientY - r.top;
}
else
{
currX = e.offsetX;
currY = e.offsetY;
}