Class Index | File Index

Classes


Class Painter

The paint tool application object.
Defined in: index.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
Field Summary
Field Attributes Field Name and Description
 
Holds the buffer canvas and context references.
<private>  
Holds references to important DOM elements.
<private> <inner>  
Holds the keyboard event listener object.
 
Holds the current layer ID, canvas and context references.
 
The instance of the active tool object.
Method Summary
Method Attributes Method Name and Description
<private> <inner>  
The Canvas event handler.
<private> <inner>  
The global keyboard events handler.
<private> <inner>  
The event handler for any changes made to the tool selector.
<private> <inner>  
init()
Initialize the paint application.
 
This method draws the buffer canvas on top of the current image layer, after which the buffer is cleared.
 
Activate a drawing tool by ID.
Class Detail
Painter()
Field Detail
{Object} buffer
Holds the buffer canvas and context references.

<private> {Object} elems
Holds references to important DOM elements.

<private> <inner> {lib.dom.KeyboardEventListener} kbListener_
Holds the keyboard event listener object.
See:
lib.dom.KeyboardEventListener The class dealing with the cross-browser differences in the DOM keyboard events.

{Object} layer
Holds the current layer ID, canvas and context references.

{Object} tool
The instance of the active tool object.
See:
PainterConfig.tool_default holds the ID of the tool which is activated when the application loads.
Method Detail
<private> <inner> ev_canvas(ev)
The Canvas event handler.

This method determines the mouse position relative to the canvas element, after which it invokes the method of the currently active tool with the same name as the current event type. For example, for the mousedown event the tool.mousedown() method is invoked.

The mouse coordinates are added to the ev DOM Event object: ev.x_ and ev.y_.

Parameters:
{Event} ev
The DOM Event object.
Returns:
The result returned by the event handler of the current tool. If no event handler was executed, false is returned.

<private> <inner> ev_keyhandler(ev)
The global keyboard events handler. This makes all the keyboard shortcuts work in the web application.

This method determines the key the user pressed, based on the ev DOM Event object, taking into consideration any browser differences. One new property is added to the ev object:

In PainterConfig.keys one can setup the keyboard shortcuts. If the keyboard combination is found in that list, then the associated tool is activated.

Parameters:
{Event} ev
The DOM Event object.
See:
PainterConfig.keys The keyboard shortcuts configuration.
lib.dom.KeyboardEventListener The class dealing with the cross-browser differences in the DOM keyboard events.

<private> <inner> ev_tool_change()
The event handler for any changes made to the tool selector.
See:
Painter#toolActivate The method which does the actual drawing tool activation.

<private> <inner> init()
Initialize the paint application.

layerUpdate()
This method draws the buffer canvas on top of the current image layer, after which the buffer is cleared. This function is called each time when the user completes a drawing operation.

{Boolean} toolActivate(id)
Activate a drawing tool by ID.

The id provided must be available in the global PaintTools object.

Parameters:
{String} id
The ID of the drawing tool to be activated.
Returns:
{Boolean} True if the tool has been activated, or false if not.
See:
PaintTools The object holding all the drawing tools.

Documentation generated by JsDoc Toolkit 2.1.0 on Wed Apr 22 2009 15:45:35 GMT+0300 (EEST)