Class pwlib.tools.text
The text tool.
Defined in: text.js.
Constructor Attributes | Constructor Name and Description |
---|---|
pwlib.tools.text(app)
|
Field Attributes | Field Name and Description |
---|---|
<private> <inner> |
Tells if the drawing canvas needs to be updated or not.
|
<private> <inner> |
Holds the previous tool ID.
|
<private> <inner> |
The interval ID used for invoking the drawing operation every few
milliseconds.
|
Method Attributes | Method Name and Description |
---|---|
activate()
The tool activation code.
|
|
click()
The
click event handler. |
|
The tool deactivation simply consists of removing the event listeners added
when the tool was constructed, and clearing the buffer canvas.
|
|
draw_moz()
Perform the drawing operation in Gecko 1.9.0.
|
|
Perform the drawing operation in Opera using SVG.
|
|
Perform the drawing operation using standard 2D context methods.
|
|
<inner> |
ev_configChange(ev)
The
configChange application event handler. |
<inner> |
The
configChange application event handler. |
<private> <inner> |
fontFamilyAdd(ev)
Add a new font family into the font family drop down.
|
<private> <inner> |
Initialize the SVG document for Opera.
|
keydown(ev)
The
keydown event handler allows users to press the
Escape key to cancel the drawing operation and return to the
previous tool. |
|
The
mousemove event handler. |
|
Tool preactivation code.
|
Class Detail
pwlib.tools.text(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>
{String}
prevTool
Holds the previous tool ID.
<private> <inner>
timer
The interval ID used for invoking the drawing operation every few
milliseconds.
- See:
- PaintWeb.config.toolDrawDelay
Method Detail
activate()
The tool activation code. This sets up a few variables, starts the drawing
timer and adds event listeners as needed.
click()
The
click
event handler. This method completes the drawing
operation by inserting the text into the layer canvas.
deactivate()
The tool deactivation simply consists of removing the event listeners added
when the tool was constructed, and clearing the buffer canvas.
draw_moz()
Perform the drawing operation in Gecko 1.9.0.
draw_opera()
Perform the drawing operation in Opera using SVG.
draw_spec()
Perform the drawing operation using standard 2D context methods.
- See:
- PaintWeb.config.toolDrawDelay
<inner>
ev_configChange(ev)
The
configChange
application event handler. This is also the
input
and change
event handler for the text
string input element. This method updates the Canvas text-related
properties as needed, and re-renders the text.
This function is not used on Opera.
- Parameters:
- {Event|pwlib.appEvent.configChange} ev
- The application/DOM event object.
<inner>
ev_configChange_opera(ev)
The
configChange
application event handler. This is also the
input
and change
event handler for the text
string input element. This method updates the Canvas text-related
properties as needed, and re-renders the text.
This is function is specific to Opera.
- Parameters:
- {Event|pwlib.appEvent.configChange} ev
- The application/DOM event object.
<private> <inner>
fontFamilyAdd(ev)
Add a new font family into the font family drop down. This function is
invoked by the
ev_configChange()
function when the user
attempts to add a new font family.
- Parameters:
- {pwlib.appEvent.configChange} ev
- The application event object.
<private> <inner>
initOpera()
Initialize the SVG document for Opera. This is used for rendering the text.
{Boolean}
keydown(ev)
The
keydown
event handler allows users to press the
Escape key to cancel the drawing operation and return to the
previous tool.
- Parameters:
- {Event} ev
- The DOM Event object.
- Returns:
- {Boolean} True if the key was recognized, or false if not.
mousemove()
The
mousemove
event handler.
{Boolean}
preActivate()
Tool preactivation code. This method check if the browser has support for
rendering text in Canvas.
- Returns:
- {Boolean} True if the tool can be activated successfully, or false if not.