Table of Contents

Class DragGesture

Namespace
Lime
Assembly
Lime.dll
public class DragGesture : Gesture
Inheritance
DragGesture
Derived
Inherited Members

Constructors

DragGesture(IMotionStrategy)

public DragGesture(DragGesture.IMotionStrategy motionStrategy)

Parameters

motionStrategy DragGesture.IMotionStrategy

DragGesture(int, DragDirection, bool, float, IMotionStrategy)

public DragGesture(int buttonIndex = 0, DragDirection direction = DragDirection.Any, bool exclusive = false, float dragThreshold = 5, DragGesture.IMotionStrategy motionStrategy = null)

Parameters

buttonIndex int
direction DragDirection
exclusive bool
dragThreshold float
motionStrategy DragGesture.IMotionStrategy

Fields

DefaultDragThreshold

protected const float DefaultDragThreshold = 5

Field Value

float

changed

protected Gesture.PollableEvent changed

Field Value

Gesture.PollableEvent

Properties

ButtonIndex

public int ButtonIndex { get; }

Property Value

int

Direction

public DragDirection Direction { get; }

Property Value

DragDirection

DragThreshold

public float DragThreshold { get; set; }

Property Value

float

Exclusive

public bool Exclusive { get; set; }

Property Value

bool

LastDragDistance

public Vector2 LastDragDistance { get; }

Property Value

Vector2

MousePosition

MousePosition depends on DragDirection so (MousePosition - DragDirection).X or Y will always be zero if DragDirection is Vertical or Horizontal respectively. This fact is used when checking for threshold.

public virtual Vector2 MousePosition { get; }

Property Value

Vector2

MousePressPosition

public Vector2 MousePressPosition { get; }

Property Value

Vector2

PreviousMousePosition

protected virtual Vector2 PreviousMousePosition { get; }

Property Value

Vector2

TotalDragDistance

public Vector2 TotalDragDistance { get; }

Property Value

Vector2

Methods

CanStartDrag()

protected virtual bool CanStartDrag()

Returns

bool

IsChanging()

public bool IsChanging()

Returns

bool

IsDragging()

protected virtual bool IsDragging()

Returns

bool

IsRecognizing()

public bool IsRecognizing()

Returns

bool

OnCancel(Gesture)

protected override void OnCancel(Gesture sender)

Parameters

sender Gesture

OnUpdate()

protected override bool OnUpdate()

Returns

bool

TryGetDragPosition(out Vector2)

protected virtual bool TryGetDragPosition(out Vector2 position)

Parameters

position Vector2

Returns

bool

TryGetStartDragPosition(out Vector2)

protected virtual bool TryGetStartDragPosition(out Vector2 position)

Parameters

position Vector2

Returns

bool

WasBegan()

public bool WasBegan()

Returns

bool

WasChanged()

public bool WasChanged()

Returns

bool

WasEnded()

public bool WasEnded()

Returns

bool

WasEnding()

public bool WasEnding()

Returns

bool

WasRecognized()

public bool WasRecognized()

Returns

bool

Events

Began

Occurs when gesture activates and starts recognition.

public event Action Began

Event Type

Action

Changed

Occurs when drag position is being changed by either user or motion strategy.

public event Action Changed

Event Type

Action

Ended

Occurs when either a user released input or motion strategy is done.

public event Action Ended

Event Type

Action

Ending

Occurs when the drag is completed and the motion defined by motion strategy begins.

public virtual event Action Ending

Event Type

Action

Recognized

Occurs if a user started gesture in a valid direction.

public event Action Recognized

Event Type

Action