@ue-too/board / createDefaultPanToHandler
Function: createDefaultPanToHandler()
createDefaultPanToHandler():
PanToHandlerFunction
Defined in: packages/board/src/camera/camera-rig/pan-handler.ts:258
Creates a default "pan to" handler pipeline for absolute camera positioning.
Returns
Pan-to handler function with restriction and clamping
Remarks
The default handler pipeline applies transformations in this order:
- Restriction (restrictPanToHandler): Applies axis restrictions based on config
- Clamping (clampToHandler): Clamps position to boundaries
This ensures that:
- Camera respects axis lock settings (e.g., side-scroller constraints)
- Camera position stays within configured boundaries
- Entire viewport can be kept in bounds (if
limitEntireViewPortis true)
All operations work in world coordinate space.
Examples
typescript
const panTo = createDefaultPanToHandler();
// Use in camera rig
const destination = { x: 1000, y: 500 };
const constrainedDest = panTo(destination, camera, {
restrictYTranslation: true, // Lock Y axis
clampTranslation: true,
limitEntireViewPort: true,
// ... other config
});
camera.setPosition(constrainedDest);typescript
// Create custom pipeline using default handlers
const customPanTo = createHandlerChain<Point, [BoardCamera, PanHandlerConfig]>(
restrictPanToHandler, // From default
myCustomHandler, // Your custom logic
clampToHandler // From default
);See
- createHandlerChain for creating custom handler pipelines
- restrictPanToHandler for the restriction step
- clampToHandler for the clamping step