User Tools

Site Tools


re-mapping_gesture_return_values_the_rotate-to-zoom_gesture

Re-Mapping Gesture Return Values The Rotate-To-Zoom Gesture

Rotate-to-scale

The “n-rotate-to-scale” gesture uses a rotate action to modify the scale of a touch object. Any number of touch points from 2 to 10 can be used to rotate about a center to zoom in and out or change the scale a display object.

The gesture object uses a simple rotate algorithm to analyze the motion of the touch point cluster. Then passes the values into each gesture dimension which feed directly into the gesture pipeline. In the pipeline the values are subject to the multiply filter which reduces the amplitude of the values by a factor of 100 (multiplies by 0.01). Finally the dimension values are mapped to the scaleX and scaleY properties of the gesture event.

When used in an application these values can be used to directly modify the vertical and horizontal scale values of a display object (Using native methods or using a gesture event handler). The effect of which is to allow objects to change size by performing a rotate action on the touch object. This can be thought of as a simplified “focus” or “rotate to zoom” gesture.

<Gesture id="n-rotate-to-scale" type="rotate">
    <match>
        <action>
            <initial>
                <cluster point_number="0" point_number_min="2" point_number_max="10"/>
            </initial>
        </action>
    </match>
    <analysis>
        <algorithm class="kinemetric" type="continuous">
            <library module="rotate"/>
            <returns>
                <property id="scale_dsx" result="dtheta"/>
                <property id="scale_dsy" result="dtheta"/>
            </returns>
        </algorithm>
    </analysis>
    <processing>
        <multiply_filter>
            <property ref="scale_dsx" active="true" factor="0.01"/>
            <property ref="scale_dsy" active="true" factor="0.01"/>
        </multiply_filter>
    </processing>
    <mapping>
        <update dispatch_type="continuous">
            <gesture_event type="scale">
                <property ref="scale_dsx" target="scaleX"/>
                <property ref="scale_dsy" target="scaleY"/>
            </gesture_event>
        </update>
    </mapping>
</Gesture>
re-mapping_gesture_return_values_the_rotate-to-zoom_gesture.txt · Last modified: 2019/01/29 19:07 (external edit)