Skip to content

Commit b01d7cc

Browse files
committed
[~] Split IInputHandler in two interfaces: IInputHandler, which is for input up/down, and IInputClickHandler, which is for click events (the tap gesture).
1 parent 72b65fb commit b01d7cc

File tree

19 files changed

+44
-132
lines changed

19 files changed

+44
-132
lines changed

Assets/HoloToolkit-Examples/ColorPicker/GazeableColorPicker.cs

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
using HoloToolkit.Unity.InputModule;
22
using UnityEngine;
3-
using UnityEngine.UI;
43
using UnityEngine.Events;
54

65
namespace Lighthouse
76
{
8-
public class GazeableColorPicker : MonoBehaviour, IFocusable, IInputHandler
7+
public class GazeableColorPicker : MonoBehaviour, IFocusable, IInputClickHandler
98
{
109
public Renderer rendererComponent;
1110

@@ -47,16 +46,6 @@ public void OnFocusExit()
4746
gazing = false;
4847
}
4948

50-
public void OnInputUp(InputEventData eventData)
51-
{
52-
// Nothing to do
53-
}
54-
55-
public void OnInputDown(InputEventData eventData)
56-
{
57-
// Nothing to do
58-
}
59-
6049
public void OnInputClicked(InputEventData eventData)
6150
{
6251
UpdatePickedColor(OnPickedColor);

Assets/HoloToolkit-Examples/GazeRuler/Scripts/MeasureManager.cs

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
/// <summary>
99
/// manager all measure tools here
1010
/// </summary>
11-
public class MeasureManager : Singleton<MeasureManager>, IHoldHandler, IInputHandler
11+
public class MeasureManager : Singleton<MeasureManager>, IHoldHandler, IInputClickHandler
1212
{
1313
private IGeometry manager;
1414
public GeometryMode Mode;
@@ -99,16 +99,6 @@ public void OnHoldCanceled(HoldEventData eventData)
9999
// Nothing to do
100100
}
101101

102-
public void OnInputUp(InputEventData eventData)
103-
{
104-
// Nothing to do
105-
}
106-
107-
public void OnInputDown(InputEventData eventData)
108-
{
109-
// Nothing to do
110-
}
111-
112102
public void OnInputClicked(InputEventData eventData)
113103
{
114104
OnSelect();

Assets/HoloToolkit-Examples/SharingWithUNET/Scripts/PlayerController.cs

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ namespace HoloToolkit.Examples.SharingWithUNET
1111
/// Controls player behavior (local and remote).
1212
/// </summary>
1313
[NetworkSettings(sendInterval = 0.033f)]
14-
public class PlayerController : NetworkBehaviour, IInputHandler
14+
public class PlayerController : NetworkBehaviour, IInputClickHandler
1515
{
1616
/// <summary>
1717
/// The game object that represents the 'bullet' for
@@ -131,16 +131,6 @@ void CmdFire()
131131
Destroy(nextBullet, 8.0f);
132132
}
133133

134-
public void OnInputUp(InputEventData eventData)
135-
{
136-
// Nothing to do
137-
}
138-
139-
public void OnInputDown(InputEventData eventData)
140-
{
141-
// Nothing to do
142-
}
143-
144134
public void OnInputClicked(InputEventData eventData)
145135
{
146136
if (isLocalPlayer)

Assets/HoloToolkit-Examples/SpatialUnderstanding/SpatialUnderstanding-FeatureOverview/Scripts/AppState.cs

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
using System;
77
using HoloToolkit.Unity.InputModule;
88

9-
public class AppState : Singleton<AppState>, ISourceStateHandler, IInputHandler
9+
public class AppState : Singleton<AppState>, ISourceStateHandler, IInputClickHandler
1010
{
1111
// Consts
1212
public float kMinAreaForStats = 5.0f;
@@ -252,16 +252,6 @@ public void OnSourceLost(SourceStateEventData eventData)
252252
}
253253
}
254254

255-
public void OnInputUp(InputEventData eventData)
256-
{
257-
// Nothing to do
258-
}
259-
260-
public void OnInputDown(InputEventData eventData)
261-
{
262-
// Nothing to do
263-
}
264-
265255
public void OnInputClicked(InputEventData eventData)
266256
{
267257
if ((SpatialUnderstanding.Instance.ScanState == SpatialUnderstanding.ScanStates.Scanning) &&

Assets/HoloToolkit/Input/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ Game objects that want to consume input events can implement one or many **input
1212

1313
- **IFocusable** for focus enter and exit. The focus can be triggered by the user's gaze or any other gaze source.
1414
- **IHoldHandle** for the Windows hold gesture.
15-
- **IInputHandler** for source up, down and clicked. The source can be a hand that tapped, a clicker that was pressed, etc.
15+
- **IInputHandler** for source up and down. The source can be a hand that tapped, a clicker that was pressed, etc.
16+
- **IInputClickHandler** for source clicked. The source can be a hand that tapped, a clicker that was pressed, etc.
1617
- **IManipulationHandler** for the Windows manipulation gesture.
1718
- **INavigationnHandler** for the Windows navigation gesture.
1819
- **ISourceStateHandler** for the source detected and source lost events.

Assets/HoloToolkit/Input/Scripts/Cursor/ICursor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace HoloToolkit.Unity.InputModule
88
/// <summary>
99
/// Cursor Interface for handling input events and setting visiblity.
1010
/// </summary>
11-
public interface ICursor : IInputHandler, ISourceStateHandler
11+
public interface ICursor : IInputHandler, IInputClickHandler, ISourceStateHandler
1212
{
1313
/// <summary>
1414
/// Position of the cursor.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License. See LICENSE in the project root for license information.
3+
4+
using UnityEngine.EventSystems;
5+
6+
namespace HoloToolkit.Unity.InputModule
7+
{
8+
/// <summary>
9+
/// Interface to implement to react to simple click input.
10+
/// </summary>
11+
public interface IInputClickHandler : IEventSystemHandler
12+
{
13+
void OnInputClicked(InputEventData eventData);
14+
}
15+
}

Assets/HoloToolkit/Input/Scripts/InputEvents/IInputClickHandler.cs.meta

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/HoloToolkit/Input/Scripts/InputEvents/IInputHandler.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,5 @@ public interface IInputHandler : IEventSystemHandler
1212
{
1313
void OnInputUp(InputEventData eventData);
1414
void OnInputDown(InputEventData eventData);
15-
void OnInputClicked(InputEventData eventData);
1615
}
1716
}

Assets/HoloToolkit/Input/Scripts/InputManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ private void InputSource_SourceClicked(object sender, SourceClickEventArgs e)
363363
inputEventData.Initialize(e.InputSource, e.SourceId);
364364

365365
// Handler for execute events
366-
ExecuteEvents.EventFunction<IInputHandler> eventHandler = (inputHandler, eventData) => { inputHandler.OnInputClicked(inputEventData); };
366+
ExecuteEvents.EventFunction<IInputClickHandler> eventHandler = (inputHandler, eventData) => { inputHandler.OnInputClicked(inputEventData); };
367367

368368
// Pass handler through HandleEvent to perform modal/fallback logic
369369
HandleEvent(inputEventData, eventHandler);

0 commit comments

Comments
 (0)