User Tools

Site Tools


gestures:touch:complex:velocity-direction:n-scroll

N-Scroll

(Touch → Complex → Velocity & Direction → Simple N Point Scroll Gesture “N-Scroll”)

The 'n-scroll' gesture can be activated by any number of touch points. When a touch down is recognized on a touch object, the velocity and acceleration of the touch points are tracked. If velocity of the cluster is above the translation threshold a scroll event is dispatched.

The value returned in each dimension is temporal mean average of the touch point velocities over set of processing frames as denoted by “etm_dx” and “etm_dy”. This has the effect of evening out changes in the values to that they can be mapped to display object and present smoothed continuous motion.

In the <analysis> block the <variables> tag defines a set of limits for the values calculated in the kinemetric algorithm. If the value of “etm_dx” or “etm_dx” fall below the value var_min (1 pixel per frame) then the delta value returned from the kinemetric is set to zero. Each dimension in the gesture is treated independently this has the effect of “locking” out values in one dimension if they to not meet the threshold limits. When dragging vertically the horizontal scroll value (scroll_dx) will be automatically set to zero. Or When scrolling horizontally the vertical scroll value is set to zero (scroll_dy). This allows developers to take advantage of built-in “directionality” reducing the need to qualify motion in the application layer.

The filters activated in the <processing> block add an inertial effect to the gesture event which ensures a smooth continuous scrolling gesture that slowing comes to rest. This allows developers to directly add momentum to the scrolling of text fields, item lists or menus without the need to explicitly manage scroll values.

Because all the of the values that configure scroll gesture are uniquely externalized from the application the look and feel of the scroll motion can be adjusted without the need to recompile an application or modify the application layer.

<Gesture id="n-scroll" type="scroll">
    <match>
        <action>
            <initial>
                <cluster point_number="0" point_number_min="0" point_number_max="5"/>
            </initial>
        </action>
    </match>
    <analysis>
        <algorithm class="kinemetric" type="continuous">
            <library module="scroll"/>
            <variables>
                <property id="scroll_dx" return="etm_dx" var="etm_dx" var_min="1"/>
                <property id="scroll_dy" return="etm_dy" var="etm_dy" var_min="1"/>
            </variables>
            <returns>
                <property id="scroll_dx" result="etm_dx"/>
                <property id="scroll_dy" result="etm_dy"/>
            </returns>
        </algorithm>
    </analysis>    
    <processing>
        <inertial_filter>
            <property ref="scroll_dx" active="true" friction="0.94"/>
            <property ref="scroll_dy" active="true" friction="0.94"/>
        </inertial_filter>
        <delta_filter>
            <property ref="scroll_dx" active="true" delta_min="0.5" delta_max="30"/>
            <property ref="scroll_dy" active="true" delta_min="0.5" delta_max="30"/>
        </delta_filter>
    </processing>
    <mapping>
        <update dispatch_type="continuous">
            <gesture_event  type="scroll">
                <property ref="scroll_dx" target=""/>
                <property ref="scroll_dy" target=""/>
            </gesture_event>
        </update>
    </mapping>
</Gesture>
gestures/touch/complex/velocity-direction/n-scroll.txt · Last modified: 2015/09/15 12:39 by glass