# ElementMouseEvent

Class · extends [`ElementInputEvent`](https://api.playcanvas.com/engine/classes/ElementInputEvent.md) · category: User Interface

Source: https://github.com/playcanvas/engine/blob/f059dc005842f76e052cdf44d8370c8c7ec475ac/src/framework/input/element-input.js#L180

Represents a Mouse event fired on a [ElementComponent](https://api.playcanvas.com/engine/classes/ElementComponent.md).

## Constructors

### constructor

```ts
new ElementMouseEvent(event: MouseEvent | WheelEvent, element: ElementComponent, camera: CameraComponent, x: number, y: number, lastX: number, lastY: number)
```

Create an instance of an ElementMouseEvent.

**Parameters**

- `event` (`MouseEvent | WheelEvent`): The browser MouseEvent or
  WheelEvent that was originally raised.
- `element` ([`ElementComponent`](https://api.playcanvas.com/engine/classes/ElementComponent.md)): The
  ElementComponent that this event was originally raised on.
- `camera` ([`CameraComponent`](https://api.playcanvas.com/engine/classes/CameraComponent.md)): The
  CameraComponent that this event was originally raised via.
- `x` (`number`): The x coordinate.
- `y` (`number`): The y coordinate.
- `lastX` (`number`): The last x coordinate.
- `lastY` (`number`): The last y coordinate.

## Properties

### altKey

```ts
altKey: boolean
```

Whether the alt key was pressed.

### button

```ts
button: number
```

The mouse button.

### ctrlKey

```ts
ctrlKey: boolean
```

Whether the ctrl key was pressed.

### dx

```ts
dx: number
```

The amount of horizontal movement of the cursor.

### dy

```ts
dy: number
```

The amount of vertical movement of the cursor.

### metaKey

```ts
metaKey: boolean
```

Whether the meta key was pressed.

### shiftKey

```ts
shiftKey: boolean
```

Whether the shift key was pressed.

### wheelDelta

```ts
wheelDelta: number
```

The amount of the wheel movement.

## Inherited from [ElementInputEvent](https://api.playcanvas.com/engine/classes/ElementInputEvent.md)

- `camera: CameraComponent`
- `element: ElementComponent`
- `event: MouseEvent | TouchEvent | XRInputSourceEvent | null`
- `stopPropagation(): void`
