The ToolEvent object is received by the Tool's mouse event handlers tool.onMouseDown, tool.onMouseDrag, tool.onMouseMove and tool.onMouseUp. The ToolEvent object is the only parameter passed to these functions and contains information about the mouse event.
Sample code:
function onMouseUp(event) {
// the position of the mouse when it is released
print(event.point);
}
Properties
The position of the mouse in document coordinates when the event was fired.
Sample code:
function onMouseDrag(event) {
// the position of the mouse when it is dragged
print(event.point);
}
function onMouseUp(event) {
// the position of the mouse when it is released
print(event.point);
}
- Returns:
- Point
The amount of force being applied by a pressure-sensitive input device, such as a graphic tablet.
- Returns:
- Number — the pressure as a value between 0 and 1
The number of times the mouse event was fired.
Sample code:
function onMouseDrag(event) {
// the amount of times the onMouseDrag event was fired
// since the last onMouseDown event
print(event.count);
}
function onMouseUp(event) {
// the amount of times the onMouseUp event was fired
// since the tool was activated
print(event.point);
}
- Returns:
- Number
- Returns:
- String ('mousedown', 'mouseup', 'mousedrag', 'mousemove', 'edit-options', 'select', 'deselect', 'reselect', 'decrease-diameter', 'increase-diameter')
Returns an object representing the state of various modifiers keys. These properties are supported: shift, control, option, meta, capsLock.
Sample code:
function onMouseDown(event) {
if(event.modifiers.shift) {
print('The shift key is down');
};
}
Read-only.
- Returns:
- KeyModifiers