Skip to content

Commit 54ccf57

Browse files
committed
Added inline doc
1 parent d6ce1a0 commit 54ccf57

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed

Assets/Samples/RebindingUI/OnScreen/Detector.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,15 @@
44

55
namespace UnityEngine.InputSystem.Samples.RebindUI
66
{
7+
// Note that gesture event handler delegate takes an 'in' reference when 'ref readonly' would be preferrable.
8+
// The reason for this is that this construct isn't available until C# 12.0.
9+
10+
/// <summary>
11+
/// Base class for gesture detectors.
12+
/// </summary>
713
abstract class Detector : ITouchMonitor
814
{
9-
public delegate void GestureEventHandler(in GestureEvent gestureEvent); // ref readonly not available until C# 12.0
15+
public delegate void GestureEventHandler(in GestureEvent gestureEvent);
1016

1117
protected Detector(int maxTouches)
1218
{

Assets/Samples/RebindingUI/OnScreen/DragDetector.cs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,13 @@
22

33
namespace UnityEngine.InputSystem.Samples.RebindUI
44
{
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
69
{
7-
private double m_InitialTime;
810
private Vector2 m_InitialPosition;
11+
private double m_InitialTime;
912
private readonly float m_ThresholdSqr;
1013
private bool m_Valid;
1114

@@ -17,6 +20,9 @@ public DragDetector(float threshold)
1720
m_Valid = false;
1821
}
1922

23+
#region ITouchProcessor implementation
24+
25+
/// <inheritdoc/>
2026
public void OnTouchBegin(Detector context, in TouchState[] touches, int count, int index)
2127
{
2228
if (count == 1)
@@ -38,6 +44,7 @@ public void OnTouchBegin(Detector context, in TouchState[] touches, int count, i
3844
}
3945
}
4046

47+
/// <inheritdoc/>
4148
public void OnTouchEnd(Detector context, in TouchState[] touches, int count, int index)
4249
{
4350
if (!m_Valid)
@@ -47,6 +54,7 @@ public void OnTouchEnd(Detector context, in TouchState[] touches, int count, int
4754
m_Valid = false;
4855
}
4956

57+
/// <inheritdoc/>
5058
public void OnTouchMoved(Detector context, in TouchState[] touches, int count, int index)
5159
{
5260
if (m_Valid)
@@ -64,6 +72,7 @@ public void OnTouchMoved(Detector context, in TouchState[] touches, int count, i
6472
}
6573
}
6674

75+
/// <inheritdoc/>
6776
public void OnTouchCanceled(Detector context, in TouchState[] touches, int count, int index)
6877
{
6978
if (m_Valid)
@@ -73,6 +82,8 @@ public void OnTouchCanceled(Detector context, in TouchState[] touches, int count
7382
}
7483
}
7584

85+
#endregion
86+
7687
private void Fire(Detector context, in TouchState[] touches, int count, int index, GestureEvent.Flags phase)
7788
{
7889
GestureEvent @event = new GestureEvent(

0 commit comments

Comments
 (0)