Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Text fields can now process Return, Tab and L/R Arrow Key inputs #9

Merged
merged 4 commits into from
Mar 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions Assets/Scripts/VitrivrVR/Input/Text/InputFieldController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,29 @@ public void InputBackspace()
_inputField.ProcessEvent(Event.KeyboardEvent("backspace"));
_inputField.ForceLabelUpdate();
}

public void InputLeftArrow()
{
_inputField.ProcessEvent(Event.KeyboardEvent("LeftArrow"));
_inputField.ForceLabelUpdate();
}

public void InputRightArrow()
{
_inputField.ProcessEvent(Event.KeyboardEvent("RightArrow"));
_inputField.ForceLabelUpdate();
}

public void InputReturn()
{
_inputField.ProcessEvent(Event.KeyboardEvent('\n'.ToString()));
_inputField.ForceLabelUpdate();
}

public void InputTabulator()
{
_inputField.ProcessEvent(Event.KeyboardEvent('\t'.ToString()));
_inputField.ForceLabelUpdate();
}
}
}
23 changes: 23 additions & 0 deletions Assets/Scripts/VitrivrVR/Input/Text/SceneTextInputController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,29 @@ public void InputBackspace()
TextInputManager.InputBackspace();
DresClientManager.LogInteraction("keyboard", "backspace", QueryEvent.CategoryEnum.TEXT);
}

public void InputReturn()
{
TextInputManager.InputReturn();
DresClientManager.LogInteraction("keyboard", "return", QueryEvent.CategoryEnum.TEXT);
}

public void InputLeftArrow()
{
TextInputManager.InputLeftArrow();
DresClientManager.LogInteraction("keyboard", "ArrowLeft", QueryEvent.CategoryEnum.TEXT);
}

public void InputRightArrow()
{
TextInputManager.InputRightArrow();
DresClientManager.LogInteraction("keyboard", "ArrowRight", QueryEvent.CategoryEnum.TEXT);
}
public void InputTabulator()
{
TextInputManager.InputTabulator();
DresClientManager.LogInteraction("keyboard", "Tabulator", QueryEvent.CategoryEnum.TEXT);
}

public void ReceiveDictationResult(string text)
{
Expand Down
48 changes: 48 additions & 0 deletions Assets/Scripts/VitrivrVR/Input/Text/TextInputManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,54 @@ public static void InputBackspace()

inputField.InputBackspace();
}

public static void InputReturn()
{
var inputField = GETSelectedInputField();

if (inputField == null)
{
return; // No text field selected, nothing to do
}

inputField.InputReturn();
}

public static void InputLeftArrow()
{
var inputField = GETSelectedInputField();

if (inputField == null)
{
return; // No text field selected, nothing to do
}

inputField.InputLeftArrow();
}

public static void InputRightArrow()
{
var inputField = GETSelectedInputField();

if (inputField == null)
{
return; // No text field selected, nothing to do
}

inputField.InputRightArrow();
}

public static void InputTabulator()
{
var inputField = GETSelectedInputField();

if (inputField == null)
{
return; // No text field selected, nothing to do
}

inputField.InputTabulator();
}

private static InputFieldController GETSelectedInputField()
{
Expand Down