User Tools

Site Tools


en:code:device:mouse

This is an old revision of the document!


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

  1. 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

  1. 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

  1. 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

  1. 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

  1. 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

  1. 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

  1. LeftButton: left button
  2. MiddleButton: middle button
  3. RightButton: right button
en/code/device/mouse.1303332995.txt.gz · Last modified: 2021/02/13 11:23 (external edit)