Skip to content

Instantly share code, notes, and snippets.

@heapwolf
Created October 13, 2010 23:16
Show Gist options
  • Select an option

  • Save heapwolf/625161 to your computer and use it in GitHub Desktop.

Select an option

Save heapwolf/625161 to your computer and use it in GitHub Desktop.
var gesture = {
delta: {
X: 0,
Y: 0,
T: 0
},
start: {
X: 0,
Y: 0,
T: 0,
Z: 0
},
touch: null,
move: null,
swipe: { direction: null },
drag: false,
update: function(event) {
this.touch = event.changedTouches[0] || null;
this.delta.X = this.touch.pageX - this.start.X;
this.delta.Y = this.touch.pageY - this.start.Y;
this.delta.T = (new Date).getTime() - this.start.T;
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment