B4i Library GestureRecognizer - Native UIGestureRecognizer

Hi,

Added a small project with examples. There are simple ones, you need to hook up them per your needs.


This is a wrapper of UIGestureRecognizer.
All the gesture are supported: Tap, LongPress, Swipe, Pinch, Rotation, Pan, Screen Edge Pan.

See attached example. All the info in the project

Enjoy

Narek

UPDATED: Version 1.1

- getting the X and Y for all the gestures.


UPDATED: Version 1.2

-New function to get the center of a view and to set it
 

Attachments

  • GestureRecognizer.bas
    11.1 KB · Views: 414
  • GestureRecognizer.zip
    5.5 KB · Views: 477
Last edited:

kc1

Member
Licensed User
Longtime User
Narek,

Thank you for the example! I'll give it a try later.

In the mean time, I noticed the version number in GestureRecognizer.bas was not updated to 1.2. It still says 1.1 although the content is different than the one in the example. I thought I'd mention this in case you meant to change the version number but forgot to do so :)

Thank you once again!

KC
 

dbalman

Member
Licensed User
Longtime User
I added a small project with examples (see first post)

Great Library! Thanks for sharing it. How would I add just a touch event that fires when the view is touched - no matter what gesture may or may not be being used?
 

JackKirk

Well-Known Member
Licensed User
Longtime User
I was having some troubles coming to grips with narek's class so I spent a day tidying it up and netting it down to its bare essentials.

I changed the example wrapper so that I could individually analyse how each gesture was handled.

I then added a mashup example of all gestures to the example wrapper with some simple ideas as to how to avoid gesture "collisions".

I've asked narek if he would mind my publishing this effort - he was positive with the caveat that I change the classes name to avoid confusion.

Please find the XGestureRecognizer class with example wrapper attached.

The example wrapper has the mashup exposed by default - there are simple instructions in the example wrapper that allow you to expose the individual gesture examples instead.
 

Attachments

  • XGestureRecognizer.zip
    7.5 KB · Views: 50
Last edited:

iCAB

Well-Known Member
Licensed User
Longtime User
Hi Guys

I am just wondering if anyone else is facing issues with this class.
Tap event not raised all the time ( in my case on average, 1 out of 10 fails)

In particular to be more specific, I am trying to simulate touch panel up event.
By pressing down on a panel and releasing after few seconds.

Thanks in advance
 

Moncai

Member
Licensed User
Longtime User
Narek, thank you for making this wrapperclass, saves a lot of work! I had to make minor adjustments to make it work and I'd like to share my two bugfixes:

B4X:
Private Const mSwipeDirectionLeft=2
Everywhere you use "Private Const", the editor advises it is implicitly typed as string, so I added "As Int".
B4X:
Private Const mSwipeDirectionLeft As Int = 2

And also
B4X:
Type LongPress_Attributes(NumberOfTaps As InputStream, NumberOfTouch As Int, X As Float, Y As Float, Obj As Object)
InputStream should be Int
B4X:
Type LongPress_Attributes(NumberOfTaps As Int, NumberOfTouch As Int, X As Float, Y As Float, Obj As Object)
 
Top