GWT 2.7.0

com.google.gwt.touch.client
Class DefaultMomentum

java.lang.Object
  extended by com.google.gwt.touch.client.DefaultMomentum
All Implemented Interfaces:
Momentum

public class DefaultMomentum
extends java.lang.Object
implements Momentum

Default implementation of momentum.


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.google.gwt.touch.client.Momentum
Momentum.State
 
Constructor Summary
DefaultMomentum()
           
 
Method Summary
 Momentum.State createState(Point initialPosition, Point initialVelocity)
          Create a Momentum.State instance.
 boolean updateState(Momentum.State state)
           Update the state based on the specified Momentum.State.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultMomentum

public DefaultMomentum()
Method Detail

createState

public Momentum.State createState(Point initialPosition,
                                  Point initialVelocity)
Description copied from interface: Momentum
Create a Momentum.State instance. The Momentum.State instance will be passed to Momentum.updateState(State) until the momentum is depleted.

Specified by:
createState in interface Momentum
Parameters:
initialPosition - the initial position
initialVelocity - the initial velocity in pixels per millisecond

updateState

public boolean updateState(Momentum.State state)
Description copied from interface: Momentum

Update the state based on the specified Momentum.State. When no more momentum remains, this method should return false to stop future calls.

The Momentum.State instance is created by a call to Momentum.createState(Point, Point), and the same instance if used for the duration of the momentum. This method should modify the existing state by calling Momentum.State.setPosition(Point) and/or Momentum.State.setVelocity(Point).

Specified by:
updateState in interface Momentum
Parameters:
state - the current state
Returns:
true to continue momentum, false if no momentum remains

GWT 2.7.0