Class Index | File Index

Classes


Class pwlib.tools.cpicker

The color picker tool.
Defined in: cpicker.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
Field Summary
Field Attributes Field Name and Description
<private> <inner>  
Tells if the current color values are accepted by the user.
<private> <inner>  
Tells if the color mixer is active for the current target input.
<private> <inner>  
Holds the previous color values - before the user started picking a different color.
<private> <inner>  
Holds the ID of the previously active tool.
<private> <inner>  
Holds a reference to the target color input.
Method Summary
Method Attributes Method Name and Description
 
The activate event handler.
 
The contextmenu event handler.
 
The deactivate event handler.
 
keydown(ev)
The keydown event handler.
 
The mousedown event handler.
 
mouseup(ev)
The mouseup event handler.
 
The preActivate event handler.
<inner>  
updateColor(ev, usePrevColor)
Perform color update.
<private> <inner>  
Store the color values from the target color input, before this tool changes the colors.
Class Detail
pwlib.tools.cpicker(app)
Parameters:
{PaintWeb} app
Reference to the main paint application object.
Field Detail
<private> <inner> {Boolean} colorAccepted
Tells if the current color values are accepted by the user. This value is used by the tool deactivation code.

<private> <inner> {Boolean} colormixerActive
Tells if the color mixer is active for the current target input.

<private> <inner> {Object} prevColor
Holds the previous color values - before the user started picking a different color.

<private> <inner> {String} prevTool
Holds the ID of the previously active tool. Once the user completes the color picking operation, the previous tool is activated.

<private> <inner> {pwlib.guiColorInput} targetInput
Holds a reference to the target color input. This is a GUI color input component.
Method Detail
activate()
The activate event handler. This method determines the current target input in the Color Mixer, if any. Canvas shadow rendering is disallowed.

contextmenu()
The contextmenu event handler. This method only cancels the context menu.

deactivate()
The deactivate event handler. This method allows shadow rendering again, and resets the color input values if the user did not accept the new color.

{Boolean} keydown(ev)
The keydown event handler. This method allows the user to press the Escape key to cancel the color picking operation. By doing so, the original color values are restored.
Parameters:
{Event} ev
The DOM Event object.
Returns:
{Boolean} True if the keyboard shortcut was recognized, or false if not.

mousedown(ev)
The mousedown event handler. This method starts the color picking operation.
Parameters:
{Event} ev
The DOM Event object.

mouseup(ev)
The mouseup event handler. This method completes the color picking operation, and activates the previous tool.

The pwlib.appEvent.configChange application event is also dispatched for the configuration property associated to the target input.

Parameters:
{Event} ev
The DOM Event object.

preActivate()
The preActivate event handler. This method checks if the browser implements the getImageData() context method. If not, the color picker tool cannot be used.

<inner> updateColor(ev, usePrevColor)
Perform color update. This function updates the target input or the Color Mixer to hold the color value under the mouse - it actually performs the color picking operation.

This function is also the mousemove event handler for this tool.

Parameters:
{Event} ev
The DOM Event object.
{Boolean} usePrevColor Optional, Default: false
Tells the function to use the previous color values we have stored. This is used when the user cancels the color picking operation.

<private> <inner> updatePrevColor()
Store the color values from the target color input, before this tool changes the colors. The previous color values are used when the user decides to cancel the color picking operation.

Documentation generated by JsDoc Toolkit 2.3.0 on Sat Jun 26 2010 21:57:02 GMT+0300 (EEST)