Detect the speed of a gesture

Dec 6, 2011 at 8:50 AM

Hi all,

I am really impressed with this toolkit, so my thanks goes out to those that created it :)

I was wondering if anyone had any suggestions on how I might go about detecting the speed of a gesture? I want to use swiping for scrolling, and like with a touch-screen phone, the faster you swipe the more the content will get scrolled. If it's not something built in to the toolkit I may look at adding it, but i thought I'd post here in case anyone had done it before.

 

Thanks,

 

Marc

Dec 6, 2011 at 9:26 AM

Well I thought I would try and add something in anyway, I'd be grateful if anyone would have any comments - I'm not that familiar with the toolbox so there might be better ways of doing it.

In SwipeGestureDetector's ScanPositions method I use an out paramater to get the total miliseconds from the start, and just before the return true I assign it (otherwise I output null). I have then changed OnGestureDetected to take in an EventArgs object that has two proeprties, a string for the gesture name, and a nullable double for the length. I've not tried to implement this for the TemplatedGestures class yet, this passes null for the length.

 

It seems to work, I get a value between about 260ms and 900 depending on my speed. Of course I am happy to share the code if anyone wants it :)

Dec 6, 2011 at 10:46 AM

I'm interested :)

Dec 8, 2011 at 7:19 AM

I'm interested too =)

Jan 22, 2014 at 12:10 PM
Hi

Im trying to do something similar in my project. Is it possible to share the code.

thanks