Sg 2.9
ToolEvent
Packages RSS
About
News
Gallery
Scripts
Tutorials
Download
Reference
Forum
Users
License
Twitter

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);
}

The position of the mouse in document coordinates when the previous event was fired.

The position of the mouse in document coordinates when the mouse button was last clicked.

The point in the middle between lastPoint and point. This is a useful position to use when creating artwork based on the moving direction of the mouse, as returned by delta.

The difference between the current position and the last position of the mouse when the event was fired. In case of the mouse-up event, the difference to the mouse-down position is returned.

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.

AltStyle によって変換されたページ (->オリジナル) /