touch and mouse

This commit is contained in:
Mahdi Dibaiee 2014-02-02 13:34:02 +03:30
parent 41e87356fe
commit 87b085d765

View File

@ -31,22 +31,16 @@ $(document).ready(function() {
window.active = false; window.active = false;
}).bind('touchstart', function(e) { }).bind('touchstart', function(e) {
e.preventDefault(); e.preventDefault();
var touch = e.changedTouches[0];
for( var i = 0, len = e.changedTouches.length; i < len; i++ ) { var xy = relative(touch.pageX, touch.pageY);
var touch = e.changedTouches[i]; startPoint(xy.x, xy.y);
var xy = relative(touch.pageX, touch.pageY);
startPoint(xy.x, xy.y);
}
window.active = true; window.active = true;
}).bind('touchmove', function(e) { }).bind('touchmove', function(e) {
e.preventDefault(); e.preventDefault();
if(!window.active || settings.type =='line') return; if(!window.active || settings.type =='line') return;
var touch = e.changedTouches[0];
for( var i = 0, len = e.changedTouches.length; i < len; i++ ) { var xy = relative(touch.pageX, touch.pageY);
var touch = e.changedTouches[i]; drawPoint(xy.x, xy.y);
var xy = relative(touch.pageX, touch.pageY);
drawPoint(xy.x, xy.y);
}
window.active = true; window.active = true;
}) })