User Tools

Site Tools


gestures:touch:advanced:gesture-filtering:n-drag-inertia

N-Drag-Inertia

(Touch → Advanced → Gesture Filtering → N Point Drag Gesture With Inertial Filter “N-Drag-Inertia”)

This gesture allows for any “n” number of touch points between 1 and 10. The n-drag-inertia gesture analyzes the motion of the touch point cluster and returns the translation in the x and y direction “dx” and “dy”. Two filters are added to each gesture dimension, a inertial filter and a delta filter.

The inertial filter has the effect of caching the results and then returning values that exponentially decays. This value is then pushed into the delta filter. In the delta filter, when the return value is equal to or below the delta min value (0.5) the return value is set to zero.

The values in each dimension are then mapped to x and y in the gesture event update. This has the cumulative effect of “easing” the motion of the touch object once matching criteria is broken (number of touch points equals zero or more than 10).

<Gesture id="n-drag-inertia" type="drag">
    <match>
        <action>
            <initial>
                <cluster point_number="0" point_number_min="1" point_number_max="10"/>
            </initial>
        </action>
    </match>       
    <analysis>
        <algorithm class="kinemetric" type="continuous">
            <library module="drag"/>
            <returns>
                    <property id="drag_dx" result="dx"/>
                    <property id="drag_dy" result="dy"/>
            </returns>
        </algorithm>
    </analysis>    
    <processing>
        <inertial_filter>
            <property ref="drag_dx" active="true" friction="0.9"/>
            <property ref="drag_dy" active="true" friction="0.9"/>
        </inertial_filter>
        <delta_filter>
            <property ref="drag_dx" active="true" delta_min="0.5" delta_max="500"/>
            <property ref="drag_dy" active="true" delta_min="0.5" delta_max="500"/>
        </delta_filter>
    </processing>
    <mapping>
        <update dispatch_type="continuous">
            <gesture_event type="drag">
                <property ref="drag_dx" target="x"/>
                <property ref="drag_dy" target="y"/>
            </gesture_event>
        </update>
    </mapping>
 </Gesture>
gestures/touch/advanced/gesture-filtering/n-drag-inertia.txt · Last modified: 2015/09/14 19:25 by glass