@ue-too/board / createDefaultRotateByHandler
Function: createDefaultRotateByHandler()
createDefaultRotateByHandler():
RotateByHandlerFunction
Defined in: packages/board/src/camera/camera-rig/rotation-handler.ts:429
Creates a default "rotate by" handler pipeline for relative rotation operations.
Returns
Rotate-by handler function with restriction and clamping
Remarks
The default handler pipeline applies transformations in this order:
- Restriction (restrictRotateByHandler): Returns zero delta if locked
- Clamping (clampRotateByHandler): Adjusts delta to respect boundaries
This ensures that:
- Rotation can be completely disabled via
restrictRotationflag - Resulting rotation angle stays within configured angular boundaries
- Delta is adjusted to prevent boundary violations
Example
typescript
const rotateBy = createDefaultRotateByHandler();
camera.rotation = Math.PI * 0.4; // 72 degrees
camera.rotationBoundaries = { max: Math.PI / 2 }; // Max 90 degrees
const delta = Math.PI * 0.3; // Try to rotate 54 degrees (would exceed max)
const constrained = rotateBy(delta, camera, {
clampRotation: true,
restrictRotation: false
});
// constrained adjusted to only rotate to boundary
camera.setRotation(camera.rotation + constrained);See
- createHandlerChain for creating custom handler pipelines
- restrictRotateByHandler for the restriction step
- clampRotateByHandler for the clamping step