> ## 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

> Contains functions to control the mouse and to get the location of the cursor.

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.

## Constructor

```typescript
MouseController(): MouseController
```

### Returns

`MouseController`

## Methods

### button()

```typescript
button(button: Button, direction: Direction): void
```

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

<ResponseField name={"button"} type={"Button"} required />

<ResponseField name={"direction"} type={"Direction"} required />

### location()

```typescript
location(): [number, number]
```

Get the location of the mouse in pixels.

#### Returns

`[number, number]`

### moveMouse()

```typescript
moveMouse(x: number, y: number, coordinate: Coordinate): void
```

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

<ResponseField name={"x"} type={"number"} required />

<ResponseField name={"y"} type={"number"} required />

<ResponseField name={"coordinate"} type={"Coordinate"} required />

### scroll()

```typescript
scroll(deltaX: number, deltaY: number): void
```

Send a mouse scroll event.

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

#### Parameters

<ResponseField name={"deltaX"} type={"number"} required />

<ResponseField name={"deltaY"} type={"number"} required />
