Package com.jogamp.newt.event
Interface GestureHandler
-
- All Known Implementing Classes:
DoubleTapScrollGesture,PinchToZoomGesture
public interface GestureHandlerGeneric gesture handler interface designed to allow pass-through filtering ofInputEvents.To avoid negative impact on event processing, implementation shall restrict computation as much as possible and only within it's appropriate gesture states.
To allow custom user events, other than the normal
InputEvents, a user may return aGestureHandler.GestureEventin it's implementation.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classGestureHandler.GestureEventA custom gesture eventstatic interfaceGestureHandler.GestureListenerListener forGestureHandler.GestureEvents.
-
Field Summary
Fields Modifier and Type Field Description static booleanDEBUG
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidclear(boolean clearStarted)Clears state of handler, i.e.InputEventgetGestureEvent()Returns the correspondingInputEventfor the gesture as detected by a previousprocess(InputEvent), which has not beencleared.booleanhasGesture()Returns true if a previousprocess(InputEvent)command produced a gesture, which has not beencleared.booleanisWithinGesture()Returns true if within a gesture as detected by a previousprocess(InputEvent)command, which has not beencleared.booleanprocess(InputEvent e)Process the givenInputEventand returns true if it produced the gesture.
-
-
-
Method Detail
-
clear
void clear(boolean clearStarted)
Clears state of handler, i.e. resets all states incl. previous detected gesture.- Parameters:
clearStarted- if true, also clearsstartedstate, otherwise stay within gesture - if appropriate. Staying within a gesture allows fluent continuous gesture sequence, e.g. for scrolling.
-
hasGesture
boolean hasGesture()
Returns true if a previousprocess(InputEvent)command produced a gesture, which has not beencleared. Otherwise returns false.
-
getGestureEvent
InputEvent getGestureEvent()
Returns the correspondingInputEventfor the gesture as detected by a previousprocess(InputEvent), which has not beencleared. Otherwise returns null.Only implemented for gestures mapping to
InputEvents.
-
isWithinGesture
boolean isWithinGesture()
Returns true if within a gesture as detected by a previousprocess(InputEvent)command, which has not beencleared. Otherwise returns false.
-
process
boolean process(InputEvent e)
Process the givenInputEventand returns true if it produced the gesture. Otherwise returns false.If a gesture was already detected previously and has not been cleared, method does not process the event and returns true.
Besides validation of the event's details, the handler may also validate the
InputEvent.InputClassand/orInputEvent.InputType.
-
-