Package com.google.gwt.touch.client
Class DefaultMomentum
java.lang.Object
com.google.gwt.touch.client.DefaultMomentum
- All Implemented Interfaces:
Momentum
Default implementation of momentum.
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.google.gwt.touch.client.Momentum
Momentum.State -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateState(Point initialPosition, Point initialVelocity) Create aMomentum.Stateinstance.booleanupdateState(Momentum.State state) Update the state based on the specifiedMomentum.State.
-
Constructor Details
-
DefaultMomentum
public DefaultMomentum()
-
-
Method Details
-
createState
Description copied from interface:MomentumCreate aMomentum.Stateinstance. TheMomentum.Stateinstance will be passed toMomentum.updateState(State)until the momentum is depleted.- Specified by:
createStatein interfaceMomentum- Parameters:
initialPosition- the initial positioninitialVelocity- the initial velocity in pixels per millisecond
-
updateState
Description copied from interface:MomentumUpdate the state based on the specified
Momentum.State. When no more momentum remains, this method should return false to stop future calls.The
Momentum.Stateinstance is created by a call toMomentum.createState(Point, Point), and the same instance if used for the duration of the momentum. This method should modify the existing state by callingMomentum.State.setPosition(Point)and/orMomentum.State.setVelocity(Point).- Specified by:
updateStatein interfaceMomentum- Parameters:
state- the current state- Returns:
- true to continue momentum, false if no momentum remains
-