Class VelocityTracker

    Definition

    Namespace:
    Tizen.NUI.Utility
    Assembly:
    Tizen.NUI.dll

    Calculates the velocity of touch movements over time.

    public class VelocityTracker
    Inheritance
    object
    VelocityTracker
    Examples

    private void OnPanGestureDetected(object source, PanGestureDetector.DetectedEventArgs e) { tracker.AddMovement(e.PanGesture.ScreenPosition, e.PanGesture.Time); if (e.PanGesture.State == Gesture.StateType.Started) { } else if (e.PanGesture.State == Gesture.StateType.Continuing) { } else if (e.PanGesture.State == Gesture.StateType.Finished || e.PanGesture.State == Gesture.StateType.Cancelled) { float panVelocity = (ScrollingDirection == Direction.Horizontal) ? tracker.GetVelocity().X : tracker.GetVelocity().Y; tracker.Clear(); } }

    Constructors

    View Source

    VelocityTracker(int)

    Creates a velocity tracker using the specified strategy.

    Declaration
    public VelocityTracker(int degree = 2)
    Parameters
    Type Name Description
    int degree
    View Source

    VelocityTracker(VelocityTrackerStrategy[])

    Declaration
    public VelocityTracker(VelocityTrackerStrategy[] strategy)
    Parameters
    Type Name Description
    VelocityTrackerStrategy[] strategy
    Examples

    private void OnPanGestureDetected(object source, PanGestureDetector.DetectedEventArgs e) { tracker.AddMovement(e.PanGesture.ScreenPosition, e.PanGesture.Time); if (e.PanGesture.State == Gesture.StateType.Started) { } else if (e.PanGesture.State == Gesture.StateType.Continuing) { } else if (e.PanGesture.State == Gesture.StateType.Finished || e.PanGesture.State == Gesture.StateType.Cancelled) { float panVelocity = (ScrollingDirection == Direction.Horizontal) ? tracker.GetVelocity().X : tracker.GetVelocity().Y; tracker.Clear(); } }

    Methods

    View Source

    AddMovement(Vector2, uint)

    Adds movement information

    Declaration
    public void AddMovement(Vector2 position, uint eventTime)
    Parameters
    Type Name Description
    Vector2 position
    uint eventTime
    View Source

    Clear()

    Resets the velocity tracker state.

    Declaration
    public void Clear()
    View Source

    ComputeVelocity(int, float)

    Compute the current velocity based on the points that have been collected.

    Declaration
    public void ComputeVelocity(int units, float maxVelocity)
    Parameters
    Type Name Description
    int units

    The units you would like the velocity in. A value of 1 provides units per millisecond, 1000 provides units per second.

    float maxVelocity

    The maximum velocity that can be computed by this method.

    View Source

    GetVelocity()

    Retrieve the last computed velocity.

    Declaration
    public Vector2 GetVelocity()
    Returns
    Type Description
    Vector2

    Extension Methods

    EXamlExtensions.LoadFromEXamlByRelativePath<T>(T, string)
    Extensions.LoadFromXaml<TXaml>(TXaml, string)
    Extensions.LoadFromXaml<TXaml>(TXaml, Type)
    Extensions.LoadFromXamlFile<TXaml>(TXaml, string)
    • View Source
    Back to top Copyright © 2016-2025 Samsung
    Generated by DocFX