Plugin: JS9Keyboard

### Keyboard Actions

JS9 supports the actions that get executed in response to (case-sensitive) keypress events. The following actions are defined in the JS9.globalOpts.keyboardActions array:

- 0: reset zoom
- b: toggle selected region: source/background
- e: toggle selected region: include/exclude
- o: open a local FITS file
- /: copy wcs position to clipboard
- ?: copy value and position to clipboard
- =: zoom in
- +: zoom in
- -: zoom out
- >: display next image
- <: display previous image
- delete: remove selected region
- leftArrow: move selected region left
- upArrow: move selected region up
- rightArrow: move selected region right
- downArrow: move selected region down

You can view the current mapping between keys and actions using this Keyboard plugin. Also, you can execute individual actions by clicking the 'key' buttons. This is especially useful for devices without keyboards, such as iPads and iPhones.

It is possible to add new actions. To do this, first add an entry to the JS9.Keyboard.Actions object. The property name for the new entry should be descriptive text, like that which is found in JS9.globalOpts.keyboardActions. The property value will be a function having the calling sequence:

      function(im, ipos, evt)

where:

- im: the image handle of the current image (or null)
- ipos: the current image position of the mouse
- evt: the event that triggered this action

For example:

      JS9.Keyboard.Actions["export image as a PNG file"] = function(im, ipos, evt){
        .... action implementation goes here ...
      };

Once this new action property has been defined, you can map it to a keypress event in JS9.globalOpts.keyboardActions:

      JS9.globalOpts.keyboardActions["x"] = "export image as a PNG file";

The new action will be shown in the Keyboard plugin display, and will be executed any time the "x" key is pressed.