Node.OnTouchListenerStay organized with collectionsSave and categorize content based on your preferences.
Page Summary
Node.OnTouchListeneris an interface used to handle touch events dispatched to a Sceneform node.
It provides a callback methodonTouchwhich is invoked before the node'sonTouchEvent.
onTouchreceives aHitTestResultindicating the touched node and aMotionEventwith event details.
ReturningtruefromonTouchconsumes the event, preventing further processing by other listeners or the node itself.
public static interfaceNode.OnTouchListener
Interface definition for a callback to be invoked when a touch event is dispatched to this
node. The callback will be invoked beforeonTouchEvent(HitTestResult, MotionEvent)is
called.
Handles when a touch event has been dispatched to a node.
OnACTION_DOWNevents,getNode()will always be
this node or one of its children. On other events, the touch may have moved causing thegetNode()to change (or possibly be null).
Parameters
hitTestResult
represents the node that was touched and information about where it was
touched
motionEvent
the MotionEvent object containing full information about the event
Returns
true if the listener has consumed the event, false otherwise
[[["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."],[],["The `Node.OnTouchListener` interface defines a callback for touch events dispatched to a node. It has one method, `onTouch`, which handles these events. `onTouch` receives a `HitTestResult`, indicating the touched node and location, and a `MotionEvent` with event details. On `ACTION_DOWN`, the touched node will always be the current node or a child. The `onTouch` method returns `true` if the event is consumed, or `false` if not.\n"]]