advanced-cropper
Version:
The core of the advanced cropper libraries family
48 lines (47 loc) • 1.99 kB
TypeScript
import { AspectRatio, Coordinates, MoveDirections, PositionRestrictions, ResizeDirections, SizeRestrictions, ResizeAnchor } from "../types/index";
import { ResizeOptions } from "../state/index";
interface FitDirectionsParams {
directions: ResizeDirections;
coordinates: Coordinates;
positionRestrictions: PositionRestrictions;
sizeRestrictions: SizeRestrictions;
allowedDirections: {
left?: boolean;
right?: boolean;
top?: boolean;
bottom?: boolean;
};
preserveRatio?: boolean;
compensate?: boolean;
}
declare function fitDirections({ coordinates, directions, positionRestrictions, sizeRestrictions, preserveRatio, allowedDirections, compensate, }: FitDirectionsParams): ResizeDirections;
interface ResizeLimitations {
aspectRatio: AspectRatio;
sizeRestrictions: SizeRestrictions;
positionRestrictions: PositionRestrictions;
}
declare function resizeCoordinatesAlgorithm(coordinates: Coordinates, directions: ResizeDirections, options: {
compensate?: boolean;
preserveAspectRatio?: boolean;
allowedDirections?: {
left?: boolean;
right?: boolean;
top?: boolean;
bottom?: boolean;
};
respectDirection?: 'width' | 'height';
}, limitations: ResizeLimitations): Coordinates;
declare function anchorToAllowedDirections(anchor: ResizeAnchor): {
left: boolean;
top: boolean;
right: boolean;
bottom: boolean;
};
declare function anchorMoveToResizeDirections(anchor: ResizeAnchor, directions: MoveDirections): {
left: number;
top: number;
right: number;
bottom: number;
};
declare function anchoredResizeCoordinatesAlgorithm(coordinates: Coordinates, anchor: ResizeAnchor, directions: MoveDirections, options: ResizeOptions, limitations: ResizeLimitations): Coordinates;
export { fitDirections, ResizeLimitations, resizeCoordinatesAlgorithm, anchorToAllowedDirections, anchorMoveToResizeDirections, anchoredResizeCoordinatesAlgorithm };