Maps from keycodes to functions for pressed control keys.
Maps from keycodes to functions for pressed control and shift keys.
Specifies if events are handled. Default is true.
Reference to the Graph associated with this handler.
Maps from keycodes to functions for non-pressed control keys.
Maps from keycodes to functions for pressed shift keys.
Reference to the target DOM, that is, the DOM node where the key event listeners are installed.
Hook to process ESCAPE keystrokes. This implementation invokes Graph#stopEditing to cancel the current editing, connecting and/or other ongoing modifications.
Key event that represents the keystroke. Possible keycode in this case is 27 (ESCAPE).
Returns true if the given event should be handled.
Key event that represents the keystroke.
Returns true if the event should be processed by this handler, that is,
if the event source is either the target, one of its direct children, a
descendant of the Graph#container, or the Graph#cellEditor of the
Key event that represents the keystroke.
Event handler that listens to keystroke events. This is not a singleton, however, it is normally only required once if the target is the document element (default).
This handler installs a key event listener in the topmost DOM node and processes all events that originate from descandants of Graph#container or from the topmost DOM node. The latter means that all unhandled keystrokes are handled by this object regardless of the focused state of the.
Example:
The following example creates a key handler that listens to the delete key (46) and deletes the selection cells if the graph is enabled.
Keycodes:
See http://tinyurl.com/yp8jgl or http://tinyurl.com/229yqw for a list of keycodes or install a key event listener into the document element and print the key codes of the respective events to the console.
To support the Command key and the Control key on the Mac, the following code can be used.
Constructor: KeyHandler
Constructs an event handler that executes functions bound to specific keystrokes.
Param: graph
Reference to the associated Graph.
Param: target
Optional reference to the event target. If null, the document element is used as the event target, that is, the object where the key event listener is installed.