new SignatureCreateTool(docViewer)
Creates a new instance of the SignatureCreateTool.
Parameters:
Name | Type | Description |
---|---|---|
docViewer |
CoreControls.DocumentViewer | an instance of DocumentViewer. |
Properties:
Name | Type | Description |
---|---|---|
ctx |
CanvasRenderingContext2D | The signature canvas context |
freeHandAnnot |
Annotations.FreeHandAnnotation | The underlying annotation used by the tool |
Extends
Methods
-
addDefaultSignature()
-
Adds the default signature to the document.
-
addSignature(makeDefault)
-
Add the signature to the document.
Parameters:
Name Type Description makeDefault
boolean Whether to make this signature the default signature
Returns:
Whether the signature was added. Will return false if there are no paths drawn.
- Type
- boolean
-
clearSignatureCanvas()
-
Clears the signature canvas.
-
contextMenu(e)
-
The function called when a context menu should be shown. Use e.preventDefault to disable the default browser context menu
Parameters:
Name Type Description e
the event object
- Inherited From:
-
drawBackground()
-
Draws the background on the signature canvas. Override this function for a custom background.
-
getDocumentViewer()
-
Returns the instance of DocumentViewer for this tool.
- Inherited From:
Returns:
the instance of DocumentViewer for this tool.
-
hasDefaultSignature()
-
Checks if a default signature has been assigned.
Returns:
The default signature data is an array of arrays
- Type
- Array.<Array>
-
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:
Name Type Description paths
Array.<Array> 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
-
isEmptySignature()
-
Checks if there are any paths drawn. Returns true if there are no paths.
Returns:
If number of drawn paths is 0.
- Type
- boolean
-
keyDown(e)
-
The function called when a keyboard key is down.
Parameters:
Name Type Description e
the event object containing keyboard key data.
- Inherited From:
-
mouseDoubleClick(e)
-
The function called when the mouse left button is double clicked.
Parameters:
Name Type Description e
the event object containing mouse coordinates.
- Inherited From:
-
mouseLeftDown(e)
-
The function called when the left mouse button is down
Parameters:
Name Type Description e
the event object containing mouse coordinates.
- Inherited From:
-
mouseLeftUp(e)
-
The function called when the left mouse button is up. Typically, annotations are created and added to the annotation manager at this point.
Parameters:
Name Type Description e
the event object containing mouse coordinates.
- Inherited From:
-
mouseMove(e)
-
The function called when the mouse moves.
Parameters:
Name Type Description e
the event object containing mouse coordinates.
- Inherited From:
-
openSignature()
-
Notify the signature tool that the signature is being viewed.
-
setSignatureCanvas(canvas)
-
Sets the canvas to be used by the signature tool.
Parameters:
Name Type Description canvas
canvas The canvas that the signature tool uses to draw on.
-
switchIn(oldTool)
-
The function called when this tool is selected. Typically use for changing mouse cursors, and initializing states for the tool.
Parameters:
Name Type Description oldTool
Tools.Tool the Tool class that was previously selected.
- Inherited From:
-
switchOut(newTool)
-
The function called when this tool is deselected. Typically use for changing mouse cursors, and cleaning up states for the tool.
Parameters:
Name Type Description newTool
Tools.Tool the Tool class that was newly selected.
- Inherited From:
Events
-
annotationAdded
-
Triggered when an annotation has been added to the document by the tool
Parameters:
Name Type Description evt
object Event object
annotation
Annotations.Annotation The annotation that was added
-
locationSelected
-
Triggered when a page location has been clicked on by the tool
Parameters:
Name Type Description evt
object Event object
pageCoordinates
Tools.PageCoordinate Indicates where the tool clicked
-
saveDefault
-
Triggered when the tool saves a signature as the default
Parameters:
Name Type Description evt
object Event object
paths
Array.<Array> An array of arrays that contains the coordinates of the signature points