From 87b085d76506ed72d0a289d4a940a1cf8f772f08 Mon Sep 17 00:00:00 2001 From: Mahdi Dibaiee Date: Sun, 2 Feb 2014 13:34:02 +0330 Subject: [PATCH] touch and mouse --- js/main.js | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/js/main.js b/js/main.js index 4445c48..47c76a0 100644 --- a/js/main.js +++ b/js/main.js @@ -31,22 +31,16 @@ $(document).ready(function() { window.active = false; }).bind('touchstart', function(e) { e.preventDefault(); - - for( var i = 0, len = e.changedTouches.length; i < len; i++ ) { - var touch = e.changedTouches[i]; - var xy = relative(touch.pageX, touch.pageY); - startPoint(xy.x, xy.y); - } + var touch = e.changedTouches[0]; + var xy = relative(touch.pageX, touch.pageY); + startPoint(xy.x, xy.y); window.active = true; }).bind('touchmove', function(e) { e.preventDefault(); if(!window.active || settings.type =='line') return; - - for( var i = 0, len = e.changedTouches.length; i < len; i++ ) { - var touch = e.changedTouches[i]; - var xy = relative(touch.pageX, touch.pageY); - drawPoint(xy.x, xy.y); - } + var touch = e.changedTouches[0]; + var xy = relative(touch.pageX, touch.pageY); + drawPoint(xy.x, xy.y); window.active = true; })