I'm trying to build a Webpage that senses the touch from the user and drags and object along the canvas.
So I'm doing something like this:
var touchStart = function(e) {
e.preventDefault();
// Do stuff
}
var touchMove = function(e) {
e.preventDefault();
console.log("Touch move");
// Move objs
}
var touchEnd = function(e) {
e.preventDefault();
console.log("Touch start!");
// clean up stuff
}
var touchCancel = function(e) {
e.preventDefault();
// Oh NO touch cancel!
console.log("Touch cancel!");
}
bindElemOrig.addEventListener('touchstart', touchStart, false);
bindElemOrig.addEventListener('touchmove', touchStart, false);
bindElemOrig.addEventListener('touchend', touchStart, false);
bindElemOrig.addEventListener('touchcancel', touchStart, false);
It works fine until some point.
The problem is that as soon as I load too many objs, it seems to me that the touchmove takes too long to respond, and touchcancel gets triggered. The problem is that as soon as touchcancel get triggered I don't receive any more touchmoves events, and I cannot sense the movement anymore.
Did anyone face this problem? I know about the bug in Android where you must call preventDefault (touchend event in ios webkit not firing?) but on this case it seems that it is not working because of the memory burden.
Thank you!