Multi-Touch Gestures

Unlike the single touch gestures, which state which gesture you have just entered, the multi-touch gestures are events that fire whenever you have more than one finger on the touchscreen. The plugin tracks up to five contact points, if 6 or more are present they will simply be ignored by the plugin. The events the plugin listens to are gre.press, gre.release, and gre.motion to track the touchscreen info while only one finger is present and gre.mtpress, gre.mtrelease, and gre.mtmotion, to track the touchscreen info while multiple touches are present. Note when using a multi-touch enabled device single the press, release and motion events will be sent only while there is only one touch point present. As soon as there are multiple touch points present, all events will be mt events.

After listening to the events, if more than one touch point is present and one or more touch points move, the plugin will do an update where it compares the old touch locations to the updated touch locations and generates the related multi-touch gesture events. To determine how many fingers are currently being used to generate these events, there is an npoints field in the event data.

gre.mtmove

This event uses x_move and y_move to communicate the difference in x and y of the midpoint of all present touch touches between the current and last event sent from the touchscreen.

Data

uint32_t    button
uint32_t    timestamp
int16_t     subtype
int16_t     x
int16_t     y
int16_t     z
int16_t     id
int16_t     spare
float       value
float       x_move
float       y_move
int16_t     npoints
                    

Where:

x_move

The x difference between this event and last event

y_move

The x difference between this event and last event

npoints

The number of touch points used to generate this event

gre.mtpinch

This event uses the value data field, which will be the scale factor of the average spacing from all current touch points compared to the spacing of all the old touch points. The scale factor is calculated by newspacing/oldspacing, so a value of 1.1 indicates a growth of 10% and a value of 0.9 indicates a shrink of 10%

Data

uint32_t    button
uint32_t    timestamp
int16_t     subtype
int16_t     x
int16_t     y
int16_t     z
int16_t     id
int16_t     spare
float       value
float       x_move
float       y_move
int16_t     npoints
                    

Where:

value

The scale factor event

npoints

The number of touch points used to generate this event

gre.mtrotate

This event uses the value data field, which will be the difference in rotation between the average angle of all current touch points compared to the average angle of all the previous touch points. The value will be in degrees.

Data

uint32_t    button
uint32_t    timestamp
int16_t     subtype
int16_t     x
int16_t     y
int16_t     z
int16_t     id
int16_t     spare
float       value
float       x_move
float       y_move
int16_t     npoints
                    

Where:

value

The rotation difference event

npoints

The number of touch points used to generate this event

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments

0 comments

Article is closed for comments.