Overview
The Pointer sensor responds to Pointer events for mouse, touch, and pen input. It is enabled by default in the DragDropManager.Usage
Activation Constraints
The Pointer sensor supports composable activation constraints through thePointerActivationConstraints class. Multiple constraints can be combined to create sophisticated activation behaviors.
Distance Constraint
Activates dragging after the pointer moves a certain distance:tolerance option defines a movement threshold that, if exceeded, will abort the activation. This is useful for distinguishing between intentional drags and accidental movements.
Delay Constraint
Activates dragging after holding the pointer for a duration:tolerance option specifies how much the pointer can move during the delay period before the activation is aborted.
Combining Constraints
Multiple constraints can be combined in an array. The drag operation activates when any constraint is satisfied:Default Behavior
By default, the Pointer sensor uses different activation constraints based on the pointer type and context:- Mouse on handle: Immediate activation
- Touch: 250ms delay with 5px tolerance
- Text inputs: 200ms delay with 0px tolerance
- Other pointers: 200ms delay with 10px tolerance + 5px distance
API Reference
Options
activationConstraints
ActivationConstraints<PointerEvent> | (event: PointerEvent, source: Draggable) => ActivationConstraints<PointerEvent>
Configure when dragging should start using an array of constraint instances:Can be a fixed array of constraints or a function that returns constraints based on the event and source.
Built-in constraints
ThePointerActivationConstraints class provides built-in constraint primitives. You can also create your own custom activation constraints by extending the ActivationConstraint class.
Distance
Activates dragging after the pointer moves a certain distance.Options for Distance
Required distance in pixels.
If specified, aborts activation if movement exceeds this threshold. Can be a number or an object with optional x and y properties.
Delay
Activates dragging after holding the pointer for a duration.Options
Required hold duration in milliseconds.
Maximum movement allowed during delay. Can be a number or an object with optional x and y properties. Exceeding this aborts activation.
Events
The Pointer sensor handles these events:pointerdown: Initial pointer contactpointermove: Pointer movementpointerup: Pointer release
Touch and mobile
The Pointer sensor handles touch input on mobile devices by default — no additional setup is required. On touch devices, dragging activates after a 250ms delay with 5px movement tolerance. This prevents accidental drags when scrolling. You can customize these constraints for your use case:Best Practices
-
Use appropriate constraints for different input types:
- Shorter delays for mouse
- Longer delays with tolerance for touch
- Distance constraints for precision
-
Consider accessibility:
- Don’t rely solely on hover
- Provide clear activation feedback
- Support keyboard input via KeyboardSensor