How to implement touch events on Canvas...
c.addEventListener("touchmove", on_touchmove, false);
c.addEventListener("touchstart", on_touchstart, false);
c.addEventListener("touchend", on_touchend, false);
...
var clicked = false;
function on_touchstart(ev) {
ev.preventDefault();
Mouse.x = ev.touches[0].pageX;
Mouse.y = ev.touches[0].pageY;
cliced = true;
}
function on_touchmove(ev) {
ev.preventDefault();
Mouse.x = ev.touches[0].pageX;
Mouse.y = ev.touches[0].pageY;
}
function on_touchend(ev){
clicked = false;
}
Geen opmerkingen:
Een reactie posten