UNPKG

@ue-too/board

Version:
78 lines (77 loc) 2.69 kB
import { BoardCamera } from "../interface"; /** * @description The configuration for the base zoom handler. * * @category Camera */ export type ZoomHandlerConfig = ZoomHandlerClampConfig & ZoomHandlerRestrictConfig; export type ZoomHandlerClampConfig = { /** * @description Whether to clamp the zoom level. */ clampZoom: boolean; }; export type ZoomHandlerRestrictConfig = { /** * @description Whether to restrict the zoom level. */ restrictZoom: boolean; }; /** * @description The function signature for the zoom to handler. * * @category Camera */ export type ZoomToHandlerFunction = (destination: number, camera: BoardCamera, config: ZoomHandlerConfig) => number; /** * @description The function signature for the zoom by handler. * * @category Camera */ export type ZoomByHandlerFunction = (delta: number, camera: BoardCamera, config: ZoomHandlerConfig) => number; /** * @description The function that is part of the zoom to handler pipeline. * Clamps the zoom level to the zoom boundaries. * * @see {@link createHandlerChain} * @category Camera */ export declare function clampZoomToHandler(destination: number, camera: BoardCamera, config: ZoomHandlerClampConfig): number; /** * @description The function that is part of the zoom by handler pipeline. * Clamps the zoom level to the zoom boundaries. * * @see {@link createHandlerChain} * @category Camera */ export declare function clampZoomByHandler(delta: number, camera: BoardCamera, config: ZoomHandlerClampConfig): number; /** * @description The function that is part of the zoom to handler pipeline. * Restricts the zoom level to the zoom boundaries. * * @see {@link createHandlerChain} * @category Camera */ export declare function restrictZoomToHandler(destination: number, camera: BoardCamera, config: ZoomHandlerRestrictConfig): number; /** * @description The function that is part of the zoom by handler pipeline. * Restricts the zoom level to the zoom boundaries. * * @see {@link createHandlerChain} * @category Camera */ export declare function restrictZoomByHandler(delta: number, camera: BoardCamera, config: ZoomHandlerRestrictConfig): number; /** * @description The function that creates the default zoom to only handler. * clamp -> restrict -> base * @see {@link createHandlerChain} * @category Camera */ export declare function createDefaultZoomToOnlyHandler(): ZoomToHandlerFunction; /** * @description The function that creates the default zoom by only handler. * clamp -> restrict -> base * @see {@link createHandlerChain} * @category Camera */ export declare function createDefaultZoomByOnlyHandler(): ZoomByHandlerFunction;