Package com.google.gwt.touch.client
Class DefaultMomentum
- java.lang.Object
-
- com.google.gwt.touch.client.DefaultMomentum
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.google.gwt.touch.client.Momentum
Momentum.State
-
-
Constructor Summary
Constructors Constructor Description DefaultMomentum()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Momentum.State
createState(Point initialPosition, Point initialVelocity)
Create aMomentum.State
instance.boolean
updateState(Momentum.State state)
Update the state based on the specifiedMomentum.State
.
-
-
-
Method Detail
-
createState
public Momentum.State createState(Point initialPosition, Point initialVelocity)
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
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 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
-
-