Class pwlib.tools.line
The line tool.
Defined in: line.js.
Constructor Attributes | Constructor Name and Description |
---|---|
pwlib.tools.line(app)
|
Field Attributes | Field Name and Description |
---|---|
<private> <inner> |
Tells if the drawing canvas needs to be updated or not.
|
<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.
|
<private> <inner> |
Holds the starting point on the x axis of the image, for the
current drawing operation.
|
<private> <inner> |
Holds the starting point on the y axis of the image, for the
current drawing operation.
|
Method Attributes | Method Name and Description |
---|---|
Tool deactivation event handler.
|
|
draw()
Perform the drawing operation.
|
|
keydown(ev)
Allows the user to press Escape to cancel the drawing operation.
|
|
mousedown(ev)
Initialize the drawing operation, by storing the location of the pointer,
the start position.
|
|
mousemove(ev)
Store the Shift key state which is used by the drawing function.
|
|
mouseup(ev)
End the drawing operation, once the user releases the mouse button.
|
Class Detail
pwlib.tools.line(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>
{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
<private> <inner>
{Number}
x0
Holds the starting point on the x axis of the image, for the
current drawing operation.
<private> <inner>
{Number}
y0
Holds the starting point on the y axis of the image, for the
current drawing operation.
Method Detail
deactivate()
Tool deactivation event handler.
draw()
Perform the drawing operation. This function is called every few
milliseconds.
Hold down the Shift key to draw a straight horizontal/vertical line.
Press Escape to cancel the drawing operation.
- See:
- PaintWeb.config.toolDrawDelay
{Boolean}
keydown(ev)
Allows the user to press Escape to cancel the drawing operation.
- Parameters:
- {Event} ev
- The DOM Event object.
- Returns:
- {Boolean} True if the drawing operation was cancelled, or false if not.
mousedown(ev)
Initialize the drawing operation, by storing the location of the pointer,
the start position.
- Parameters:
- {Event} ev
- The DOM Event object.
mousemove(ev)
Store the Shift key state which is used by the drawing function.
- Parameters:
- {Event} ev
- The DOM Event object.
mouseup(ev)
End the drawing operation, once the user releases the mouse button.
- Parameters:
- {Event} ev
- The DOM Event object.