Skip to main content

ISwipeHandler

Interface to handle swipe gestures on the touchpad.

FunctionDescription
OnSwipeCanceledCalled when swipe is cancelled
OnSwipeCompletedCalled when swipe is completed
OnSwipeDownCalled when swiped down
OnSwipeLeftCalled when swiped left
OnSwipeRightCalled when swiped right
OnSwipeStartedCalled when swipe starts
OnSwipeUpCalled when swiped up
OnSwipeUpdatedCalled 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

DatatypeVariableDescription
EventSystems.BaseInputModulecurrentInputModuleGet the currently active Input Module
GameObjectselectedObjectGet the currently selected object
Vector2SwipeDeltaAmount of swipe moved by the user
floatSwipeTouchTimeAmount of time spent in touch
floatSwipeMovementAmountMovement done by the user while swiping
Vector2NormalizedOffsetOffset over the duration of swipe
floatSwipeTimeAmount of time the swipe was registered
floatSwipeAmountAmount of swipe registered