Class PaintMouseKeys
The MouseKeys action.
Defined in: mousekeys.js.
Constructor Attributes | Constructor Name and Description |
---|---|
PaintMouseKeys(app)
|
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 Attributes | Method Name and Description |
---|---|
Handles action removal.
|
|
<private> <inner> |
dispatch(type, ev)
Dispatch a synthetic event to the buffer canvas element.
|
keydown(ev)
The
keydown event handler. |
|
keypress(ev)
The
keypress event handler. |
|
<inner> |
pointerMousemove(ev)
Track the virtual pointer coordinates, by updating the position of the
pointer element.
|
- Parameters:
- {Painter} app
- Reference to the main paint application object.
- See:
- PainterConfig.mousekeys_accel The mouse keys acceleration setting.
- Parameters:
- {String} type
- The mouse event type to dispatch.
- {Event} ev
- The original DOM Event object.
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 param
property. Support for the "Toggle" parameter is implemented. This parameter
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.
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:
- PainterConfig.keys The keyboard shortcuts configuration object.
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 param 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:
- PainterConfig.keys The keyboard shortcuts configuration object.
- Parameters:
- {Event} ev
- The DOM Event object.