Constructor
new Pointer(id, pointerType)
Each device is associated a unique ID
like mouse
, touch
, pen
.
Parameters:
Name | Type | Description |
---|---|---|
id |
string |
The unique ID of the device |
pointerType |
string |
It can be |
- Source:
Extends
Members
(static) Type
The types of pointer types, used to create the right type of pointer.
E.g. Pointer.Type.MOUSE
, Pointer.Type.PEN
or Pointer.Type.TOUCH
,
It actually returns:
{
MOUSE: 'mouse',
PEN: 'pen',
TOUCH: 'touch'
}
- Source:
(static) Button
The button types on a pointer.
It actually returns:
{ LEFT: 0, MIDDLE: 1, RIGHT: 2 }
- Source:
(static) Origin
The types of origins, used in Move()
commands. See Actions on how to use
this constant.
E.g. Pointer.Origin.VIEWPORT
or Pointer.Origin.POINTER
It actually returns:
{
VIEWPORT: 'viewport',
POINTER: 'pointer'
}
- Source:
Methods
Move(params)
Move the pointer to a specified origin
location, using x
and y
and offset, and taking duration
milliseconds
This method will be added to the action's tick
property. prefixed with the Pointer's ID.
Parameters:
Name | Type | Description | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
params |
Object |
Instructions on where to move the pointer Properties
|
- Source:
Example
// Defining a pointer device called "cucumber", and passing it
// to the actions constructor
var actions = new Actions( new Actions.Pointer('bigMouse'))
// the `cucumberMove` method is now available in the tick property
actions.tick.bigMouseMove({ x: 400, y: 400 })
Down(button)
Press a pointer button
This method will be added to the action's tick
property. prefixed with the Pointer's ID.
Parameters:
Name | Type | Default | Description |
---|---|---|---|
button |
number | Pointer.Button.LEFT |
The button to press. It can be |
- Source:
Example
var actions = new Actions( new Actions.Pointer('bigMouse'))
actions.tick.bigMouseDown()
actions.tick.bigMouseDown(Pointer.Button.RIGHT)
Up(button)
Release a pointer button
This method will be added to the action's tick
property. prefixed with the Pointer's ID.
Parameters:
Name | Type | Default | Description |
---|---|---|---|
button |
number | Pointer.Button.LEFT |
The button to let go |
- Source:
Example
var actions = new Actions( new Actions.Pointer('bigMouse'))
actions.tick.bigMouseUp()
actions.tick.bigMouseUp(Pointer.Button.RIGHT)
Cancel()
Cancels the pointer
This method will be added to the action's tick
property. prefixed with the Pointer's ID.
- Source:
Example
var bigMouse = new Actions.Pointer('bigMouse')
// This will take 4 seconds. NOTE: there is no await before actions.performActions
var actions = new Actions(bigMouse)
actions.tick.bigMouseDown().tick.bigMouseUp().tick.bigMouseCancel()
Pause(duration)
Pause the pointer for the specified length of time
This method will be added to the action's tick
property. prefixed with the Pointer's ID.
Parameters:
Name | Type | Default | Description |
---|---|---|---|
duration |
number | 0 |
Duration of the pause |
- Source: