2
2
3
3
namespace UnityEngine . InputSystem . Samples . RebindUI
4
4
{
5
- class DragDetector : ITouchProcessor
5
+ /// <summary>
6
+ /// A gesture detector processor for "drag" a.k.a. "translate/pan" gestures.
7
+ /// </summary>
8
+ internal class DragDetector : ITouchProcessor
6
9
{
7
- private double m_InitialTime ;
8
10
private Vector2 m_InitialPosition ;
11
+ private double m_InitialTime ;
9
12
private readonly float m_ThresholdSqr ;
10
13
private bool m_Valid ;
11
14
@@ -17,6 +20,9 @@ public DragDetector(float threshold)
17
20
m_Valid = false ;
18
21
}
19
22
23
+ #region ITouchProcessor implementation
24
+
25
+ /// <inheritdoc/>
20
26
public void OnTouchBegin ( Detector context , in TouchState [ ] touches , int count , int index )
21
27
{
22
28
if ( count == 1 )
@@ -38,6 +44,7 @@ public void OnTouchBegin(Detector context, in TouchState[] touches, int count, i
38
44
}
39
45
}
40
46
47
+ /// <inheritdoc/>
41
48
public void OnTouchEnd ( Detector context , in TouchState [ ] touches , int count , int index )
42
49
{
43
50
if ( ! m_Valid )
@@ -47,6 +54,7 @@ public void OnTouchEnd(Detector context, in TouchState[] touches, int count, int
47
54
m_Valid = false ;
48
55
}
49
56
57
+ /// <inheritdoc/>
50
58
public void OnTouchMoved ( Detector context , in TouchState [ ] touches , int count , int index )
51
59
{
52
60
if ( m_Valid )
@@ -64,6 +72,7 @@ public void OnTouchMoved(Detector context, in TouchState[] touches, int count, i
64
72
}
65
73
}
66
74
75
+ /// <inheritdoc/>
67
76
public void OnTouchCanceled ( Detector context , in TouchState [ ] touches , int count , int index )
68
77
{
69
78
if ( m_Valid )
@@ -73,6 +82,8 @@ public void OnTouchCanceled(Detector context, in TouchState[] touches, int count
73
82
}
74
83
}
75
84
85
+ #endregion
86
+
76
87
private void Fire ( Detector context , in TouchState [ ] touches , int count , int index , GestureEvent . Flags phase )
77
88
{
78
89
GestureEvent @event = new GestureEvent (
0 commit comments