Skip to content

Commit 133e08e

Browse files
cleaner
1 parent f33d9bc commit 133e08e

File tree

1 file changed

+21
-26
lines changed

1 file changed

+21
-26
lines changed

Assets/MixedRealityToolkit-SDK/Features/Input/FocusProvider.cs

Lines changed: 21 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -234,19 +234,7 @@ private void Awake()
234234

235235
foreach (var inputSource in InputSystem.DetectedInputSources)
236236
{
237-
// If our input source does not have any pointers, then skip.
238-
if (inputSource.Pointers == null) { return; }
239-
240-
for (var i = 0; i < inputSource.Pointers.Length; i++)
241-
{
242-
RegisterPointer(inputSource.Pointers[i]);
243-
244-
// Special Registration for Gaze
245-
if (inputSource.SourceId == InputSystem.GazeProvider.GazeInputSource.SourceId && gazeProviderPointingData == null)
246-
{
247-
gazeProviderPointingData = new PointerData(inputSource.Pointers[i]);
248-
}
249-
}
237+
RegisterPointers(inputSource);
250238
}
251239
}
252240

@@ -449,6 +437,23 @@ public bool RegisterPointer(IMixedRealityPointer pointer)
449437
return true;
450438
}
451439

440+
private void RegisterPointers(IMixedRealityInputSource inputSource)
441+
{
442+
// If our input source does not have any pointers, then skip.
443+
if (inputSource.Pointers == null) { return; }
444+
445+
for (int i = 0; i < inputSource.Pointers.Length; i++)
446+
{
447+
RegisterPointer(inputSource.Pointers[i]);
448+
449+
// Special Registration for Gaze
450+
if (inputSource.SourceId == InputSystem.GazeProvider.GazeInputSource.SourceId && gazeProviderPointingData == null)
451+
{
452+
gazeProviderPointingData = new PointerData(inputSource.Pointers[i]);
453+
}
454+
}
455+
}
456+
452457
/// <inheritdoc />
453458
public bool UnregisterPointer(IMixedRealityPointer pointer)
454459
{
@@ -833,23 +838,13 @@ private void UpdateFocusedObjects()
833838

834839
#region ISourceState Implementation
835840

841+
/// <inheritdoc />
836842
public void OnSourceDetected(SourceStateEventData eventData)
837843
{
838-
// If our input source does not have any pointers, then skip.
839-
if (eventData.InputSource.Pointers == null) { return; }
840-
841-
for (var i = 0; i < eventData.InputSource.Pointers.Length; i++)
842-
{
843-
RegisterPointer(eventData.InputSource.Pointers[i]);
844-
845-
// Special Registration for Gaze
846-
if (eventData.InputSource.SourceId == InputSystem.GazeProvider.GazeInputSource.SourceId && gazeProviderPointingData == null)
847-
{
848-
gazeProviderPointingData = new PointerData(eventData.InputSource.Pointers[i]);
849-
}
850-
}
844+
RegisterPointers(eventData.InputSource);
851845
}
852846

847+
/// <inheritdoc />
853848
public void OnSourceLost(SourceStateEventData eventData)
854849
{
855850
// If the input source does not have pointers, then skip.

0 commit comments

Comments
 (0)