- Sceneform SDK for Android
was open sourced and archived ( github.com/google-ar/sceneform-android-sdk
) with version 1.16.0.
- This site ( developers.google.com/sceneform
) serves as the documentation archive for the previous version, Sceneform SDK for Android
1.15.0.
- Do not use version 1.17.0 of the Sceneform Maven artifacts
.
- The 1.17.1 Maven artifacts can be used. Other than the version, however, the 1.17.1 artifacts are identical to the 1.15.0 artifacts.
BaseGestureRecognizer
Stay organized with collections
Save and categorize content based on your preferences.
Known Direct Subclasses
DragGestureRecognizer
|
Gesture Recognizer for when the user performs a drag motion on the touch screen. |
PinchGestureRecognizer
|
Gesture Recognizer for when the user performs a two-finger pinch motion on the touch screen. |
TwistGestureRecognizer
|
Gesture Recognizer for when the user performs a two-finger twist motion on the touch screen. |
Base class for all Gesture Recognizers (i.e. DragGestureRecognizer).
A Gesture recognizer processes touch input to determine if a gesture should start and fires an
event when the gesture is started.
To determine when an gesture is finished/updated, listen to the events on the gesture object.
Nested Classes
interface
Interface definition for a callbacks to be invoked when a BaseGesture
starts.
Inherited Methods
From class
java.lang.Object
Protected Methods
protected
abstract
void
tryCreateGestures
( HitTestResult
hitTestResult, MotionEvent
motionEvent)
Parameters
hitTestResult |
motionEvent |
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License
, and code samples are licensed under the Apache 2.0 License
. For details, see the Google Developers Site Policies
. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-06-26 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-06-26 UTC."],[[["\u003cp\u003e\u003ccode\u003eBaseGestureRecognizer\u003c/code\u003e serves as the foundation for gesture recognition in Sceneform, such as drag, pinch, and twist gestures.\u003c/p\u003e\n"],["\u003cp\u003eIt processes touch input to identify gesture starts and triggers corresponding events.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers can listen to gesture object events to track gesture updates and completion.\u003c/p\u003e\n"],["\u003cp\u003eGesture Recognizers are extended by concrete classes like \u003ccode\u003eDragGestureRecognizer\u003c/code\u003e, \u003ccode\u003ePinchGestureRecognizer\u003c/code\u003e, and \u003ccode\u003eTwistGestureRecognizer\u003c/code\u003e to handle specific user interactions.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eBaseGestureRecognizer\u003c/code\u003e includes methods to add and remove gesture start listeners, as well as an abstract method \u003ccode\u003etryCreateGestures\u003c/code\u003e to be implemented by subclasses for gesture creation logic.\u003c/p\u003e\n"]]],["`BaseGestureRecognizer` is an abstract class that processes touch inputs to detect gestures. It includes subclasses like `DragGestureRecognizer`, `PinchGestureRecognizer`, and `TwistGestureRecognizer`. The class uses `GesturePointersUtility` and an ArrayList to manage gestures. Key actions involve adding or removing listeners for gesture start events and processing touch inputs with the `onTouch` method. The method `tryCreateGestures` determines if a gesture should start based on touch inputs.\n"],null,["# BaseGestureRecognizer\n\npublic abstract class **BaseGestureRecognizer** \n\n|---|---|---|\n| Known Direct Subclasses [DragGestureRecognizer](/sceneform/reference/com/google/ar/sceneform/ux/DragGestureRecognizer), [PinchGestureRecognizer](/sceneform/reference/com/google/ar/sceneform/ux/PinchGestureRecognizer), [TwistGestureRecognizer](/sceneform/reference/com/google/ar/sceneform/ux/TwistGestureRecognizer) |--------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------| | [DragGestureRecognizer](/sceneform/reference/com/google/ar/sceneform/ux/DragGestureRecognizer) | Gesture Recognizer for when the user performs a drag motion on the touch screen. | | [PinchGestureRecognizer](/sceneform/reference/com/google/ar/sceneform/ux/PinchGestureRecognizer) | Gesture Recognizer for when the user performs a two-finger pinch motion on the touch screen. | | [TwistGestureRecognizer](/sceneform/reference/com/google/ar/sceneform/ux/TwistGestureRecognizer) | Gesture Recognizer for when the user performs a two-finger twist motion on the touch screen. | |||\n\nBase class for all Gesture Recognizers (i.e. DragGestureRecognizer).\n\nA Gesture recognizer processes touch input to determine if a gesture should start and fires an\nevent when the gesture is started.\n\nTo determine when an gesture is finished/updated, listen to the events on the gesture object. \n\n### Nested Classes\n\n|-----------|---|---|----------------------------------------------------------------------------------------------------------------------------------------------|\n| interface | [BaseGestureRecognizer.OnGestureStartedListener](/sceneform/reference/com/google/ar/sceneform/ux/BaseGestureRecognizer.OnGestureStartedListener)\\\u003cT extends [BaseGesture](/sceneform/reference/com/google/ar/sceneform/ux/BaseGesture)\\\u003cT\\\u003e\\\u003e || Interface definition for a callbacks to be invoked when a [BaseGesture](/sceneform/reference/com/google/ar/sceneform/ux/BaseGesture) starts. |\n\n### Fields\n\n|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------|---|\n| protected final [GesturePointersUtility](/sceneform/reference/com/google/ar/sceneform/ux/GesturePointersUtility) | [gesturePointersUtility](/sceneform/reference/com/google/ar/sceneform/ux/BaseGestureRecognizer#gesturePointersUtility) | |\n| protected final [ArrayList](https://developer.android.com/reference/java/util/ArrayList)\\\u003cT extends [BaseGesture](/sceneform/reference/com/google/ar/sceneform/ux/BaseGesture)\\\u003cT\\\u003e\\\u003e | [gestures](/sceneform/reference/com/google/ar/sceneform/ux/BaseGestureRecognizer#gestures) | |\n\n### Public Constructors\n\n|---|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| | [BaseGestureRecognizer](/sceneform/reference/com/google/ar/sceneform/ux/BaseGestureRecognizer#BaseGestureRecognizer(com.google.ar.sceneform.ux.GesturePointersUtility))([GesturePointersUtility](/sceneform/reference/com/google/ar/sceneform/ux/GesturePointersUtility) gesturePointersUtility) |\n\n### Public Methods\n\n|------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| void | [addOnGestureStartedListener](/sceneform/reference/com/google/ar/sceneform/ux/BaseGestureRecognizer#addOnGestureStartedListener(com.google.ar.sceneform.ux.BaseGestureRecognizer.OnGestureStartedListener\u003cT\u003e))([OnGestureStartedListener](/sceneform/reference/com/google/ar/sceneform/ux/BaseGestureRecognizer.OnGestureStartedListener)\\\u003cT\\\u003e listener) |\n| void | [onTouch](/sceneform/reference/com/google/ar/sceneform/ux/BaseGestureRecognizer#onTouch(com.google.ar.sceneform.HitTestResult,%20android.view.MotionEvent))([HitTestResult](/sceneform/reference/com/google/ar/sceneform/HitTestResult) hitTestResult, [MotionEvent](https://developer.android.com/reference/android/view/MotionEvent) motionEvent) |\n| void | [removeOnGestureStartedListener](/sceneform/reference/com/google/ar/sceneform/ux/BaseGestureRecognizer#removeOnGestureStartedListener(com.google.ar.sceneform.ux.BaseGestureRecognizer.OnGestureStartedListener\u003cT\u003e))([OnGestureStartedListener](/sceneform/reference/com/google/ar/sceneform/ux/BaseGestureRecognizer.OnGestureStartedListener)\\\u003cT\\\u003e listener) |\n\n### Protected Methods\n\n|---------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract void | [tryCreateGestures](/sceneform/reference/com/google/ar/sceneform/ux/BaseGestureRecognizer#tryCreateGestures(com.google.ar.sceneform.HitTestResult,%20android.view.MotionEvent))([HitTestResult](/sceneform/reference/com/google/ar/sceneform/HitTestResult) hitTestResult, [MotionEvent](https://developer.android.com/reference/android/view/MotionEvent) motionEvent) |\n\n### Inherited Methods\n\nFrom class java.lang.Object \n\n|-----------------------------------------------------------------------------|---------------------------------------------------------------------------------|\n| [Object](https://developer.android.com/reference/java/lang/Object) | clone() |\n| boolean | equals([Object](https://developer.android.com/reference/java/lang/Object) arg0) |\n| void | finalize() |\n| final [Class](https://developer.android.com/reference/java/lang/Class)\\\u003c?\\\u003e | getClass() |\n| int | hashCode() |\n| final void | notify() |\n| final void | notifyAll() |\n| [String](https://developer.android.com/reference/java/lang/String) | toString() |\n| final void | wait(long arg0, int arg1) |\n| final void | wait(long arg0) |\n| final void | wait() |\n\nFields\n------\n\n#### protected final [GesturePointersUtility](/sceneform/reference/com/google/ar/sceneform/ux/GesturePointersUtility)\n**gesturePointersUtility**\n\n\u003cbr /\u003e\n\n#### protected final [ArrayList](https://developer.android.com/reference/java/util/ArrayList)\\\u003cT extends [BaseGesture](/sceneform/reference/com/google/ar/sceneform/ux/BaseGesture)\\\u003cT\\\u003e\\\u003e\n**gestures**\n\n\u003cbr /\u003e\n\nPublic Constructors\n-------------------\n\n#### public\n**BaseGestureRecognizer**\n([GesturePointersUtility](/sceneform/reference/com/google/ar/sceneform/ux/GesturePointersUtility) gesturePointersUtility)\n\n\u003cbr /\u003e\n\n##### Parameters\n\n| gesturePointersUtility | |\n|------------------------|---|\n\nPublic Methods\n--------------\n\n#### public void\n**addOnGestureStartedListener**\n([OnGestureStartedListener](/sceneform/reference/com/google/ar/sceneform/ux/BaseGestureRecognizer.OnGestureStartedListener)\\\u003cT\\\u003e listener)\n\n\u003cbr /\u003e\n\n##### Parameters\n\n| listener | |\n|----------|---|\n\n#### public void\n**onTouch**\n([HitTestResult](/sceneform/reference/com/google/ar/sceneform/HitTestResult) hitTestResult, [MotionEvent](https://developer.android.com/reference/android/view/MotionEvent) motionEvent)\n\n\u003cbr /\u003e\n\n##### Parameters\n\n| hitTestResult | |\n| motionEvent | |\n|---------------|---|\n\n#### public void\n**removeOnGestureStartedListener**\n([OnGestureStartedListener](/sceneform/reference/com/google/ar/sceneform/ux/BaseGestureRecognizer.OnGestureStartedListener)\\\u003cT\\\u003e listener)\n\n\u003cbr /\u003e\n\n##### Parameters\n\n| listener | |\n|----------|---|\n\nProtected Methods\n-----------------\n\n#### protected abstract void\n**tryCreateGestures**\n([HitTestResult](/sceneform/reference/com/google/ar/sceneform/HitTestResult) hitTestResult, [MotionEvent](https://developer.android.com/reference/android/view/MotionEvent) motionEvent)\n\n\u003cbr /\u003e\n\n##### Parameters\n\n| hitTestResult | |\n| motionEvent | |\n|---------------|---|"]]