Class Tools.SignatureCreateTool
Extends
Tools.Tool.
Represents the tool for creating a Signature which is represented by an Annotations.FreeHandAnnotation.
Constructor Attributes | Constructor Name and Description |
---|---|
Tools.SignatureCreateTool(docViewer)
Creates a new instance of the SignatureCreateTool.
|
Field Attributes | Field Name and Description |
---|---|
The signature canvas context
|
|
The underlying annotation used by the tool
|
- Fields borrowed from class Tools.Tool:
- docViewer, pageCoordinates
Method Attributes | Method Name and Description |
---|---|
Adds the default signature to the document.
|
|
addSignature(makeDefault)
Add the signature to the document.
|
|
Clears the signature canvas.
|
|
Draws the background on the signature canvas.
|
|
Checks if a default signature has been assigned.
|
|
Initializes the underlying annotation for the signature.
|
|
initDefaultSignature(paths)
Initialize the default signature.
|
|
Checks if there are any paths drawn.
|
|
Notify the signature tool that the signature is being viewed.
|
|
setSignatureCanvas(canvas)
Sets the canvas to be used by the signature tool.
|
- Methods borrowed from class Tools.Tool:
- contextMenu, getDocumentViewer, keyDown, mouseDoubleClick, mouseLeftDown, mouseLeftUp, mouseMove, switchIn, switchOut
Event Attributes | Event Name and Description |
---|---|
annotationAdded(evt, annotation)
Triggered when an annotation has been added to the document by the tool
|
|
locationSelected(evt, pageCoordinates)
Triggered when a page location has been clicked on by the tool
|
|
saveDefault(evt, paths)
Triggered when the tool saves a signature as the default
|
Class Detail
Tools.SignatureCreateTool(docViewer)
Creates a new instance of the SignatureCreateTool.
- Parameters:
- {CoreControls.DocumentViewer} docViewer
- an instance of DocumentViewer.
Field Detail
{CanvasRenderingContext2D}
ctx
The signature canvas context
{Annotations.FreeHandAnnotation}
freeHandAnnot
The underlying annotation used by the tool
Method Detail
addDefaultSignature()
Adds the default signature to the document.
{boolean}
addSignature(makeDefault)
Add the signature to the document.
- Parameters:
- {boolean} makeDefault
- Whether to make this signature the default signature
- Returns:
- {boolean} Whether the signature was added. Will return false if there are no paths drawn.
clearSignatureCanvas()
Clears the signature canvas.
drawBackground()
Draws the background on the signature canvas. Override this function for
a custom background.
{array[array]}
hasDefaultSignature()
Checks if a default signature has been assigned.
- Returns:
- {array[array]} The default signature data is an array of arrays
initAnnot()
Initializes the underlying annotation for the signature. Can be extended to
customize the appearance of the signature.
initDefaultSignature(paths)
Initialize the default signature.
- Parameters:
- {array[array]} paths
- Expects an array of arrays where each array corresponds to a path and each object in the array is an object with an x and y property
{boolean}
isEmptySignature()
Checks if there are any paths drawn. Returns true if there are no paths.
- Returns:
- {boolean} If number of drawn paths is 0.
openSignature()
Notify the signature tool that the signature is being viewed.
setSignatureCanvas(canvas)
Sets the canvas to be used by the signature tool.
- Parameters:
- {canvas} canvas
- The canvas that the signature tool uses to draw on.
Event Detail
annotationAdded(evt, annotation)
Triggered when an annotation has been added to the document by the tool
- Parameters:
- {object} evt
- Event object
- {Annotations.Annotation} annotation
- The annotation that was added
locationSelected(evt, pageCoordinates)
Triggered when a page location has been clicked on by the tool
- Parameters:
- {object} evt
- Event object
- {Tools.PageCoordinate} pageCoordinates
- Indicates where the tool clicked
saveDefault(evt, paths)
Triggered when the tool saves a signature as the default
- Parameters:
- {object} evt
- Event object
- {array[array]} paths
- An array of arrays that contains the coordinates of the signature points