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.
| DragGesture | Gesture for when the user performs a drag motion on the touch screen. |
| PinchGesture | Gesture for when the user performs a two-finger pinch motion on the touch screen. |
| TwistGesture | Gesture for when the user performs a two-finger twist motion on the touch screen. |
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
Fields
| protected final GesturePointersUtility | gesturePointersUtility | * |
| protected Node | targetNode | * |
|---|
Public Constructors
Public Methods
| Node | |
| boolean | hasFinished
()
|
| boolean | hasStarted
()
|
| float | inchesToPixels
(float inches)
|
| boolean | justStarted
()
|
| void | |
| float | pixelsToInches
(float pixels)
|
| void | |
| boolean | wasCancelled
()
|
Protected Methods
| abstract boolean | |
| void | cancel
()
|
| void | complete
()
|
| abstract T | getSelf
()
|
| abstract void | onCancel
()
|
| abstract void | onFinish
()
|
| abstract void | |
| abstract boolean |
Inherited Methods
Fields
protected final GesturePointersUtility gesturePointersUtility
protected Node targetNode
Public Constructors
public BaseGesture ( GesturePointersUtility gesturePointersUtility)
Parameters
Public Methods
public Node getTargetNode ()
public boolean hasFinished ()
public boolean hasStarted ()
public float inchesToPixels (float inches)
Parameters
public boolean justStarted ()
public void onTouch ( HitTestResult hitTestResult, MotionEvent motionEvent)
Parameters
| hitTestResult |
|---|
| motionEvent |
public float pixelsToInches (float pixels)
Parameters
public void setGestureEventListener ( OnGestureEventListener <T> listener)
Parameters
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 |

