---
title: Pointer Events
description: Explore the TresJS pointer events system powered by @pmndrs/pointer-events.
---
TresJS provides a comprehensive pointer events system that allows you to interact with 3D objects using mouse, touch, and other pointer devices. The event system is built on top of the powerful [`@pmndrs/pointer-events`](https://www.npmjs.com/package/@pmndrs/pointer-events) package, providing framework-agnostic pointer event handling for Three.js objects.
## Basic Usage
Pointer events are automatically enabled in `TresCanvas` and work seamlessly with all 3D objects. Simply add event listeners directly to your TresJS components:
::examples-pointer-events
::
```vue
```
## Available Events
TresJS supports all standard pointer events that you can listen to on any 3D object:
### Mouse Events
- `@click` - Fired when the object is clicked
- `@doubleclick` - Fired when the object is double-clicked
- `@contextmenu` - Fired when right-clicking the object
- `@pointerdown` - Fired when pointer is pressed down on the object
- `@pointerup` - Fired when pointer is released over the object
### Hover Events
- `@pointerenter` - Fired when pointer enters the object's bounds
- `@pointerleave` - Fired when pointer leaves the object's bounds
- `@pointerover` - Fired when pointer is over the object
- `@pointerout` - Fired when pointer moves away from the object
- `@pointermove` - Fired when pointer moves while over the object
### Drag Events
- `@pointercancel` - Fired when pointer interaction is cancelled
## Event Objects
Event handlers receive a `PointerEvent` object with useful information:
```vue
```
## Pointer Missed Events
You can listen for events when the pointer misses all objects (clicks on empty space) by adding the `@pointermissed` event directly to the `TresCanvas` component:
```vue
```
## Event Propagation
Events bubble up through the 3D object hierarchy. You can stop propagation using the standard event methods:
::examples-pointer-events-propagation
::
```vue
```
## Performance Considerations
- Events are automatically optimized using raycasting
- Only objects with event listeners are tested for intersections
- Use `pointer-events: none` in CSS to disable interaction on specific objects
- Consider using object pooling for scenes with many interactive objects
## TypeScript Support
TresJS provides full TypeScript support for pointer events:
```ts
import type { PointerEvent } from '@pmndrs/pointer-events'
function handlePointerEvent(event: PointerEvent) {
// Full type safety for event properties
console.log(event.point) // Vector3
console.log(event.object) // Object3D
console.log(event.xy) // [number, number]
}
```