@core-graphics/rect
Version:
JS utilities for managing rects
28 lines (27 loc) • 1.1 kB
TypeScript
import { Rect } from "./lite";
/**
* Align this rect to a reference rect horizontally
*
* @param rect - The rect to align
* @param ref - The reference rect to align to
* @param align - The horizontal alignment to use
*/
export declare function alignHorizontal(rect: Rect, ref: Rect, align: HAlign): Rect;
/**
* Align this rect to a reference rect vertically
*
* @param rect - The rect to align
* @param ref - The reference rect to align to
* @param align - The horizontal alignment to use
*/
export declare function alignVertical(rect: Rect, ref: Rect, align: VAlign): Rect;
/**
* Align this rect to a reference rect based on the specifed placement
*/
export declare function align(rect: Rect, anchor: Rect, options: AlignOptions): Rect;
export declare type AlignOptions = {
horizontal: HAlign;
vertical: VAlign;
};
export declare type HAlign = "left-inside" | "left-outside" | "center" | "right-inside" | "right-outside" | "stretch";
export declare type VAlign = "top-inside" | "top-outside" | "center" | "bottom-inside" | "bottom-outside" | "stretch";