ISwipeHandler
Interface to handle swipe gestures on the touchpad.
| Function | Description |
|---|---|
| OnSwipeCanceled | Called when swipe is cancelled |
| OnSwipeCompleted | Called when swipe is completed |
| OnSwipeDown | Called when swiped down |
| OnSwipeLeft | Called when swiped left |
| OnSwipeRight | Called when swiped right |
| OnSwipeStarted | Called when swipe starts |
| OnSwipeUp | Called when swiped up |
| OnSwipeUpdated | Called when swipe position updates |
using JMRSDK.InputModule;
using UnityEngine;
public class InterfaceExample: MonoBehaviour, ISwipeHandler
{
public void OnSwipeCanceled(SwipeEventData eventData) {
Debug.Log("OnSwipeCanceled");
}
public void OnSwipeCompleted(SwipeEventData eventData) {
Debug.Log("OnSwipeCompleted");
}
public void OnSwipeDown(SwipeEventData eventData, float delta) {
Debug.Log("OnSwipeDown");
}
public void OnSwipeLeft(SwipeEventData eventData, float delta) {
Debug.Log("OnSwipeLeft");
}
public void OnSwipeRight(SwipeEventData eventData, float delta) {
Debug.Log("OnSwipeRight");
}
public void OnSwipeStarted(SwipeEventData eventData) {
Debug.Log("OnSwipeStarted");
}
public void OnSwipeUp(SwipeEventData eventData, float delta) {
Debug.Log("OnSwipeUp");
}
public void OnSwipeUpdated(SwipeEventData eventData, Vector2 delta) {
Debug.Log("OnSwipeUpdated");
}
}
SwipeEventData
| Datatype | Variable | Description |
|---|---|---|
| EventSystems.BaseInputModule | currentInputModule | Get the currently active Input Module |
| GameObject | selectedObject | Get the currently selected object |
| Vector2 | SwipeDelta | Amount of swipe moved by the user |
| float | SwipeTouchTime | Amount of time spent in touch |
| float | SwipeMovementAmount | Movement done by the user while swiping |
| Vector2 | NormalizedOffset | Offset over the duration of swipe |
| float | SwipeTime | Amount of time the swipe was registered |
| float | SwipeAmount | Amount of swipe registered |