PrizmDoc Viewer v13.7 - Updated
Class: MouseTool
API Reference > Viewer API > Class: MouseTool

Class: MouseTool

PCCViewer. MouseTool

This object represents an instance of a mouse tool. Each mouse tool is given a name and type when it is created. The name is used as a handle to the mouse tool. The type defines the behavior and properties of the mouse tool.

A named mouse tool is a global tool that is available to all viewers. Each viewer instance can access the same MouseTool object by name. This permits one mouse tool to be used by two different viewer instances at the same time.

Constructor

new MouseTool()

The MouseTool constructor is for internal use only. The appropriate way to create and register a new named mouse tool is to use the method PCCViewer.MouseTools.createMouseTool.

See:
Throws:

If the type is unknown. See PCCViewer.MouseTool.Type for a list of known tool types.

Type
RangeError
Example
// use the PCCViewer.MouseTools.createMouseTool(name, type) 
// function instead of this constructor.
PCCViewer.MouseTools.createMouseTool("myMouseTool", "LineAnnotation");

Members

(static, readonly) Type :string

This enumerable contains a list of all known tool types. There are used to create new PCCViewer.MouseTool objects, and are the known types returned PCCViewer.MouseTool#getType.

Type:
  • string
Properties:
Name Type Description
Magnifier string

Use the magnifier mouse tool type to display a magnifying glass on left click and drag.

SelectToZoom string

Use the select to zoom mouse tool type to select an area of the page to zoom in on.

Pan string

Use the pan mouse tool type to drag the image up, down, left, or right.

PanAndEdit string

Use the mouse or touch to drag the image up, down, left, or right. When clicking or touching over an annotation, the annotation will be selected, edited, moved, or resized, based on user actions.

SelectText string

Use the select text mouse tool type to select text in the document.

EditMarks string

Use the edit marks mouse tool type to select one or more marks (annotations and redactions) in the document. A mark can be clicked on for editing, or a rectangle can be drawn to select multiple marks.

LineAnnotation string

Use the line annotation tool mouse tool type to draw a line annotation.

RectangleAnnotation string

Use the rectangle annotation mouse tool type to draw a rectangle annotation.

EllipseAnnotation string

Use the ellipse annotation mouse tool type to draw an ellipse annotation.

TextAnnotation string

Use the text annotation mouse tool type to draw a text annotation.

StampAnnotation string

Use the stamp annotation mouse tool type to draw a stamp annotation.

HighlightAnnotation string

Use the highlight annotation mouse tool type to select text and create a highlight annotation.

TextHyperlinkAnnotation string

Use the text hyperlink annotation mouse tool type to select text and create a text hyperlink annotation.

FreehandAnnotation string

Use the freehand annotation tool mouse tool type to draw a freehand annotation.

RectangleRedaction string

Use the rectangle redaction mouse tool type to draw a rectangle redaction.

TransparentRectangleRedaction string

Use the transparent rectangle redaction mouse tool type to draw a transparent rectangle redaction.

TextRedaction string

Use the text redaction mouse tool type to draw a text redaction.

TextInputSignature string

Use the text input signature mouse tool type to draw a text input signature.

TextAreaSignature string

Use the text area signature mouse tool type to draw a text area signature.

StampRedaction string

Use the stamp redaction mouse tool type to draw a stamp redaction.

PlaceSignature string

Use to click on the document and place a signature in that location.

TextSelectionRedaction string

Use the TextSelectionRedaction mouse tool type to select text and create a text selection redaction.

ImageStampAnnotation string

Use the ImageStampAnnotation mouse tool type to place ImageStamp annotation.

ImageStampRedaction string

Use the ImageStampAnnotation mouse tool type to place ImageStamp redaction.

PolylineAnnotation string

Use the PolylineAnnotation mouse tool type to place Polyline annotation.

StrikethroughAnnotation string

Use the StrikethroughAnnotation mouse tool type to place Strikethrough annotation.

name :string

Gets the name of the mouse tool.

This is an ECMA 5 accessor property that is defined only in browsers supporting ECMA 5. This property is not available in the older browsers like IE8. For the greatest browser compatibility, use the corresponding getter method PCCViewer.MouseTool#getName.

Type:
  • string
See:
Example
// get the mouse tool's name
var mouseToolName = myMouseTool.name;

// do something with the name
alert("Mouse tool name is " + mouseToolName);

templateMark :PCCViewer.Mark

Gets the template mark associated with an annotation or redaction mouse tool.

This property is defined on MouseTool objects that are annotation or redaction types: LineAnnotation, RectangleAnnotation, EllipseAnnotation, TextAnnotation, StampAnnotation, HighlightAnnotation, RectangleRedaction, TransparentRectangleRedaction, TextRedaction, TextInputSignature, StampRedaction, TextHyperlinkAnnotation, StrikethroughAnnotation, TextAreaSignature.

This is an ECMA 5 accessor property that is defined only in browsers supporting ECMA 5. This property is not available in the older browsers like IE8. For the greatest browser compatibility, use the corresponding getter method PCCViewer.MouseTool#getTemplateMark.

Type:
See:
Example
var myMouseTool = PCCViewer.MouseTools.getMouseTool(mouseToolName);

// Check if templateMark is a property in the MouseTool object
if (templateMark in myMouseTool) {
    // get the template mark
    var templateMark = myMouseTool.templateMark;

    // Do something with the template mark. For example, set the color.
    if (templateMark.setColor) {
        templateMark.setColor("#FF0000");
    }
}

type :string

Gets the type of the mouse tool.

This is an ECMA 5 accessor property that is defined only in browsers supporting ECMA 5. This property is not available in the older browsers like IE8. For the greatest browser compatibility, use the corresponding getter method PCCViewer.MouseTool#getType.

Type:
  • string
See:
Example
var myMouseTool = PCCViewer.MouseTools.getMouseTool(mouseToolName);

// get the mouse tool's type
var mouseToolType = myMouseTool.type;

// do something with the type
switch (mouseToolType) {
    case PCCViewer.MouseTool.Type.LineAnnotation:
        ...
        break;
    default:
        ...
}

Methods

getName() → {string}

Gets the name of the mouse tool.

See:
Returns:

The name of the mouse tool.

Type
string
Example
// get the mouse tool's name
var mouseToolName = myMouseTool.getName();

// do something with the name
alert("Mouse tool name is " + mouseToolName);

getTemplateMark() → {PCCViewer.Mark}

Gets the template mark associated with an annotation or redaction mouse tool.

This method is defined on MouseTool objects that are annotation or redaction types: LineAnnotation, RectangleAnnotation, EllipseAnnotation, TextAnnotation, StampAnnotation, HighlightAnnotation, RectangleRedaction, TransparentRectangleRedaction, TextRedaction, TextInputSignature, StampRedaction, TextHyperlinkAnnotation, StrikethroughAnnotation, TextAreaSignature.

Returns:

The template mark for the mouse tool.

Type
PCCViewer.Mark
Example
var myMouseTool = PCCViewer.MouseTools.getMouseTool(mouseToolName);

// Check if getTemplateMark is defined
if (myMouseTool.getTemplateMark) {
    // get the template mark
    var templateMark = myMouseTool.getTemplateMark();

    // Do something with the template mark. For example, set the color.
    if (templateMark.setColor) {
        templateMark.setColor("#FF0000");
    }
}

getType() → {string}

Gets the type of the mouse tool.

See:
Returns:

The type of the mouse tool.

Type
string
Example
var myMouseTool = PCCViewer.MouseTools.getMouseTool(mouseToolName);

// get the mouse tool's type
var mouseToolType = myMouseTool.getType();

// do something with the type
switch (mouseToolType) {
    case PCCViewer.MouseTool.Type.LineAnnotation:
        ...
        break;
    default:
        ...
}