ImageGear .NET - Updated
IPCC.MouseTool
API Reference > ViewerControl API > IPCC.MouseTool

Class: MouseTool

IPCC.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 IPCC.MouseTools.createMouseTool.
See:
Throws:
If the type is unknown. See IPCC.MouseTool.Type for a list of known tool types.
Type
RangeError
Example
// use the IPCC.MouseTools.createMouseTool(name, type) 
// function instead of this constructor.
IPCC.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 IPCC.MouseTool objects, and are the known types returned IPCC.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
EditMarks string Use the edit marks mouse tool type to select one or more marks (annotations) 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.
PolylineAnnotation string Use the PolylineAnnotation mouse tool type to place Polyline annotation.
PolygonAnnotation string Use the PolygonAnnotation mouse tool type to place Polygon 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 IPCC.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 :IPCC.Mark

Gets the template mark associated with an annotation. This property is defined on MouseTool objects that are annotation: `LineAnnotation`, `RectangleAnnotation`, `EllipseAnnotation`, `TextAnnotation`. _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 IPCC.MouseTool#getTemplateMark._
Type:
See:
Example
var myMouseTool = IPCC.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 IPCC.MouseTool#getType._
Type:
  • string
See:
Example
var myMouseTool = IPCC.MouseTools.getMouseTool(mouseToolName);

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

// do something with the type
switch (mouseToolType) {
    case IPCC.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() → {IPCC.Mark}

Gets the template mark associated with an annotation mouse tool. This method is defined on MouseTool objects that are annotation types: `LineAnnotation`, `RectangleAnnotation`, `EllipseAnnotation`, `TextAnnotation`.
Returns:
The template mark for the mouse tool.
Type
IPCC.Mark
Example
var myMouseTool = IPCC.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 = IPCC.MouseTools.getMouseTool(mouseToolName);

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

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