Interface GestureRecognizer
-
- All Known Implementing Classes:
AbstractGestureRecognizer
,AbstractTwoTouchGestureRecognizer
,DoubleTapGestureRecognizer
,DragGestureRecognizer
,GestureChain
,LongPressOrTapGestureRecognizer
,PinchAndRotateGestureRecognizer
,ScrollGestureRecognizer
,TapGestureRecognizer
public interface GestureRecognizer
External api for mangling touch events into gestures (events or callbacks). The handle() method accepts incoming dom events, getTouches() returns the current set of touches this gesture is handling, and cancel() releases the current touches so that other handlers can deal with them.
Various implementations of this can either support on- methods or events to indicate that touch events or gestures are ongoing or have completed. Events are generally expected to be fired from any provided delegate rather than this object itself.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
cancel()
Ends recognition of the gesture, and fires any cancel events that apply.List<TouchData>
getTouches()
Gets all actively recognized touches that are being recognized by this gesture.boolean
handle(com.google.gwt.dom.client.NativeEvent event)
Takes a browser event, and checks to see if it should decipher a gesture from it.void
setDelegate(com.google.gwt.event.shared.HasHandlers eventDelegate)
Sets delegate to receive Gesture eventsvoid
start(List<TouchData> touches)
Artificially starts a gesture
-
-
-
Method Detail
-
cancel
void cancel()
Ends recognition of the gesture, and fires any cancel events that apply. Any touch events being recognized by this object will now be ignored.
-
getTouches
List<TouchData> getTouches()
Gets all actively recognized touches that are being recognized by this gesture.- Returns:
- the touches
-
handle
boolean handle(com.google.gwt.dom.client.NativeEvent event)
Takes a browser event, and checks to see if it should decipher a gesture from it.
Callers of this are expected to do their own vetting to decide if the given event should be handled by this gesture - for example, if a cell accepts a tap on one part of it and a longpress on another, the cell should determine where the touch events occur and send to the right recognizer accordingly.
- Parameters:
event
- the browser event to read for a gesture.- Returns:
- true if the gesture is not handling the event and can allow it to be propagated, false to indicate that it has been handled and should not be given to other handlers. Should always return true for any start event.
-
setDelegate
void setDelegate(com.google.gwt.event.shared.HasHandlers eventDelegate)
Sets delegate to receive Gesture events- Parameters:
eventDelegate
- the event handler delegate
-
-