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
-
Method Summary
Modifier and TypeMethodDescriptioncreateState
(Point initialPosition, Point initialVelocity) Create aMomentum.State
instance.boolean
updateState
(Momentum.State state) Update the state based on the specifiedMomentum.State
.
-
Constructor Details
-
DefaultMomentum
public DefaultMomentum()
-
-
Method Details
-
createState
Description copied from interface:Momentum
Create aMomentum.State
instance. TheMomentum.State
instance will be passed toMomentum.updateState(State)
until the momentum is depleted.- Specified by:
createState
in interfaceMomentum
- Parameters:
initialPosition
- the initial positioninitialVelocity
- the initial velocity in pixels per millisecond
-
updateState
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 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:
updateState
in interfaceMomentum
- Parameters:
state
- the current state- Returns:
- true to continue momentum, false if no momentum remains
-