Skip to content

Commit

Permalink
no need to have a separate function to call the user multihand function
Browse files Browse the repository at this point in the history
  • Loading branch information
jairajs89 committed Feb 5, 2012
1 parent b0becde commit e8e00aa
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 22 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## Touchy.js
### Because some things just need to be touched.

Touchy.js is a simple light-weight (1.16 kb compressed) JavaScript library for dealing with touch events in the browser. With no dependencies, just add the script to your page and start hacking.
Touchy.js is a simple light-weight (1.15 kb compressed) JavaScript library for dealing with touch events in the browser. With no dependencies, just add the script to your page and start hacking.


## Quick example
Expand Down
24 changes: 11 additions & 13 deletions touchy.js
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,7 @@
multiHandRestart(remainingTouches);
}

/* Create a new hand based on the current touches on the screen */
function multiHandRestart (touches) {
if (touches.length == 0) {
return;
Expand All @@ -378,7 +379,15 @@
multiHand.add(finger);
});

multiHandFunc();
var func = settings[ {
1: 'one',
2: 'two',
3: 'three',
4: 'four',
5: 'five'
}[ multiHand.fingers.length ] ];

func && func.apply(window, [multiHand].concat(multiHand.fingers));

forEach(newFingers, function (data) {
data[0].trigger('start', data[1]);
Expand All @@ -387,6 +396,7 @@
multiHand.trigger('start', touches);
}

/* Destroy the current hand regardless of fingers on the screen */
function multiHandDestroy () {
if ( !multiHand ) {
return;
Expand All @@ -405,18 +415,6 @@

multiHand = null;
}

function multiHandFunc () {
var func = settings[ {
1: 'one',
2: 'two',
3: 'three',
4: 'four',
5: 'five'
}[ multiHand.fingers.length ] ];

func && func.apply(window, [multiHand].concat(multiHand.fingers));
}
};


Expand Down
16 changes: 8 additions & 8 deletions touchy.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e8e00aa

Please sign in to comment.