/// <summary> /// Create a default drag gesture configuration for one finger dragging. /// </summary> /// <param name="dragShape">The dragging shape</param> public GestureConfigDrag(GestureShape dragShape) { AssociatedGestureType = GestureType.Drag; DragShape = dragShape; RequiredNumberOfFingers = 1; AllowedErrorMargins = 0.02f * Vector2.One; MinimumDragDistance = 0.02f; }
/// <summary> /// Create a default gesture configuration for one finger flicking. /// </summary> /// <param name="flickShape">The shape of the flicking.</param> public GestureConfigFlick(GestureShape flickShape) { AssociatedGestureType = GestureType.Flick; FlickShape = flickShape; RequiredNumberOfFingers = 1; MinimumAverageSpeed = 0.4f; MinimumFlickLength = 0.04f; AllowedErrorMargins = 0.02f * Vector2.One; }
internal GestureEventTranslation(GestureType type, GestureState state, int numberOfFingers, TimeSpan deltaTime, TimeSpan totalTime, GestureShape shape, Vector2 startPos, Vector2 currPos, Vector2 deltaTrans) { Type = type; State = state; NumberOfFinger = numberOfFingers; DeltaTime = deltaTime; TotalTime = totalTime; Shape = shape; StartPosition = startPos; CurrentPosition = currPos; DeltaTranslation = deltaTrans; TotalTranslation = currPos - startPos; AverageSpeed = TotalTranslation / (float)(TotalTime.TotalSeconds + 0.0001f); // avoid division by zero }
internal void Set(GestureState state, int numberOfFingers, TimeSpan deltaTime, TimeSpan totalTime, GestureShape shape, Vector2 startPos, Vector2 currPos, Vector2 deltaTrans) { base.Set(GestureType.Drag, state, numberOfFingers, deltaTime, totalTime, shape, startPos, currPos, deltaTrans); }
internal GestureEventDrag(GestureState state, int numberOfFingers, TimeSpan deltaTime, TimeSpan totalTime, GestureShape shape, Vector2 startPos, Vector2 currPos, Vector2 deltaTrans) : base(GestureType.Drag, state, numberOfFingers, deltaTime, totalTime, shape, startPos, currPos, deltaTrans) { }
internal void Set(int numberOfFingers, TimeSpan time, GestureShape shape, Vector2 startPos, Vector2 currPos) { Set(GestureType.Flick, GestureState.Occurred, numberOfFingers, time, time, shape, startPos, currPos, currPos - startPos); }
internal GestureEventFlick(int numberOfFingers, TimeSpan time, GestureShape shape, Vector2 startPos, Vector2 currPos) : base(GestureType.Flick, GestureState.Occurred, numberOfFingers, time, time, shape, startPos, currPos, currPos - startPos) { }
internal GestureEventFlick( int numberOfFingers, TimeSpan time, GestureShape shape, Vector2 startPos, Vector2 currPos) :base(GestureType.Flick, GestureState.Occurred, numberOfFingers, time, time, shape, startPos, currPos, currPos-startPos) { }
internal GestureEventDrag(GestureState state, int numberOfFingers, TimeSpan deltaTime, TimeSpan totalTime, GestureShape shape, Vector2 startPos, Vector2 currPos, Vector2 deltaTrans) :base(GestureType.Drag, state, numberOfFingers, deltaTime,totalTime,shape,startPos,currPos,deltaTrans) { }