API Reference
Namespaces
Classes
Events
Global
Externals

Class: KeystrokeHub

CIQ.UI. KeystrokeHub


new KeystrokeHub( [node], context [, params])

UI Helper for capturing and handling keystrokes.

A helper or ContextTag can "claim" keystrokes and intercept them, otherwise the keystrokes will be handled by keyup and keydown events.

Parameters:
Name Type Argument Description
node HTMLElement <optional>

The node or selector to which to attach. Defaults to document which means that hot keys will act globally. If set to any other element (selector) then hot keys will only function when the mouse is hovering over that element.

context CIQ.UI.Context

The context for the chart

params Object <optional>

Parameters to drive the helper

Properties
Name Type Argument Description
cb function <optional>

Callback to handle hot keys.

Since:
  • 5.1.0 Setting node to anything other than document allows keystrokes to be restricted by hover focus.

Methods


setActiveContext(context)

Change the active context for the hub, for instance when dealing with multiple charts.

Parameters:
Name Type Description
context CIQ.UI.Context

The context


addHotKeyHandler(identifier, handler, stx)

Global method to add a hot key handler. Hot keys are defined in hotkeyConfig.hotkeys in js/defaultConfiguration.js).

Parameters:
Name Type Description
identifier string

Name identifying the keystroke handler

handler function

Function to call when the hot key combination is pressed.

stx CIQ.ChartEngine

A reference to the chart engine.


defaultHotKeys(key, hub, e)

Global default hotkey method. Pass this or your own method in to CIQ.UI.KeystrokeHub

Parameters:
Name Type Description
key number

The pressed key

hub CIQ.UI.KeystrokeHub

The hub that processed the key

Properties
Name Type Description
hotkeyConfig Object

Hotkey settings options

hotkeys Object

Specifies the default hotkeys

e KeyboardEvent

The KeyboardEvent that triggered the function call

Returns:

Return true if you captured the key

Type
boolean

executeHotkeyCommand(params)

Default hotkey execution. Called from CIQ.UI.KeystrokeHub.defaultHotKeys.

Parameters:
Name Type Description
params object
Properties
Name Type Argument Description
stx CIQ.ChartEngine

A reference to the chart engine.

action string

The action to execute

options object <optional>

Any options specified in the config

Returns:

Return true if command was executed, false if invalid command

Type
boolean