An array of Key Code values that will automatically have preventDefault
called on them,
as long as the KeyboardManager.preventDefault
boolean is set to true
.
By default the array is empty.
The key must be non-modified when pressed in order to be captured.
A non-modified key is one that doesn't have a modifier key held down with it. The modifier keys are shift, control, alt and the meta key (Command on a Mac, the Windows Key on Windows). Therefore, if the user presses shift + r, it won't prevent this combination, because of the modifier. However, if the user presses just the r key on its own, it will have its event prevented.
If you wish to stop capturing the keys, for example switching out to a DOM based element, then
you can toggle the KeyboardManager.preventDefault
boolean at run-time.
If you need more specific control, you can create Key objects and set the flag on each of those instead.
This array can be populated via the Game Config by setting the input.keyboard.capture
array, or you
can call the addCapture
method. See also removeCapture
and clearCaptures
.