@ue-too/board / createDefaultZoomToOnlyHandler
Function: createDefaultZoomToOnlyHandler()
createDefaultZoomToOnlyHandler():
ZoomToHandlerFunction
Defined in: packages/board/src/camera/camera-rig/zoom-handler.ts:422
Creates a default "zoom to" handler pipeline for absolute zoom operations.
Returns
Zoom-to handler function with clamping and restriction
Remarks
The default handler pipeline applies transformations in this order:
- Clamping (clampZoomToHandler): Clamps zoom to configured boundaries
- Restriction (restrictZoomToHandler): Prevents zoom if locked
This ensures that:
- Zoom level stays within configured min/max boundaries
- Zoom can be completely disabled via
restrictZoomflag
The pipeline is specifically for zoom operations without pan compensation. For zoom-at-point operations, use DefaultCameraRig.zoomToAt which combines zoom and pan handlers.
Examples
typescript
const zoomTo = createDefaultZoomToOnlyHandler();
camera.zoomBoundaries = { min: 0.5, max: 4.0 };
// Use in camera rig
const target = 5.0; // Exceeds max
const constrained = zoomTo(target, camera, {
clampZoom: true,
restrictZoom: false
});
// constrained = 4.0 (clamped to max boundary)
camera.setZoomLevel(constrained);typescript
// Create custom pipeline
const customZoomTo = createHandlerChain<number, [BoardCamera, ZoomHandlerConfig]>(
clampZoomToHandler, // From default
myCustomZoomHandler, // Your custom logic
restrictZoomToHandler // From default
);See
- createHandlerChain for creating custom handler pipelines
- clampZoomToHandler for the clamping step
- restrictZoomToHandler for the restriction step