User Tools

Site Tools


gestures:touch:simple:temporal:double-tap:n-double-tap

N-Double-Tap

(Touch → Temporal → Double-Tap → Simple N Point Double Tap Gesture)

In the example below the “n-double_tap” gesture counts the number of double tap events that occur in a 500ms interval and returns a double tap “batch” gesture.

The “event_duration_max” attribute of the <point> tag is used as the primary matching criteria for this gesture. It sets the maximum allowable time between touchBegin and touchEnd events. The next criteria is the “translation_max” value. In this case the difference in position between the touchBegin and touchEnd events must be less than 20 pixels otherwise a TAP gesture event is not registered. The final criteria used is the “interevent_duration_max” attribute. This defines the maximum allowable time between successive TAP events. If the amount of time between tap events is less than 300ms then the gesture can enter the <analysis> block.

In this example the “n-double_tap” gesture object has three dimensions “double_tap_x”, “double_tap_y” and “double_tap_n”. These values are calculated by the temporalmetric and an values returned to the gesture object dimension. The “double_tap_x” and “double_tap_y” values represent the average position of the series of TAP events that make up and DOUBLE TAP gesture action. Any touch points or TAP events that break the matching criteria are not included in this calculation.

The “point_number” value represents the number of discrete DOUBLE TAP events that must be grouped into the gesture event batch. In this example the value is set to zero so all double tap events are collected then dispatched as a singular event/update.

In this example any number of double tap events that occur in the batch interval (200 ms window) will be collected and dispatched as an “n” double tap event where n is the total number of double tap events collected during the batch interval.

<Gesture id="n-double_tap" type="double_tap">
    <match>
        <action>
            <initial>
                <point event_duration_max="300" interevent_duration_max="300" translation_max="20"/>
                <cluster point_number="0"/>
                <event gesture_event="tap"/>
            </initial>
        </action>
    </match>       
    <analysis>
        <algorithm class="temporalmetric" type="discrete">
            <library module="double_tap"/>
                <returns>
                    <property id="double_tap_x" result="x"/>
                    <property id="double_tap_y" result="y"/>
                    <property id="double_tap_n" result="n"/>
                </returns>
        </algorithm>
    </analysis>    
    <mapping>
        <update dispatch_type="discrete" dispatch_mode="batch" dispatch_interval="200">
            <gesture_event  type="double_tap">
                <property ref="double_tap_x"/>
                <property ref="double_tap_y"/>
                <property ref="double_tap_n"/>
            </gesture_event>
        </update>
    </mapping>
</Gesture>

In this example any number of double tap events that occur in the batch interval (300 ms window) will be collected and dispatched as an “n” double tap event where n is the total number of double tap events collected during the batch interval.

gestures/touch/simple/temporal/double-tap/n-double-tap.txt · Last modified: 2015/09/14 16:50 (external edit)