Class Painter
The paint tool application object.
Defined in: index.js.
Constructor Attributes | Constructor Name and Description |
---|---|
Painter()
|
Field Attributes | Field Name and Description |
---|---|
Holds the buffer canvas and context references.
|
|
Holds the current layer ID, canvas and context references.
|
|
The instance of the active tool object.
|
|
The default tool ID.
|
Method Attributes | Method Name and Description |
---|---|
<private> <inner> |
ev_canvas(ev)
The Canvas event 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.
|
Field Detail
{Object}
buffer
Holds the buffer canvas and context references.
{Object}
layer
Holds the current layer ID, canvas and context references.
{Object}
tool
The instance of the active tool object.
- See:
- Painter#tool_default holds the ID of the tool which is activated when the application loads.
- PaintTools The object which holds the implementation of each drawing tool.
{String}
tool_default
The default tool ID.
- See:
- PaintTools The object which holds the implementation of each drawing tool.
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.
<private> <inner>
ev_tool_change()
The event handler for any changes made to the tool selector.
<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.