This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
arSceneView.scene.setOnTouchListener { | |
hitTestResult : HitTestResult?, motionEvent : MotionEvent? -> | |
gestureDetectorCompat!!.onTouchEvent(motionEvent) | |
when (gestureDetector.gestureType) { | |
GestureDetector.GestureType.SINGLE_TAP -> { | |
if (hitTestResult!!.node == null) { | |
Toast.makeText(this, "SINGLE TAP performed", Toast.LENGTH_SHORT).show() | |
} | |
else { | |
Toast.makeText(this, "SINGLE TAP performed on a node", Toast.LENGTH_SHORT).show() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
arSceneView.scene.setOnTouchListener { | |
hitTestResult : HitTestResult?, motionEvent : MotionEvent? -> | |
gestureDetectorCompat!!.onTouchEvent(motionEvent) | |
when (gestureDetector.gestureType) { | |
GestureDetector.GestureType.SINGLE_TAP -> { | |
Toast.makeText(this, "SINGLE TAP", Toast.LENGTH_SHORT).show() | |
} | |
GestureDetector.GestureType.DOUBLE_TAP -> { | |
Toast.makeText(this, "DOUBLE TAP", Toast.LENGTH_SHORT).show() | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.sarim.sceneformgesturestutorial | |
import android.view.GestureDetector | |
import android.view.MotionEvent | |
class GestureDetector : GestureDetector.SimpleOnGestureListener() { | |
enum class GestureType { | |
NONE, SINGLE_TAP, DOUBLE_TAP, LONG_PRESS | |
} |