en:code:device:mouse
Table of Contents
Mouse
This object allows you to simulate mouse actions.
Functions
Mouse
Constructor function.
Syntax
var myObject = new Mouse();
Methods
position
Returns the current position of the cursor.
Syntax
myObject.position();
Returns
- (Point) the current position of the cursor
move
Moves the mouse cursor.
Syntax
myObject.move(position);
Arguments
- position - (Point) the position where to move the mouse cursor
Returns
- (Mouse) this Mouse
isButtonPressed
Returns true if button is pressed.
Syntax
myObject.isButtonPressed(button);
Arguments
- button - (Button) the button to check
Returns
- (boolean) true if button is pressed
press
Presses a mouse button or the left button if no button is specified.
Syntax
myObject.press(button);
myObject.press();
Arguments
- button - (Button) the button to press
Returns
- (Mouse) this Mouse
Exceptions
- (PressButtonError) unable to press the button
release
Releases a mouse button or the left button if no button is specified.
Syntax
myObject.release(button);
myObject.release();
Arguments
- button - (Button) the button to release
Returns
- (Mouse) this Mouse
Exceptions
- (ReleaseButtonError) unable to release the button
click
Presses and releases a mouse button or the left button if no button is specified.
Syntax
myObject.click(button);
myObject.click();
Arguments
- button - (Button) the button to press and release
Returns
- (Mouse) this Mouse
Exceptions
- (ClickError) unable to press and release the button
wheel
Emulates a mouse wheel movement.
Syntax
myObject.wheel(intensity);
myObject.wheel();
Arguments
- intensity - (integer) the wheel movement intensity, positive is forward, negative is backward (default: 1)
Returns
- (Mouse) this Mouse
Exceptions
- (WheelError) unable to emulate a mouse wheel
Enumerations
Button
Mouse buttons.
Values
- LeftButton: left button
- MiddleButton: middle button
- RightButton: right button
en/code/device/mouse.txt · Last modified: 2021/02/13 11:23 by 127.0.0.1