UNPKG

@aurigma/design-atoms

Version:

Design Atoms is a part of Customer's Canvas SDK which allows for manipulating individual design elements through your code.

43 lines (42 loc) 3.18 kB
import { RectangleF } from "@aurigma/design-atoms-model/Math/RectangleF"; import { PointF, Transform, RotatedRectangleF, ILtrb } from "@aurigma/design-atoms-model/Math"; import { HorizontalOriginPointType, OriginPointType, ResizeRectangleType, VerticalOriginPointType } from "@aurigma/design-atoms-interfaces"; export interface ISize { width: number; height: number; } export declare namespace ISize { function from(avoSize: { width: number; height: number; }): ISize; } export declare function rectangleEquals(rec1: RectangleF, rec2: RectangleF, tolerance?: number): boolean; export declare function fitSizeToSize(fittingSize: ISize, targetSize: ISize, resizeType?: ResizeRectangleType): ISize; export declare function fitRectangleToRectangle(fittingRect: RectangleF, targetRect: RectangleF, resizeType?: ResizeRectangleType, originX?: HorizontalOriginPointType, originY?: VerticalOriginPointType): RectangleF; export declare function alignRectToRect(sourceRect: RotatedRectangleF, targetRect: RotatedRectangleF, horizontalAlignment: HorizontalOriginPointType, verticalAlignment: VerticalOriginPointType): RotatedRectangleF; export declare function getRectPoint(rect: RotatedRectangleF, horizontal: HorizontalOriginPointType, vertical: VerticalOriginPointType): PointF; export declare function snapValueToStep(oldVal: number, newVal: number, step: number): number; /** * Clamps a value to a range [min, max]. * @param value The value for clamping. * @param min The minimum values. If the input value is less than this value, the output will be this value. * @param max The maximum value. If the input value is more than this value, the output will be this value. */ export declare function clamp(value: number, min: number, max: number): number; export declare function getOriginCoordinate(rect: RectangleF, originX: OriginPointType, originY: OriginPointType): PointF; export declare function getTranslationTransform(source: PointF, target: PointF): Transform; export declare function minByAbs(...values: number[]): number; export declare function getResizedImageAxisDpi(sourceSize: number, sourceDpi: number, targetSize: number): number; export declare function getResizedImageMinAxisDpi(sourceWidth: number, sourceHeight: number, sourceDpiX: number, sourceDpiY: number, targetWidth: number, targetHeight: number): number; /** * Maps the given value from the range [oldMin, oldMax] to the range [newMin, newMax]. * Where each min is less than corresponding max. * @param value The value to map. * @param oldMin The minimum value of the old range. Must be less than {@link oldMax}. * @param oldMax The maximum value of the old range. Must be greater than {@link oldMin}. * @param newMin The minimum value of the new range. Must be less than {@link newMax}. * @param newMax The maximum value of the new range. Must be greater than {@link newMin}. */ export declare function mapToRange(value: number, oldMin: number, oldMax: number, newMin: number, newMax: number): number; export declare function getRotatedRectangleWithBorder(rectangle: RotatedRectangleF, border: ILtrb): RotatedRectangleF;