34 lines
967 B
C#
34 lines
967 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class TestTK : MonoBehaviour
|
|
{
|
|
public RawImage image;
|
|
private Vector3 delta = Vector3.zero;
|
|
|
|
void Start()
|
|
{
|
|
image = GetComponent<RawImage>();
|
|
TKPanRecognizer pan = new TKPanRecognizer();
|
|
pan.gestureRecognizedEvent += (r) =>
|
|
{
|
|
delta = pan.deltaTranslation;
|
|
delta.y = 0;
|
|
delta.z = 0;
|
|
image.transform.position += delta;
|
|
Debug.Log("pan recognizer fired: " + image.transform.position);
|
|
};
|
|
TouchKit.addGestureRecognizer(pan);
|
|
|
|
TKPinchRecognizer pinch = new TKPinchRecognizer();
|
|
pinch.gestureRecognizedEvent += (r) =>
|
|
{
|
|
image.transform.localScale += Vector3.one * pinch.deltaScale;
|
|
Debug.Log("pinch recognizer fired: " + r);
|
|
};
|
|
TouchKit.addGestureRecognizer(pinch);
|
|
}
|
|
}
|