The problem is in the getCursorPos function - touchmove event does not have pageX and pageY - you need to take them from touches[0]. https://codepen.io/imhvost/pen/ZYbrqEZ?editors=1111
getCursorPos
touchmove
pageX
pageY
touches[0]