Namespace: Lens.Keyboards

Allows developers to request a keyboard be made available to the user.

Static Properties

Lens.Keyboards.ON_SCREEN ARCore/keyboards.js, line 38

An onscreen keyboard. Always available.

Lens.Keyboards.PHONE ARCore/keyboards.js, line 43

The keyboard from a phone connected to LumuinAR.

Static Methods

Lens.Keyboards.available() ARCore/keyboards.js, line 95

Returns an array of available keyboard types: Keyboards.ON_SCREEN and/or Keyboards.PHONE.

Lens.Keyboards.request(position) → {AbstractKeyboard} ARCore/keyboards.js, line 79

Requests a keyboard. If a phone is connected to LuminAR, uses that phone's keyboard. Else, brings up an onscreen keyboard. There are two ways of listening to keyboard events: first, they are fired on the focussed DOM element; second, you can bind handlers directly using the AbstractKeyboard returned by this method.

Lens' keyboards implements a dialect of the standard keyboard event specification. They fire lens:keypress events, not keyup and keydown events. In addition, these keypress events fired by Lens have all of the standard properties used to access the key: key, char, keyCode, charCode, and which. All of these properties have the same value, which is the printable character corresponding to the key press (taking into account whether the shift key is pressed), or a key code corresponding to a special key. Keypress events are fired only for printable keys; they are not fired for presses of the shift key, for example.

If a Lens keyboard receives a keypress while a text input or textarea has focus, the pressed key will be added to the value of the input. So, to allow a user to type into a text input box, focus the element and request a keyboard.

For a pre-built text input modal dialog, see Lens.Components.Modal.textEntry.

Argument Type Description
position String | Element | jQuery

Where to put the onscreen keyboard if one is used. Either a CSS selector, a DOM element, or a jQuery object.

Returns:

A concrete subclass of AbstractKeyboard.