Creating new Gestures

A gesture definition has three sections:
  • A name that uniquely identifies a definition within the application,
  • One or more validate blocks that contain combination of primitive conditions, and
  • A return block that contains one or more return types.
Following is the structure a gesture definition:

name: <gesture name>

<primitive conditions>
<return types>
Let’s consider a scenario where a user may use a lasso gesture to select some objects from a scattered collection of objects.

To detect the lasso gesture, we need to check the following conditions:
  • Is this the last action of current touch stroke? The gesture should be evaluated when the touch stroke ends. (e.g. on touch release/touch up event)
  • Does the collection of points in the specific touch stoke represent a closed loop?
  • Is the area of the bounding box and the length of the path within a certain limit?
  • Only one touch should be involved in this gesture. If multiple active touch points are available then it should consider each point individually.

Primitive conditions are the smallest part of the language. we use these primitive conditions to define the validation rules of any gesture. The full set of primitive types that are currently available out of the box are listed here. However, you can also create your won primitive conditions. Following the code that defines the lasso gesture. The italicized words in the following code are the primitive types.

name: Lasso

Touch state: TouchUp and
Touch limit: 1 and
Closed loop and
Touch path bounding box: 200x200..1000x1000 and
Enclosed area:5000..100000
Touch paths

Last edited Oct 25, 2010 at 4:16 AM by shahed, version 7


No comments yet.