API Reference 0.7.1rikulo_gestureDraggerState

DraggerState class

The state of a dragging movement of Dragger.

class DraggerState extends GestureState {
 final Point _gestureStartPosition;
 VelocityProvider _vp;
 Point _elementPosition;
 int _time;

 DraggerState._(this.dragger, this.draggedElement, Point targetPosition, 
 DragGestureState gstate) :
 gestureState = gstate, eventTarget = gstate.eventTarget, startTime = gstate.time,
 elementStartPosition = targetPosition,
 _gestureStartPosition = gstate.position {
   _vp = new VelocityProvider(elementStartPosition, startTime);
 }

 @override
 final EventTarget eventTarget;
 @override
 int get time => _time;

 /** The associated [Dragger]. */
 final Dragger dragger;
 
 /** The dragged Element. */
 final Element draggedElement;
 
 /** The [DragGestureState] of the underlying [DragGesture], which supplies 
  * information of touch/cursor position, rather than element positions.
  */
 final DragGestureState gestureState;
 
 /** The timestamp when this dragging movement starts. */
 final int startTime;
 
 /** The initial element position (offset with respect to parent). */
 final Point elementStartPosition;
 
 /** The current element position (offset with respect to parent). */
 Point get elementPosition => _elementPosition;
 /** The displacement of the touch/cursor position of this dragging. */
 Point get elementTransition => _elementPosition - elementStartPosition;
 /** The current estimated velocity of touch/cursor position movement. */
 Point get elementVelocity => _vp.velocity;

 void snapshot(Point position, int time) {
   _vp.snapshot(position, time);
   _elementPosition = position;
   _time = time;
 }
}

Extends

GestureState > DraggerState

Properties

var data #

inherited from GestureState

Custom data. It is useful if you'd like to store something that will be cleaned up automatically when the gesture is finished.

var data

final Element draggedElement #

The dragged Element.

final Element draggedElement

final Dragger dragger #

The associated Dragger.

final Dragger dragger

final Point elementPosition #

The current element position (offset with respect to parent).

Point get elementPosition => _elementPosition;

final Point elementStartPosition #

The initial element position (offset with respect to parent).

final Point elementStartPosition

final Point elementTransition #

The displacement of the touch/cursor position of this dragging.

Point get elementTransition => _elementPosition - elementStartPosition;

final Point elementVelocity #

The current estimated velocity of touch/cursor position movement.

Point get elementVelocity => _vp.velocity;

final EventTarget eventTarget #

The element which receives the event.

docs inherited from GestureState
final EventTarget eventTarget

final DragGestureState gestureState #

The DragGestureState of the underlying DragGesture, which supplies information of touch/cursor position, rather than element positions.

final DragGestureState gestureState

final int startTime #

The timestamp when this dragging movement starts.

final int startTime

final int time #

The latest timestamp of gesture.

docs inherited from GestureState
@override
int get time => _time;

Methods

void snapshot(Point position, int time) #

void snapshot(Point position, int time) {
 _vp.snapshot(position, time);
 _elementPosition = position;
 _time = time;
}