User Tools

Site Tools


gesture_names

Editing Gesture Event Types

Gesture names

By default gesture event names are pulled from the gesture “type” in the “gesture event” tag. for example this gesture will return a gesture of type DRAG:

<Gesture id="2-finger-drag" type="drag">                                       
    <match>
        <action>
            <initial>
                <cluster point_number="2"/>
            </initial>
        </action>
    </match>       
    <analysis>
        <algorithm class="kinemetric" type="continuous">
            <library module="drag"/>
            <returns>
                <property id="dx" result="dx"/>
                <property id="dy" result="dy"/>
            </returns>
        </algorithm>
    </analysis>    
    <mapping>
        <update dispatch_type="continuous">
            <gesture_event type="drag">
                <property ref="dx" target=""/>
                <property ref="dy" target=""/>
            </gesture_event>
        </update>
    </mapping>
</Gesture>

Gesture objects may require their own custom gesture event name in an application. To create custom event name define the “type” in the “gesture event” tag as “custom” for example:

<Gesture id="my_custom_event_name" type="drag">                                
    <match>
        <action>
            <initial>
                <cluster point_number="2"/>
            </initial>
        </action>
    </match>       
    <analysis>
        <algorithm class="kinemetric" type="continuous">
            <library module="drag"/>
            <returns>
                <property id="dx" result="dx"/>
                <property id="dy" result="dy"/>
            </returns>
        </algorithm>
    </analysis>    
    <mapping>
        <update dispatch_type="continuous">
            <gesture_event type="custom">
                <property ref="dx" target=""/>
                <property ref="dy" target=""/>
            </gesture_event>
        </update>
    </mapping>
</Gesture>

This gesture will automatically use the gesture_id attribute as the gesture event type. A gesture event listener may be constructed as follows: touch_object.addEventListerner(GWGestureEvent.GML.MY_CUSTOM_EVENT_NAME, customEventHandlerFunction)

gesture_names.txt · Last modified: 2015/09/15 13:35 by glass