Reputation: 647
I am using a plugin for drawing inside canvas element. It functions properly for desktops. For mobiles there is a bug. I will try to describe it. When you have for example 2 touchpoints (one after another but the switching happens immediately, with two fingers i mean) it functions incorrectly. It draws a straight line which connects the two touchpoints instead of simply drawing 2 separated points. I tried different plugins but the issue exists in all of them.
Please, check this out with mobile if its possible and i think you will notice the bug i told above.
http://literallycanvas.com/index.html
How can i solve this?
Upvotes: 2
Views: 86
Reputation: 1889
For example you can check if count of touches > 1 (double touch or more ) just stop drawing something like this
canvas.addEventListener('touchmove', function(e) {
e.preventDefault();
var a = (e.touches.length > 1) ? true : false;
if (a) {
drawing = false;
return;
}
// draw your lines
});
Upvotes: 2