Page Summary
-
BaseGestureis an abstract class serving as the foundation for gesture recognition in Sceneform, representing a sequence of touch events like dragging or pinching. -
It is created and updated by
BaseGestureRecognizerand offers subclasses such asDragGesture,PinchGesture, andTwistGesturefor specific touch interactions. -
Key methods include
canStart,onStart,updateGesture,onFinish, andonCancel, which define the gesture lifecycle and behavior. -
Developers can utilize the
OnGestureEventListenerinterface to receive callbacks during various stages of a gesture's execution. -
The
targetNodefield indicates the Sceneform node associated with the gesture, whilegesturePointersUtilityassists with managing touch points.
| Known Direct Subclasses |
Base class for a gesture.
A gesture represents a sequence of touch events that are detected to represent a particular type of motion (i.e. Dragging, Pinching).
Gestures are created and updated by BaseGestureRecognizer's.
Nested Classes
| interface | BaseGesture.OnGestureEventListener<T extends BaseGesture<T>> | Interface definition for callbacks to be invoked by a BaseGesture. |
|
Fields
| protected final GesturePointersUtility | gesturePointersUtility | |
| protected Node | targetNode |
Public Constructors
|
BaseGesture(GesturePointersUtility gesturePointersUtility)
|
Public Methods
| Node | |
| boolean | |
| boolean | |
| float |
inchesToPixels(float inches)
|
| boolean | |
| void | |
| float |
pixelsToInches(float pixels)
|
| void |
setGestureEventListener(OnGestureEventListener<T> listener)
|
| boolean |
Protected Methods
| abstract boolean | |
| void |
cancel()
|
| void |
complete()
|
| abstract T |
getSelf()
|
| abstract void |
onCancel()
|
| abstract void |
onFinish()
|
| abstract void | |
| abstract boolean |
Inherited Methods
Fields
Public Constructors
public BaseGesture (GesturePointersUtility gesturePointersUtility)
Parameters
| gesturePointersUtility |
|---|
Public Methods
public boolean hasFinished ()
public boolean hasStarted ()
public float inchesToPixels (float inches)
Parameters
| inches |
|---|
public boolean justStarted ()
public void onTouch (HitTestResult hitTestResult, MotionEvent motionEvent)
Parameters
| hitTestResult | |
|---|---|
| motionEvent |
public float pixelsToInches (float pixels)
Parameters
| pixels |
|---|
public boolean wasCancelled ()
Protected Methods
protected abstract boolean canStart (HitTestResult hitTestResult, MotionEvent motionEvent)
Parameters
| hitTestResult | |
|---|---|
| motionEvent |
protected void cancel ()
protected void complete ()
protected abstract T getSelf ()
protected abstract void onCancel ()
protected abstract void onFinish ()
protected abstract void onStart (HitTestResult hitTestResult, MotionEvent motionEvent)
Parameters
| hitTestResult | |
|---|---|
| motionEvent |
protected abstract boolean updateGesture (HitTestResult hitTestResult, MotionEvent motionEvent)
Parameters
| hitTestResult | |
|---|---|
| motionEvent |