gesture-recognition

How to differentiate between a fling and a touch?

雨燕双飞 提交于 2019-12-03 07:58:24
问题 I have a ListView inside of a ViewFlipper which I am flipping when the user swipes across the screen. Clicking on a ListView will open the browser. Sometimes when I am swiping, it gets detected as a touch on the ListView and will open the browser. This can be annoying. How can I prevent this from happening? class MyGestureDetector extends SimpleOnGestureListener { @Override public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) { try { if (Math.abs(e1.getY()

How to do pinch gestures on the iPhone?

拜拜、爱过 提交于 2019-12-03 06:10:10
问题 How does one implement pinch gestures on the iPhone? I'm familiar with using touch events on the iPhone but I'm extremely lazy and don't want to re-invent the wheel for something as widespread as PINCH gestures...Source code or links thereto would be helpful. 回答1: You need to implement it yourself using some basic math. (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event; (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event; Those are the delegate methods that you need to

How to access Letter Recognizer API in Android?

江枫思渺然 提交于 2019-12-03 05:57:10
问题 I am creating a gesture application. In the Gesture class docs http://developer.android.com/reference/android/gesture/Gesture.html) it reads: "A user-defined gesture can be recognized by a GestureLibrary and a built-in alphabet gesture can be recognized by a LetterRecognizer ." So how do you use the LetterRecognizer and where is the docs on it? There's no API for that in the docs, I've also searched android's code itself, and besides the same comment above in the code there's nothing. I've

Recognizing patterns when drawing over the iPhone screen

不打扰是莪最后的温柔 提交于 2019-12-03 03:55:23
I'm trying to write a game where the user can issue commands by drawing certain patterns with his fingers..for example, if he draws a circle, an 'S' letter, an expiral, etc. I'm already familiar with touch events and I'm capable of reading the coordinates... my problem Is in finding algorithms and information about the recognition of the patterns with some degree of error.... for example, If I'm supposed to detect a circle I should detect it even if the user didn't did a make perfect one. Any resources in the matter?, thanks ! This site demos a very simple, easy to implement gesture recognizer

How to recognize continuous touch in Swift?

折月煮酒 提交于 2019-12-03 01:26:53
How can I recognize continuous user touch in Swift code? By continuous I mean that the user has her finger on the screen. I would like to move a sprite kit node to the direction of user's touch for as long as the user is touching screen. The most difficult thing about this process is tracking single touches within a multitouch environment. The issue with the "simple" solution to this (i.e., turn "istouched" on in touchesBegan and turn it off in touchesEnded ) is that if the user touches another finger on the screen and then lifts it, it will cancel the first touch's actions. To make this

Two-finger rotation gesture on the iPhone?

那年仲夏 提交于 2019-12-03 00:51:03
I'm working on an iPhone app with a lot of different gesture inputs that you can do. Currently there is single finger select / drag, two finger scroll, and two finger pinch zoom-in / zoom-out. I want to add in two finger rotation (your fingers rotate a point in between them), but I can't figure out how to get it to work right. All the other gestures were linear so they were only a matter of using the dot or cross product, pretty much. I'm thinking I've got to store the slope between the previous two points of each finger, and if the angle between the vectors is near 90, then there is the

Do I need to release a gesture recognizer?

北城以北 提交于 2019-12-02 22:12:29
If I add a gesture recognizer to a table cell called cell , e.g.: UILongPressGestureRecognizer *_longPressRecognizer = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(cellGestureRecognized:)]; _longPressRecognizer.allowableMovement = 20; _longPressRecognizer.minimumPressDuration = 1.0f; [cell addGestureRecognizer:_longPressRecognizer]; [_longPressRecognizer release], _longPressRecognizer = nil; Do I need to manually call -removeGestureRecognizer: on this cell at some point, or does the gesture recognizer get removed and released for me when the cell is no longer used

How to differentiate between a fling and a touch?

心不动则不痛 提交于 2019-12-02 21:26:14
I have a ListView inside of a ViewFlipper which I am flipping when the user swipes across the screen. Clicking on a ListView will open the browser. Sometimes when I am swiping, it gets detected as a touch on the ListView and will open the browser. This can be annoying. How can I prevent this from happening? class MyGestureDetector extends SimpleOnGestureListener { @Override public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) { try { if (Math.abs(e1.getY() - e2.getY()) > SWIPE_MAX_OFF_PATH) return false; // right to left swipe if (e1.getX() - e2.getX() >

How to do pinch gestures on the iPhone?

*爱你&永不变心* 提交于 2019-12-02 20:48:53
How does one implement pinch gestures on the iPhone? I'm familiar with using touch events on the iPhone but I'm extremely lazy and don't want to re-invent the wheel for something as widespread as PINCH gestures...Source code or links thereto would be helpful. Brock Woolf You need to implement it yourself using some basic math. (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event; (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event; Those are the delegate methods that you need to implement in your application. You need to get the distance between the two touches, then

How to access Letter Recognizer API in Android?

时光总嘲笑我的痴心妄想 提交于 2019-12-02 19:19:45
I am creating a gesture application. In the Gesture class docs http://developer.android.com/reference/android/gesture/Gesture.html ) it reads: "A user-defined gesture can be recognized by a GestureLibrary and a built-in alphabet gesture can be recognized by a LetterRecognizer ." So how do you use the LetterRecognizer and where is the docs on it? There's no API for that in the docs, I've also searched android's code itself, and besides the same comment above in the code there's nothing. I've implemented a letter recognizer manually by drawing the ABC letters to a gesture raw file and using the