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

Minor keyboard fixes #2522

Merged
merged 2 commits into from
Jul 31, 2018
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
2 changes: 1 addition & 1 deletion Assets/HoloToolkit/UX/Scripts/Keyboard.cs
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ protected override void Awake()

// Setting the keyboardType to an undefined TouchScreenKeyboardType,
// which prevents the MRTK keyboard from triggering the system keyboard itself.
InputField.keyboardType = (TouchScreenKeyboardType)(-1);
InputField.keyboardType = (TouchScreenKeyboardType)(int.MaxValue);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MinValue? (technically you might be able to connect a lot of keyboards, but you can't connect negative keyboards!)

Copy link
Contributor Author

@keveleigh keveleigh Jul 31, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was changed because, when building for UWP XAML, it tries to cast the value (previously -1) into a uint when doing the enum conversion and throws an error. See: #2384


// Keep keyboard deactivated until needed
gameObject.SetActive(false);
Expand Down
29 changes: 16 additions & 13 deletions Assets/HoloToolkit/UX/Scripts/KeyboardInputField.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,24 @@ public override void OnPointerClick(PointerEventData eventData)
{
base.OnPointerClick(eventData);

Keyboard.Instance.Close();
Keyboard.Instance.PresentKeyboard(text, KeyboardLayout);

if (KeyboardSpawnPoint != null)
{
Keyboard.Instance.RepositionKeyboard(KeyboardSpawnPoint, null, KeyBoardPositionOffset);
}
else
if (!TouchScreenKeyboard.isSupported)
{
Keyboard.Instance.RepositionKeyboard(transform, null, KeyBoardPositionOffset);
}
Keyboard.Instance.Close();
Keyboard.Instance.PresentKeyboard(text, KeyboardLayout);

if (KeyboardSpawnPoint != null)
{
Keyboard.Instance.RepositionKeyboard(KeyboardSpawnPoint, null, KeyBoardPositionOffset);
}
else
{
Keyboard.Instance.RepositionKeyboard(transform, null, KeyBoardPositionOffset);
}

// Subscribe to keyboard delegates
Keyboard.Instance.OnTextUpdated += Keyboard_OnTextUpdated;
Keyboard.Instance.OnClosed += Keyboard_OnClosed;
// Subscribe to keyboard delegates
Keyboard.Instance.OnTextUpdated += Keyboard_OnTextUpdated;
Keyboard.Instance.OnClosed += Keyboard_OnClosed;
}
}

/// <summary>
Expand Down