Class Index | File Index

Classes


Class pwlib.extensions.mousekeys

The MouseKeys extension.
Defined in: mousekeys.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
Field Summary
Field Attributes Field Name and Description
<private> <inner>  
Holds the current mouse movement acceleration, taken from the configuration.
<private> <inner>  
Holds a reference to the DOM element representing the pointer on top of the canvas element.
<private> <inner>  
Holds the current mouse movement speed in pixels.
Method Summary
Method Attributes Method Name and Description
 
The extensionRegister event handler.
 
The extensionUnregister event handler.
 
keydown(ev)
The keydown event handler.
 
The keypress event handler.
 
keyup(ev)
The keyup event handler.
<inner>  
Track the virtual pointer coordinates, by updating the position of the pointer element.
Class Detail
pwlib.extensions.mousekeys(app)
Parameters:
{PaintWeb} app
Reference to the main paint application object.
Field Detail
<private> <inner> {Number} accel
Holds the current mouse movement acceleration, taken from the configuration.
See:
PaintWeb.config.mousekeys.accel The mouse keys acceleration setting.

<private> <inner> {Element} pointer
Holds a reference to the DOM element representing the pointer on top of the canvas element.

<private> <inner> {Number} speed
Holds the current mouse movement speed in pixels.
Method Detail
{Boolean} extensionRegister()
The extensionRegister event handler. This initializes the extension by adding the pointer DOM element and by setting up the keyboard shortcuts.
Returns:
{Boolean} True if the extension initialized successfully, or false if not.

extensionUnregister()
The extensionUnregister event handler. This will remove the pointer DOM element and the canvas event listener.

{Boolean} keydown(ev)
The keydown event handler.

This method requires a DOM Event object which has the ev.kobj_ object reference from the keyboard shortcuts configuration. The kobj_ object must have the action property. Support for the "ButtonToggle" and the "ButtonClick" actions is implemented.

The "ButtonToggle" action essentially means that a mouse event will be generated, either mousedown or mouseup. By alternating these two events, this method allows the user to start and stop the drawing operation at any moment using the keyboard shortcut they have configured.

Under typical usage, the "ButtonClick" action translates the keydown event to mousedown. The keyup event handler will also fire the mouseup event. This allows the user to simulate holding down the mouse button, while he/she holds down a key.

A click event is always fired after the firing of a mouseup event.

Irrespective of the key the user pressed, this method does always reset the speed and acceleration of the pointer movement.

Parameters:
{Event} ev
The DOM Event object.
Returns:
{Boolean} True if the keyboard shortcut was recognized, or false if not.
See:
PaintWeb.config.mousekeys.actions The keyboard shortcuts configuration object.

{Boolean} keypress(ev)
The keypress event handler.

This method requires a DOM Event object with a ev.kobj_ object reference to the keyboard shortcut configuration. The keyboard shortcut configuration object must have the action property.

This event handler implements support for the following param values: "SouthWest", "South", "SouthEast", "West", "East", "NorthWest", "North" and "NorthEast", All of these values indicate the movement direction. This method generates synthetic movemove events based on the direction desired, effectively emulating the use of a real pointing device.

Parameters:
{Event} ev
The DOM Event object.
Returns:
{Boolean} True if the keyboard shortcut was recognized, or false if not.
See:
PaintWeb.config.mousekeys.actions The keyboard shortcuts configuration object.

{Boolean} keyup(ev)
The keyup event handler.

This method requires a DOM Event object which has the ev.kobj_ object reference from the keyboard shortcuts configuration. The kobj_ object must have the action property. Support for the "ButtonClick" action is implemented.

Under typical usage, the "ButtonClick" action translates the keydown event to mousedown. This event handler fires the mouseup event. This allows the user to simulate holding down the mouse button, while he/she holds down a key.

A click event is always fired after the firing of the mouseup event.

Parameters:
{Event} ev
The DOM Event object.
Returns:
{Boolean} True if the keyboard shortcut was recognized, or false if not.
See:
PaintWeb.config.mousekeys.actions The keyboard shortcuts configuration object.

<inner> pointerMousemove(ev)
Track the virtual pointer coordinates, by updating the position of the pointer element. This allows the keyboard users to see where they moved the virtual pointer.
Parameters:
{Event} ev
The DOM Event object.

Documentation generated by JsDoc Toolkit 2.3.0 on Sat Jun 26 2010 21:57:01 GMT+0300 (EEST)