[PLUGIN] Multi Touch

Post your completed addons to share with the community

Post » Sun Feb 26, 2012 8:03 pm

Multi Touch

This is a modified version of the standard Touch plugin, to support Multi Touch.
It works on iPhone, iPad and my android tablet, but on my android phone the native browser pinch/zoom is used and I never see more than 1 touch. If you know why, please tell me :)

It adds one event: Touch move (when the finger moves)

It adds 3 expressions:
- TouchCount: the number of touches (fingers touching the screen)
- TouchX(n,[layer]): the X coordinate for touch number n
- TouchY(n,[layer]): the Y coordinate for touch number n

layer parameter is optional, like for the original Touch.X and Touch.Y
(not tested)

capx example, with "pinch to zoom" and "drag to pan".

TouchX(0) will be the X coordinate for the first touch
TouchX(1) will be the X coordinate for the second touch
yumyum2012-02-26 20:32:18
B
15
S
7
G
1
Posts: 10
Reputation: 1,445

Post » Sun Feb 26, 2012 8:13 pm

Great! I was wondering how to do a pinch to zoom!
B
29
S
12
G
7
Posts: 740
Reputation: 7,839

Post » Wed Feb 29, 2012 2:21 am

If your Android phone is running any version < 3.0 multi touch events are not passed to the HTML page. Pinch to zoom will work because it's actually processed by the browser application and not the page.

After Android 3.0 they supposedly fixed this. I say supposedly since I do not have any Android devices running the newer versions to be able to personally test on. I ran into this problem about a year back with another HTML based game engine.basspenguin2012-02-29 02:22:46
B
37
S
9
G
7
Posts: 143
Reputation: 6,017

Post » Wed Feb 29, 2012 6:14 am

Ah ok that explains it.
Yes it seems to work after Android 3.0, I tried on my tablet.
B
15
S
7
G
1
Posts: 10
Reputation: 1,445

Post » Wed Feb 29, 2012 8:27 am

Thank you so much for this, it works great on the ipad and now I have two player controls on the same screen! Your awesome!
Dreamgenedesign.com
B
97
S
3
G
3
Posts: 5
Reputation: 6,509

Post » Wed May 23, 2012 2:00 am

This plugin is awesome, thank you so much!

One note on a change I made to your drag-to-pan events. It's probably already on the forums somewhere but I'll put it here in case drag-to-pan searchers find this thread first :)

In the original, if you drag, let go, then touch and drag again, the window will pop back to the center. If you want to retain the new window position (so you can keep dragging with multiple gestures without it resetting) make these changes:

Make 2 new variables (I just called them StartingPositionX and StartingPositionY) and at layout start set them to WindowWidth/2 and WindowHeight/2 as default values. Use those in the Scroll To action, then on touch end, update those positions to where you've scrolled to.

Basically change this:


To this:
B
9
S
2
Posts: 87
Reputation: 1,051

Post » Sat Jul 21, 2012 1:27 am

basspenguin gave the correct background info - there is an enabler for multitouch on 2.x: https://github.com/Philzen/webview-multitouch-polyfill

Of course that will only work if you have control over your app container and are willing to provide one on the market for your 2.x users.

Would love to hear if one could get your plugin to work with WMP on 2.x
B
2
Posts: 4
Reputation: 258

Post » Wed Aug 01, 2012 5:18 pm

Is there any way to get absolute position of nth finger?
Cheers guysmaxp0102012-08-01 17:19:23
B
14
S
3
G
4
Posts: 32
Reputation: 2,654

Post » Thu Aug 23, 2012 12:00 pm

Hey,

this is nice tool and very useful too,
but I have one question, dose this works on windows 7 mobile?
B
6
S
2
G
3
Posts: 5
Reputation: 2,395

Post » Fri Aug 31, 2012 4:43 pm

@yumyum can you create double tap touch plugin just like double click of mouse button ?
B
93
S
19
G
34
Posts: 1,840
Reputation: 27,963

Next

Return to Completed Addons

Who is online

Users browsing this forum: No registered users and 2 guests