# Recognize/handle pinch gesture

**URL:** <https://discourse.processing.org/t/recognize-handle-pinch-gesture/11867>\
**Category:** Processing for Android\
**Created:** [June 5, 2019, 5:21pm UTC](https://discourse.processing.org/t/recognize-handle-pinch-gesture/11867 "2019-06-05T17:21:02Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ottenm](https://avatars.discourse-cdn.com/v4/letter/o/f08c70/32.png) [@ottenm](https://discourse.processing.org/u/ottenm)\
**Post date:** [June 5, 2019, 5:21pm UTC](https://discourse.processing.org/t/recognize-handle-pinch-gesture/11867/1 "2019-06-05T17:21:02Z")

</div>

Any short/easy path to handling a pinch gesture (zoom in/zoom out)?  
Java mode, Processing 3.3.7, running on a Windows 10 laptop with a touch screen.

Tried:

1. Rolling my own. But mousePressed/Dragged/Released doesn’t get called on pinch (only on single mouse down/drag/release).

2. Register TouchEvent (compiles, but never calls touchEvent()):  
`void setup() {
registerMethod(“touchEvent”, this);
}
void draw() { }
public void touchEvent(TouchEvent event) {
println(“hello?”);
}`

3. SMT Simple Multi-Touch examples choke on init() (PApplet$7 can’t be cast to a JFrame).

4. Leap Motion Library: LM\_2\_Gestures example runs, but never calls handlers for swipe/circle/tap.

Thanks for any help!

---

<div class="post-metadata">

**Author:** ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)\
**Post date:** [June 7, 2019, 9:56pm UTC](https://discourse.processing.org/t/recognize-handle-pinch-gesture/11867/2 "2019-06-07T21:56:38Z")

</div>

I believe that SMT is for Processing 2. You could try downloading Processing 2 and running it with that…?

I’m not sure about touchEvent. It isn’t listed here:

- [https://github.com/processing/processing/wiki/Library-Basics](https://github.com/processing/processing/wiki/Library-Basics)

but is listed here:

- [http://processing.github.io/processing-javadocs/core/processing/core/PApplet.html#registerMethod-java.lang.String-java.lang.Object-](http://processing.github.io/processing-javadocs/core/processing/core/PApplet.html#registerMethod-java.lang.String-java.lang.Object-)

…perhaps open an issue?

However both SMT and Ketai have notes in their code indicating that registerMethod(“touchEvent”, this) is not working – although these seem to be Processing 2 era.

- [https://vialab.science.uoit.ca/smt/javadoc/vialab/SMT/SMT.html#passAndroidTouchEvent-java.lang.Object-](https://vialab.science.uoit.ca/smt/javadoc/vialab/SMT/SMT.html#passAndroidTouchEvent-java.lang.Object-)
- [https://github.com/ketai/ketai/blob/master/src/ketai/ui/KetaiGesture.java#L65](https://github.com/ketai/ketai/blob/master/src/ketai/ui/KetaiGesture.java#L65)

---

<div class="post-metadata">

**Author:** ![agustin](https://avatars.discourse-cdn.com/v4/letter/a/47e85d/32.png) [@agustin](https://discourse.processing.org/u/agustin)\
**Post date:** [October 16, 2021, 11:09pm UTC](https://discourse.processing.org/t/recognize-handle-pinch-gesture/11867/3 "2021-10-16T23:09:08Z")

</div>

Hi! Could you find any way to get a multitouch event in P3??

---

<div class="post-metadata">

**Author:** ![shedMusic](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/shedmusic/32/601_2.png) [@shedMusic](https://discourse.processing.org/u/shedMusic)\
**Post date:** [October 17, 2021, 1:18pm UTC](https://discourse.processing.org/t/recognize-handle-pinch-gesture/11867/4 "2021-10-17T13:18:26Z")

</div>

Is this to run on Android or your Win10 device?
