> ## Documentation Index
> Fetch the complete documentation index at: https://docs.simular.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# MouseController

# Class: MouseController

Defined in: [index.d.ts:697](https://github.com/simular-ai/simulang-js-internal/blob/d2b85c3277cbb16ce50c0781e1db8ad2c8a5690e/index.d.ts#L697)

Contains functions to control the mouse and to get the location of
the cursor. A cartesian coordinate system is used for specifying
coordinates. The origin is located in the top-left corner of the
current screen, with positive values extending along the axes down
and to the right of the origin point and it is measured in pixels.
The same coordinate system is used on all operating systems.

## Constructors

### Constructor

> **new MouseController**(): `MouseController`

Defined in: [index.d.ts:698](https://github.com/simular-ai/simulang-js-internal/blob/d2b85c3277cbb16ce50c0781e1db8ad2c8a5690e/index.d.ts#L698)

#### Returns

`MouseController`

## Methods

### button()

> **button**(`button`, `direction`): `void`

Defined in: [index.d.ts:704](https://github.com/simular-ai/simulang-js-internal/blob/d2b85c3277cbb16ce50c0781e1db8ad2c8a5690e/index.d.ts#L704)

Sends an individual mouse button event. You can use this for
example to simulate a click of the left mouse key. Some of the
buttons are specific to a platform.

#### Parameters

##### button

[`Button`](../enumerations/Button.mdx)

##### direction

[`Direction`](../enumerations/Direction.mdx)

#### Returns

`void`

***

### location()

> **location**(): \[`number`, `number`]

Defined in: [index.d.ts:729](https://github.com/simular-ai/simulang-js-internal/blob/d2b85c3277cbb16ce50c0781e1db8ad2c8a5690e/index.d.ts#L729)

Get the location of the mouse in pixels.

#### Returns

\[`number`, `number`]

***

### moveMouse()

> **moveMouse**(`x`, `y`, `coordinate`): `void`

Defined in: [index.d.ts:720](https://github.com/simular-ai/simulang-js-internal/blob/d2b85c3277cbb16ce50c0781e1db8ad2c8a5690e/index.d.ts#L720)

Move the mouse cursor to the specified x and y coordinates.

You can specify absolute coordinates or relative from the current
position.

If you use absolute coordinates, the top left corner of your
monitor screen is x=0 y=0. Move the cursor down the screen by
increasing the y and to the right by increasing x coordinate.

If you use relative coordinates, a positive x value moves the
mouse cursor `x` pixels to the right. A negative value for `x`
moves the mouse cursor to the left. A positive value of y moves
the mouse cursor down, a negative one moves the mouse cursor up.

#### Parameters

##### x

`number`

##### y

`number`

##### coordinate

[`Coordinate`](../enumerations/Coordinate.mdx)

#### Returns

`void`

***

### scroll()

> **scroll**(`deltaX`, `deltaY`): `void`

Defined in: [index.d.ts:727](https://github.com/simular-ai/simulang-js-internal/blob/d2b85c3277cbb16ce50c0781e1db8ad2c8a5690e/index.d.ts#L727)

Send a mouse scroll event.

A positive length will result in scrolling down/right and negative
ones up/left.

#### Parameters

##### deltaX

`number`

##### deltaY

`number`

#### Returns

`void`
