User Tools

Site Tools


editing_hold_event_duration

Editing Hold Event Duration

The “event_duration_max” attribute of the “<point>” tag defines the maximum allowable time between touch point events. Similarly “event_duration_min” attribute defines the minimum amount of time between touch point events

In the example below event_duration_max=“200” is used to set a time between touchBegin and touchEnd event in the “n-tap” gesture. This means that ANY touchEnd event that occurs more than 200ms after a touchBegin event will not meet the matching criteria and therefor cannot be part of the TAP gesture.

<Gesture id="n-tap" type="tap">
    <match>
        <action>
            <initial>
                <point event_duration_max="200" translation_max="10"/>
                <cluster point_number="0" point_number_min="1" point_number_max="5"/>
                <event touch_event="touchEnd"/>
            </initial>
        </action>
    </match>       
    <analysis>
        <algorithm class="temporalmetric" type="discrete">
            <library module="tap"/>
            <returns>
                <property id="tap_x" result="x"/>
                <property id="tap_y" result="y"/>
                <property id="tap_n" result="n"/>
            </returns>
        </algorithm>
    </analysis>    
    <mapping>
        <update dispatch_type="discrete" dispatch_mode="batch" dispatch_interval="200">
            <gesture_event  type="tap">
                <property ref="tap_x"/>
                <property ref="tap_y"/>
                <property ref="tap_n"/>
            </gesture_event>
        </update>
    </mapping>
</Gesture>

In the example below event_duration_min=“500” is used to set a time between touchBegin and touchEnd event in the “n-hold” gesture. This means that ANY touchEnd event that occurs less than 500ms after a touchBegin event will not meet the matching criteria and therefor cannot be part of the HOLD gesture.

<Gesture id="n-hold" type="hold">
    <match>
        <action>
            <initial>
                <point event_duration_min="500" translation_max="2"/>
                <cluster point_number="0" point_number_min="1" point_number_max="5"/>
            </initial>
        </action>
    </match>      
    <analysis>
        <algorithm>
            <library module="hold"/>
            <returns>
                <property id="hold_x" result="x"/>
                <property id="hold_y" result="y"/>
                <property id="hold_n" result="n"/>
            </returns>
        </algorithm>
    </analysis>    
    <mapping>
        <update dispatch_type="discrete" dispatch_reset="cluster_remove">
            <gesture_event  type="hold">
                <property ref="hold_x"/>
                <property ref="hold_y"/>
                <property ref="hold_n"/>
            </gesture_event>
        </update>
    </mapping>
</Gesture>
editing_hold_event_duration.txt · Last modified: 2015/09/15 13:49 by glass