Skip to content

Commit 01aed9e

Browse files
committed
Formatted serialized parameters in ET nav scripts
Updated serialized parameters to start lowercase and removed underscores.
1 parent cbc8b4d commit 01aed9e

File tree

7 files changed

+168
-169
lines changed

7 files changed

+168
-169
lines changed

Assets/MixedRealityToolkit.Examples/Demos/EyeTracking/Demo_ScrollPanZoom/Scripts/BaseClasses/PanZoomBase.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,23 +27,23 @@ public abstract class PanZoomBase : MonoBehaviour,
2727
/// Ability to pan using your eye gaze without any additional input (e.g., air tap or
2828
/// button presses).
2929
/// </summary>
30-
internal bool AutoGazePanIsActive = true;
30+
internal bool autoGazePanIsActive = true;
3131

3232
/// <summary>
3333
/// Horizontal panning speed. For example: 0.1f for slow panning. 0.6f for fast panning.
3434
/// </summary>
35-
internal float PanSpeedLeftRight; // Comment: This could be improved by using panning step sizes depending on the zoom level.
35+
internal float panSpeedLeftRight; // Comment: This could be improved by using panning step sizes depending on the zoom level.
3636

3737
/// <summary>
3838
/// Vertical panning speed. For example: 0.1f for slow panning. 0.6f for fast panning.
3939
/// </summary>
40-
internal float PanSpeedUpDown;
40+
internal float panSpeedUpDown;
4141

4242
/// <summary>
4343
/// Minimal distance in x and y from center of the target (0, 0) to trigger panning. Thus,
4444
/// values must range between 0 (always panning) and 0.5 (no panning).
4545
/// </summary>
46-
internal Vector2 MinDistFromCenterForAutoPan = new Vector2(0.2f, 0.2f);
46+
internal Vector2 minDistFromCenterForAutoPan = new Vector2(0.2f, 0.2f);
4747

4848
// ZOOM
4949
/// <summary>
@@ -176,8 +176,8 @@ private Vector3 CustomColliderSizeOnLookAt
176176

177177
public void AutoPan()
178178
{
179-
PanHorizontally(ComputePanSpeed(cursorPos.x, PanSpeedLeftRight, MinDistFromCenterForAutoPan.x));
180-
PanVertically(ComputePanSpeed(cursorPos.y, PanSpeedUpDown, MinDistFromCenterForAutoPan.y));
179+
PanHorizontally(ComputePanSpeed(cursorPos.x, panSpeedLeftRight, minDistFromCenterForAutoPan.x));
180+
PanVertically(ComputePanSpeed(cursorPos.y, panSpeedUpDown, minDistFromCenterForAutoPan.y));
181181
}
182182

183183
/// <summary>
@@ -379,7 +379,7 @@ private void LateUpdate()
379379
/// </summary>
380380
private void AutomaticGazePanning()
381381
{
382-
if (AutoGazePanIsActive)
382+
if (autoGazePanIsActive)
383383
{
384384
AutoPan();
385385
}

Assets/MixedRealityToolkit.Examples/Demos/EyeTracking/Demo_ScrollPanZoom/Scripts/BaseClasses/PanZoomBase_RectTransf.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ public override void ZoomIn()
5656
ZoomInOut_RectTransform(zoomDir * zoomSpeed, cursorPos);
5757

5858
// Panning across entire target (-0.5, +0.5) to move target of interest towards center while zooming in
59-
PanHorizontally(ComputePanSpeed(cursorPos.x, PanSpeedLeftRight, MinDistFromCenterForAutoPan.x));
60-
PanVertically(ComputePanSpeed(cursorPos.y, PanSpeedUpDown, MinDistFromCenterForAutoPan.y));
59+
PanHorizontally(ComputePanSpeed(cursorPos.x, panSpeedLeftRight, minDistFromCenterForAutoPan.x));
60+
PanVertically(ComputePanSpeed(cursorPos.y, panSpeedUpDown, minDistFromCenterForAutoPan.y));
6161
}
6262

6363
public override void ZoomOut()

Assets/MixedRealityToolkit.Examples/Demos/EyeTracking/Demo_ScrollPanZoom/Scripts/BaseClasses/PanZoomBase_Texture.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public string TextureShaderProperty
2828

2929
[Tooltip("Underlying aspect ratio of the loaded texture to correctly determine scaling.")]
3030
[SerializeField]
31-
private float DefaultAspectRatio = 1.0f;
31+
private float defaultAspectRatio = 1.0f;
3232

3333
private float aspectRatio = -1;
3434

@@ -38,7 +38,7 @@ public override void Initialize()
3838
{
3939
if (aspectRatio == -1)
4040
{
41-
Initialize(DefaultAspectRatio);
41+
Initialize(defaultAspectRatio);
4242
}
4343
else
4444
{
@@ -142,8 +142,8 @@ public override void ZoomIn()
142142
ZoomInOut(zoomDir * zoomSpeed, cursorPos);
143143

144144
// Panning across entire target (-0.5, +0.5) to move target of interest towards center while zooming in
145-
PanHorizontally(ComputePanSpeed(cursorPos.x, PanSpeedLeftRight, MinDistFromCenterForAutoPan.x));
146-
PanVertically(ComputePanSpeed(cursorPos.y, PanSpeedUpDown, MinDistFromCenterForAutoPan.y));
145+
PanHorizontally(ComputePanSpeed(cursorPos.x, panSpeedLeftRight, minDistFromCenterForAutoPan.x));
146+
PanVertically(ComputePanSpeed(cursorPos.y, panSpeedUpDown, minDistFromCenterForAutoPan.y));
147147
}
148148
}
149149

Assets/MixedRealityToolkit.Examples/Demos/EyeTracking/Demo_ScrollPanZoom/Scripts/PanZoom_RectTransf.cs

Lines changed: 63 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -13,66 +13,66 @@ public class PanZoom_RectTransf : PanZoomBase_RectTransf
1313
{
1414
[Tooltip("RectTransform from, for example, your TextMeshPro game object.")]
1515
[SerializeField]
16-
private RectTransform RectTransfToNavigate = null;
16+
private RectTransform rectTransfToNavigate = null;
1717

1818
[Tooltip("Reference to the viewport restricting the viewbox. This is important for identifying the max constrains for panning.")]
1919
[SerializeField]
20-
private RectTransform RefToViewPort = null;
20+
private RectTransform refToViewPort = null;
2121

22-
// Scroll
23-
[Tooltip("Ability to scroll using your eye gaze without any additional input (e.g., air tap or button presses).")]
22+
// Zoom
23+
[Tooltip("Zoom acceleration defining the steepness of logistic speed function mapping.")]
2424
[SerializeField]
25-
private bool AutoGazeScrollIsActive = true;
25+
private float zoomAcceleration = 10f;
2626

27-
[Tooltip("Horizontal scroll speed. For example: 0.1f for slow panning. 0.6f for fast panning.")]
27+
[Tooltip("Maximum zoom speed.")]
2828
[SerializeField]
29-
private float ScrollSpeed_x = 0.2f;
29+
private float zoomSpeedMax = 0.02f;
3030

31-
[Tooltip("Vertical scroll speed. For example: 0.1f for slow panning. 0.6f for fast panning.")]
31+
[Tooltip("Minimum scale of the texture for zoom in - e.g., 0.5f (half the original size)")]
3232
[SerializeField]
33-
private float ScrollSpeed_y = 0.2f;
33+
private float zoomMinScale = 0.1f;
3434

35-
[Tooltip("Minimal distance in x and y from center of the target's hit box (0, 0) to scroll. Thus, values must range between 0 (always scroll) and 0.5 (no scroll).")]
35+
[Tooltip("Maximum scale of the texture for zoom out - e.g., 1f (the original size) or 2.0f (double the original size).")]
3636
[SerializeField]
37-
private Vector2 MinDistFromCenterForAutoScroll = new Vector2(0.2f, 0.2f);
37+
private float zoomMaxScale = 1.0f;
3838

39-
[Tooltip("Set to true to prevent sudden scrolling when quickly looking around. This may make scrolling feel less responsive though.")]
39+
[Tooltip("Timed zoom: Once triggered, a zoom in/out will be performed for the given amount of time in seconds.")]
4040
[SerializeField]
41-
private bool UseSkimProofing = false;
41+
private float zoomTimeInSecToZoom = 0.5f;
4242

43-
[Tooltip("The lower the value, the slower the scrolling will speed up after skimming. Recommended value: 5.")]
43+
[Tooltip("Type of hand gesture to use to zoom in/out.")]
4444
[SerializeField]
45-
[Range(0, 10)]
46-
private float SkimProofUpdateSpeed = 5f;
45+
private MixedRealityInputAction zoomGesture = MixedRealityInputAction.None;
4746

48-
// Zoom
49-
[Tooltip("Zoom acceleration defining the steepness of logistic speed function mapping.")]
47+
[Tooltip("Enable or disable hand gestures for zooming on startup.")]
5048
[SerializeField]
51-
private float Zoom_Acceleration = 10f;
49+
private bool zoomGestureEnabledOnStartup = false;
5250

53-
[Tooltip("Maximum zoom speed.")]
51+
// Pan
52+
[Tooltip("Ability to scroll using your eye gaze without any additional input (e.g., air tap or button presses).")]
5453
[SerializeField]
55-
private float Zoom_SpeedMax = 0.02f;
54+
private bool panAutoScrollIsActive = true;
5655

57-
[Tooltip("Minimum scale of the texture for zoom in - e.g., 0.5f (half the original size)")]
56+
[Tooltip("Horizontal scroll speed. For example: 0.1f for slow panning. 0.6f for fast panning.")]
5857
[SerializeField]
59-
private float Zoom_MinScale = 0.1f;
58+
private float panSpeedHorizontal = 0.3f;
6059

61-
[Tooltip("Maximum scale of the texture for zoom out - e.g., 1f (the original size) or 2.0f (double the original size).")]
60+
[Tooltip("Vertical scroll speed. For example: 0.1f for slow panning. 0.6f for fast panning.")]
6261
[SerializeField]
63-
private float Zoom_MaxScale = 1.0f;
62+
private float panSpeedVertical = 0.3f;
6463

65-
[Tooltip("Timed zoom: Once triggered, a zoom in/out will be performed for the given amount of time in seconds.")]
64+
[Tooltip("Minimal distance in x and y from center of the target's hit box (0, 0) to scroll. Thus, values must range between 0 (always scroll) and 0.5 (no scroll).")]
6665
[SerializeField]
67-
private float Zoom_TimeInSecToZoom = 0.5f;
66+
private Vector2 panMinDistFromCenter = new Vector2(0.2f, 0.2f);
6867

69-
[Tooltip("Type of hand gesture to use to zoom in/out.")]
68+
[Tooltip("Set to true to prevent sudden scrolling when quickly looking around. This may make scrolling feel less responsive though.")]
7069
[SerializeField]
71-
private MixedRealityInputAction Zoom_Gesture = MixedRealityInputAction.None;
70+
private bool useSkimProofing = false;
7271

73-
[Tooltip("Enable or disable hand gestures for zooming on startup.")]
72+
[Tooltip("The lower the value, the slower the scrolling will speed up after skimming. Recommended value: 5.")]
7473
[SerializeField]
75-
private bool Zoom_GestureEnabledOnStartup = false;
74+
[Range(0, 10)]
75+
private float skimProofUpdateSpeed = 5f;
7676

7777
// The base PanAndZoom class can also be used with UV textures for which the dimensions are different to a RectTransform.
7878
// To allow to keep the speed values that users can assign consistent, let's internally convert the values.
@@ -81,48 +81,49 @@ public class PanZoom_RectTransf : PanZoomBase_RectTransf
8181
protected override void Start()
8282
{
8383
// Assigning values to base PanZoom class
84-
AutoGazePanIsActive = AutoGazeScrollIsActive;
85-
PanSpeedLeftRight = ScrollSpeed_x * convertSpeedToUVSpace;
86-
PanSpeedUpDown = ScrollSpeed_y * convertSpeedToUVSpace;
87-
MinDistFromCenterForAutoPan = MinDistFromCenterForAutoScroll;
88-
useSkimProof = UseSkimProofing;
84+
// Zoom
85+
ZoomAcceleration = zoomAcceleration;
86+
ZoomSpeedMax = zoomSpeedMax;
87+
ZoomMinScale = zoomMinScale;
88+
ZoomMaxScale = zoomMaxScale;
89+
ZoomGesture = zoomGesture;
90+
ZoomGestureEnabledOnStartup = zoomGestureEnabledOnStartup;
91+
timeInSecondsToZoom = zoomTimeInSecToZoom;
92+
93+
// Pan
94+
autoGazePanIsActive = panAutoScrollIsActive;
95+
panSpeedLeftRight = panSpeedHorizontal;
96+
panSpeedUpDown = panSpeedVertical;
97+
minDistFromCenterForAutoPan = panMinDistFromCenter;
98+
useSkimProof = useSkimProofing;
8999

90100
// Set up rect transform
91-
viewportRectTransf = RefToViewPort;
92-
navRectTransf = RectTransfToNavigate;
101+
viewportRectTransf = refToViewPort;
102+
navRectTransf = rectTransfToNavigate;
93103
navRectTransf.anchorMin = new Vector2(0.5f, 0.5f);
94104
navRectTransf.anchorMax = new Vector2(0.5f, 0.5f);
95105
navRectTransf.pivot = new Vector2(0.5f, 0.5f);
96106

97-
// Zoom
98-
ZoomAcceleration = Zoom_Acceleration;
99-
ZoomSpeedMax = Zoom_SpeedMax;
100-
ZoomMinScale = Zoom_MinScale;
101-
ZoomMaxScale = Zoom_MaxScale;
102-
ZoomGesture = Zoom_Gesture;
103-
ZoomGestureEnabledOnStartup = Zoom_GestureEnabledOnStartup;
104-
timeInSecondsToZoom = Zoom_TimeInSecToZoom;
105-
106107
base.Start();
107108
}
108109

109110
protected override void Update()
110111
{
111-
UpdateValues(ref navRectTransf, RectTransfToNavigate);
112-
UpdateValues(ref ZoomAcceleration, Zoom_Acceleration);
113-
UpdateValues(ref ZoomSpeedMax, Zoom_SpeedMax);
114-
UpdateValues(ref ZoomMinScale, Zoom_MinScale);
115-
UpdateValues(ref ZoomMaxScale, Zoom_MaxScale);
116-
UpdateValues(ref ZoomGesture, Zoom_Gesture);
117-
UpdateValues(ref timeInSecondsToZoom, Zoom_TimeInSecToZoom);
118-
119-
UpdateValues(ref AutoGazePanIsActive, AutoGazeScrollIsActive);
120-
UpdateValues(ref PanSpeedLeftRight, ScrollSpeed_x * convertSpeedToUVSpace);
121-
UpdateValues(ref PanSpeedUpDown, ScrollSpeed_y * convertSpeedToUVSpace);
122-
UpdateValues(ref MinDistFromCenterForAutoPan, MinDistFromCenterForAutoScroll);
123-
UpdateValues(ref useSkimProof, UseSkimProofing);
124-
125-
if (UpdateValues(ref skimproof_UpdateSpeedFromUser, SkimProofUpdateSpeed))
112+
UpdateValues(ref navRectTransf, rectTransfToNavigate);
113+
UpdateValues(ref ZoomAcceleration, zoomAcceleration);
114+
UpdateValues(ref ZoomSpeedMax, zoomSpeedMax);
115+
UpdateValues(ref ZoomMinScale, zoomMinScale);
116+
UpdateValues(ref ZoomMaxScale, zoomMaxScale);
117+
UpdateValues(ref ZoomGesture, zoomGesture);
118+
UpdateValues(ref timeInSecondsToZoom, zoomTimeInSecToZoom);
119+
120+
UpdateValues(ref autoGazePanIsActive, panAutoScrollIsActive);
121+
UpdateValues(ref panSpeedLeftRight, panSpeedHorizontal);
122+
UpdateValues(ref panSpeedUpDown, panSpeedVertical);
123+
UpdateValues(ref minDistFromCenterForAutoPan, panMinDistFromCenter);
124+
UpdateValues(ref useSkimProof, useSkimProofing);
125+
126+
if (UpdateValues(ref skimproof_UpdateSpeedFromUser, skimProofUpdateSpeed))
126127
{
127128
SetSkimProofUpdateSpeed(skimproof_UpdateSpeedFromUser);
128129
}

0 commit comments

Comments
 (0)