@ue-too/board
Version:
79 lines (78 loc) • 3.16 kB
TypeScript
import { BoardCamera } from "../interface";
/**
* @description This is the configuration for the rotation handler functions.
* This is the configuration object that is passed to the rotation handler functions.
*
* @category Camera
*/
export type RotationHandlerConfig = RotationHandlerRestrictConfig & RotationHandlerClampConfig;
export type RotationHandlerRestrictConfig = {
/**
* @description Whether to restrict the rotation. (if true, rotation input will be ignored)
*/
restrictRotation: boolean;
};
export type RotationHandlerClampConfig = {
/**
* @description Whether to clamp the rotation if the rotation is out of the rotation boundaries.
*/
clampRotation: boolean;
};
/**
* @description The function that is used to rotate the camera by a specific delta.
* The delta is in radians.
* This is structured as a handler pipeline.
*
* @see {@link createHandlerChain}
* @category Camera
*/
export type RotateByHandlerFunction = (delta: number, camera: BoardCamera, config: RotationHandlerConfig) => number;
/**
* @description The function that is used to rotate the camera to a specific target rotation.
* The target rotation is in radians.
* This is structured as a handler pipeline.
*
* @see {@link createHandlerChain}
* @category Camera
*/
export type RotateToHandlerFunction = (targetRotation: number, camera: BoardCamera, config: RotationHandlerConfig) => number;
/**
* @description This is the clamp handler for the "rotate by" handler pipeline.
* It clamps the delta to the range of the camera's rotation boundaries.
*
* @category Camera
*/
export declare function clampRotateByHandler(delta: number, camera: BoardCamera, config: RotationHandlerClampConfig): number;
/**
* @description This is the restrict handler for the "rotate by" handler pipeline.
* It restricts the delta to the range of the camera's rotation boundaries.
*
* @category Camera
*/
export declare function restrictRotateByHandler(delta: number, camera: BoardCamera, config: RotationHandlerRestrictConfig): number;
/**
* @description This is the clamp handler for the "rotate to" handler pipeline.
* It clamps the target rotation to the range of the camera's rotation boundaries.
*
* @category Camera
*/
export declare function clampRotateToHandler(targetRotation: number, camera: BoardCamera, config: RotationHandlerClampConfig): number;
/**
* @description This is the restrict handler for the "rotate to" handler pipeline.
* It restricts the target rotation to the range of the camera's rotation boundaries.
*
* @category Camera
*/
export declare function restrictRotateToHandler(targetRotation: number, camera: BoardCamera, config: RotationHandlerRestrictConfig): number;
/**
* @description This is the create default handler chain function for the "rotate by" handler pipeline.
*
* @category Camera
*/
export declare function createDefaultRotateByHandler(): RotateByHandlerFunction;
/**
* @description This is the create default handler chain function for the "rotate to" handler pipeline.
*
* @category Camera
*/
export declare function createDefaultRotateToHandler(): RotateToHandlerFunction;