Log inGet started
Package

xr_keyboard.module

Newest version

This package holds more than this page lists. See all of its files in its world.

README.md

xr_keyboard

The keyboard in a headset.

While a session holds focus and a text field on a panel standing in the world holds the caret, a keyboard panel (xr_keyboard.PANEL, "xr_keyboard") stands below that field. Any text field of any screen a panel shows takes it: the editor's panels, the app menu and its tabs, a game's HUD. The keyboard follows the field through ui.focusedTextField(), which names the field, the panel it stands on and its box on that panel.

Where it stands

Its top edge lies on the line from the eyes to a point 2 cm below the middle of the field's box, 12 cm nearer to the eyes than the field and from 35 cm to 75 cm from the eyes (so a field on a far panel gets a keyboard within reach), and it faces the eyes. Seen from the eyes it covers nothing above that line, so the field it types into stays in view. It is placed in the space the field's panel is anchored to (the world, the room or the person's view), so it moves with that panel the way the panel moves. It is placed anew for each field that takes the caret and whenever the field's panel moves; the strip along its top edge holds it, and a keyboard the person moved stays where they put it until another field takes the caret. xr_keyboard.placeBelow states the placement.

The keys

The keys are pressed with the laser and the trigger, or a bare hand's pinch, like any panel's widgets. Pressing them leaves the caret in the field: the keyboard's panel is created with keepsFocus.

  • letters and digits, typed with ui.typeText;
  • Shift capitalises the next letter, and with an arrow selects;
  • ?123 shows the page of symbols, and again the letters;
  • Space, Backspace, the left and right arrows, and Enter (a new line in a multi-line field, a submit in a single-line one), pressed with ui.typeKey.

The words on the keys are the catalog's names of those keys (controls.key.space, controls.key.enter, controls.modifier.shift), in the person's language.

When it goes

It goes when the field lets the caret go: a press on another panel or away from every panel, ui.blur(), the field's panel hiding, or the session losing focus. A submit keeps the caret in the field, and the keyboard with it.