public abstract class AbstractGestureRecognizer extends Object implements GestureRecognizer
Modifier and Type | Class and Description |
---|---|
static class |
AbstractGestureRecognizer.ExtraTouchBehavior
Enum specifying how the gesture should treat 'extra' touches that occur, either to ignore them, or
cancel the whole gesture.
|
Modifier and Type | Field and Description |
---|---|
protected PointerEventsSupport |
pointerEventsSupport |
Constructor and Description |
---|
AbstractGestureRecognizer(AbstractGestureRecognizer.ExtraTouchBehavior extraTouchBehavior,
int touchCount) |
Modifier and Type | Method and Description |
---|---|
void |
cancel()
Ends recognition of the gesture, and fires any cancel events that apply.
|
protected void |
fireEvent(<any> event) |
List<TouchData> |
getTouches()
Gets all actively recognized touches that are being recognized by this gesture.
|
boolean |
handle(NativeEvent event)
Takes a browser event, and checks to see if it should decipher a gesture from it.
|
boolean |
handleCancel(NativeEvent cancelEvent)
Handles gesture cancel events
|
boolean |
handleEnd(NativeEvent endEvent)
Handles gesture end events
|
boolean |
handleMove(NativeEvent moveEvent)
Handles gesture move events
|
protected void |
handlePreventDefault(NativeEvent event)
Intended to allow subclasses to determine if preventDefault should be called
Default behavior is to NOT preventDefault
|
boolean |
handleStart(NativeEvent startEvent)
Handles the start of gesture.
|
protected abstract void |
onCancel(List<TouchData> touches)
Indicates that one or more touches have been canceled by the browser or by the gesture itself being canceled
(see #cancel).
|
protected abstract void |
onEnd(List<TouchData> touches)
Indicates that one or more touches have ended.
|
protected abstract void |
onMove(List<TouchData> touches)
Indicates that on or more touches are moving
|
protected abstract boolean |
onStart(TouchData startedTouch)
Indicates that a touch has started, giving the gesture the chance to exclusively handle this touch as it moves.
|
void |
setCaptured(TouchData touch,
boolean capture)
Indicates whether or not the gesture is interested in all events about the given touch, and that any event
about that touch should be preventDefault'd and stopPropagation'd.
|
void |
setDelegate(HasHandlers eventDelegate)
Sets delegate to receive Gesture events
|
void |
setInterest(TouchData touch,
boolean interest)
Indicates whether or not the gesture are interested in end/cancel events about the given touch.
|
void |
start(List<TouchData> touches)
Artificially starts a gesture
|
protected PointerEventsSupport pointerEventsSupport
public AbstractGestureRecognizer(AbstractGestureRecognizer.ExtraTouchBehavior extraTouchBehavior, int touchCount)
public void cancel()
GestureRecognizer
cancel
in interface GestureRecognizer
public List<TouchData> getTouches()
GestureRecognizer
getTouches
in interface GestureRecognizer
public boolean handle(NativeEvent event)
GestureRecognizer
handle
in interface GestureRecognizer
event
- the browser event to read for a gesture.public boolean handleStart(NativeEvent startEvent)
startEvent
- public boolean handleMove(NativeEvent moveEvent)
moveEvent
- public boolean handleCancel(NativeEvent cancelEvent)
cancelEvent
- public boolean handleEnd(NativeEvent endEvent)
endEvent
- public void setCaptured(TouchData touch, boolean capture)
true
from #onStart
automatically captures the started touch.
Note that if the second argument is true, setInterest(touch, true) is implicit.touch
- capture
- public void setDelegate(HasHandlers eventDelegate)
GestureRecognizer
setDelegate
in interface GestureRecognizer
public void setInterest(TouchData touch, boolean interest)
touch
- the touch to be interested in, but not captureinterest
- whether to add or remove interest on the given touchpublic void start(List<TouchData> touches)
GestureRecognizer
start
in interface GestureRecognizer
protected void fireEvent(<any> event)
protected void handlePreventDefault(NativeEvent event)
event
- protected abstract boolean onStart(TouchData startedTouch)
startedTouch
- the touch that has begunprotected abstract void onMove(List<TouchData> touches)
touches
- protected abstract void onEnd(List<TouchData> touches)
touches
- data for the now-ended touches (as opposed to #getTouches which no longer has those entries)protected abstract void onCancel(List<TouchData> touches)
touches
- data for the now-canceled touches (as opposed to #getTouches which no longer has those entries)Copyright © 2018. All rights reserved.