Class pwlib.tools.polygon
The polygon tool.
Defined in: polygon.js.
Constructor Attributes | Constructor Name and Description |
---|---|
pwlib.tools.polygon(app)
|
Field Attributes | Field Name and Description |
---|---|
<private> <inner> |
Tells if the drawing canvas needs to be updated or not.
|
<private> <inner> |
Holds the points in the polygon being drawn.
|
<private> <inner> |
Tells if the Shift key is down or not.
|
<private> <inner> |
The interval ID used for invoking the drawing operation every few
milliseconds.
|
Method Attributes | Method Name and Description |
---|---|
The tool deactivation method, used for clearing the buffer.
|
|
draw(ev)
Draw the polygon.
|
|
keydown(ev)
The
keydown event handler. |
|
mousedown(ev)
The
mousedown event handler. |
|
mousemove(ev)
Store the Shift key state which is used by the drawing function.
|
|
mouseup(ev)
The
mouseup event handler. |
Class Detail
pwlib.tools.polygon(app)
- Parameters:
- {PaintWeb} app
- Reference to the main paint application object.
Field Detail
<private> <inner>
{Boolean}
needsRedraw
Tells if the drawing canvas needs to be updated or not.
- Default Value:
- false
<private> <inner>
{Array}
points
Holds the points in the polygon being drawn.
<private> <inner>
{Boolean}
shiftKey
Tells if the Shift key is down or not. This is used by the
drawing function.
- Default Value:
- false
<private> <inner>
timer
The interval ID used for invoking the drawing operation every few
milliseconds.
- See:
- PaintWeb.config.toolDrawDelay
Method Detail
deactivate()
The tool deactivation method, used for clearing the buffer.
draw(ev)
Draw the polygon.
- Parameters:
- ev
- See:
- PaintWeb.config.toolDrawDelay
{Boolean}
keydown(ev)
The
keydown
event handler. This method allows the user to
cancel drawing the current polygon, using the Escape key. The
Enter key can be used to accept the current polygon shape, and
end the drawing operation.
- Parameters:
- {Event} ev
- The DOM Event object.
- Returns:
- {Boolean} True if the keyboard shortcut was recognized, or false if not.
{Boolean}
mousedown(ev)
The
mousedown
event handler.
- Parameters:
- {Event} ev
- The DOM Event object.
- Returns:
- {Boolean} True if the event handler executed, or false if not.
mousemove(ev)
Store the Shift key state which is used by the drawing function.
- Parameters:
- {Event} ev
- The DOM Event object.
{Boolean}
mouseup(ev)
The
mouseup
event handler.
- Parameters:
- {Event} ev
- The DOM Event object.
- Returns:
- {Boolean} True if the event handler executed, or false if not.