Documentation Index
Fetch the complete documentation index at: https://mintlify.com/tldraw/tldraw/llms.txt
Use this file to discover all available pages before exploring further.
LaserTool
TheLaserTool enables users to draw temporary laser pointer paths on the canvas that automatically fade away. This is useful for presentations, demonstrations, or collaborative work where you want to point out specific areas without creating permanent marks.
Overview
LaserTool extends StateNode and provides laser pointer functionality with automatic fading. The laser path appears as you drag your pointer and fades out after a configurable delay.
Static properties
Tool identifier
Initial child state
Laser tool cannot be locked
Child states
The laser tool has two child states:- Idle - Tool is active but not currently drawing
- Lasering - User is actively drawing with the laser
Instance properties
Current laser drawing session ID, or null if no active session
Methods
onEnter()
Called when entering the laser tool. Sets the cursor to a crosshair.onExit()
Called when exiting the laser tool. Clears the session ID.onCancel()
Handles cancellation (Escape key). Clears the current laser session or returns to select tool.getSessionId()
Gets the current laser session ID, or creates a new one if needed.selfConsume: false- Path doesn’t consume pointer eventsidleTimeoutMs- Delay before fading (from editor options)fadeMode: 'grouped'- Fades as a groupfadeEasing: 'ease-in'- Easing function for fade animation
Usage
The laser tool is included indefaultTools and available by default:
Keyboard shortcuts
- K - Activate laser tool
- Escape - Cancel current laser path or return to select tool
Configuration
The laser fade delay can be configured via editor options:Common patterns
Temporary highlighting in presentations
Custom laser tool with different fade duration
Related
- StateNode - Base class for all tools
- HandTool - Panning tool
- SelectTool - Selection tool