What’s this? #
Gesture Recognizer is a component that takes care of gesture recognition made by the user on the screen of a smartphone (I mean on the Touch Interface). It allows you to configure the types of gestures that will be recognized, their parameters and to send events when a gesture is detected. You can add this component to almost any class and you can theoretically add as many Gesture Recogizer as you want.
How to enable gesture recognition ? #
Go to Project Settings > Plugins > Touch Interface and in the Gestures category, check the Enable Gesture Recognizer setting. Then you just need to add the Gesture Recognizer component on a class where you want to bind a function to a gesture.
Gesture Recognizer Component Settings #
General
- Enable Two Finger Gesture : Enable two-finger gestures like zooming, rotating or two finger swipe. If disabled, allow detection of gestures for each finger separately.
- Multi Touch Behavior : Define behavior with multi touch (at least three finger on screen)
- Do Nothing : Two-finger gestures stopped.
- Keep Existing Index : Keep two first active finger.
- Keep First And Update Last : Keep first active finger and update second finger with last active finger.
- Update Both : Use last two active finger.
- Standalone Mode : Get touch input without touch interface.
Gesture Config
- Override Gesture Config : Allows the component to use a different configuration than exists in the plugin settings for gesture recognition.
- Gesture Config : A structure that contains all the parameters needed for gesture recognition. You can define which gesture will be recognized by modifying the bitflags. Select all the gestures you want to use.
Debug
- Show Debug : Activate or not the display of useful information for debugging.
How to get gestures events ? #
In the events part of the component, you just have to click on the event you want to retrieve. You can bind/unbind a function too if you want.
What gestures are recognized? #
The current algorithm in v2024.1 is able to recognize the following gestures :
- Tap : Called when finger hit screen.
- Double Tap : Called when the user tap twice.
- Multi Tap : Called when the user types several times.
- Long Press : Called when the user’s finger remains in contact with the touchscreen without moving for a specified time.
- On Drag Begin : Called when drag gesture is detected.
- On Drag : Called when the user’s finger move after drag gesture is detected. Can be called after Long Press gesture. See Send Drag After Long Press.
- On Drag End : Called at the end of drag whe the user’s finger leave the screen.
- Swipe : Called when user’s finger move rapidly in one direction.
- Slide : Called when user’s finger move in one direction.
- Zoom : Called when user spread or bring one’s fingers together (zoom in/out).
- Rotate : Called when user performs a rotational movement with his two fingers.
- Two Finger Tap : Called when user tap with two finger on touch screen.
- Two Finger Swipe : Called when two close fingers move rapidly in one direction.