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.

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


<static> defaultHotKeys(key, hub)

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

Returns:

Return true if you captured the key

Type
boolean

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