import { ZAnchor } from '../anchor/anchor.mjs'; import { IZPoint2d } from './point.mjs'; import { IZQuadrilateral } from './quadrilateral.mjs'; /** * Represents a helper object that can run calculations on a numeric quadrilateral. */ export declare class ZRectangle { readonly sides: IZQuadrilateral; /** * Initializes a new instance of this object. * * @param sides - * The numeric sides of a quadrilateral. */ constructor(sides: IZQuadrilateral); /** * Calculates the width of the rectangle. * * @returns * The numeric width of the rectangle. */ width(): number; /** * Calculates the height of the rectangle. * * @returns * The numeric height of the rectangle. */ height(): number; /** * Calculates the area of the rectangle. * * @returns * The numeric area of the rectangle. */ area(): number; /** * Takes a candidate and attaches it to this rectangle that matches the anchor points. * * @param anchor - * The anchor point of this rectangle. * @param candidate - * The candidate rectangle to move * @param candidateAnchor - * The anchor point of the candidate rectangle. * * @returns * A new quadrilateral that has it's placement such that if candidate was moved * to this resulting position, would have its candidateAnchor be in the same * place as this rectangles specified anchor. */ attach(anchor: ZAnchor, candidate: IZQuadrilateral, candidateAnchor: ZAnchor): IZQuadrilateral; /** * Takes the candidate quadrilateral and adjusts it's coordinates to fit inside this rectangle. * * This is done by shifting the rectangle left, right, up, and down to make sure it is bounded * inside. * * If the candidate width or height is larger than this rectangle, thus it cannot fit, then * the candidate will be centered on the dimension where it is too big to fit. * * @param candidate - * The candidate quadrilateral to fit. * * @returns * A new quadrilateral that offsets candidate so that it can fit inside this * rectangle. */ offsetToFit(candidate: IZQuadrilateral): IZQuadrilateral; /** * Calculates the (x, y) point given an anchor target. * * @param anchor - * The anchor target to calculate the point for. * * @returns * The numeric width of the rectangle. */ point(anchor: ZAnchor): IZPoint2d; /** * Calculates the top left point of the rectangle. * * @returns * The top left point of the rectangle. */ topLeft: () => IZPoint2d; /** * Calculates the top center point of the rectangle. * * @returns * The top center point of the rectangle. */ topCenter: () => IZPoint2d; /** * Calculates the top right point of the rectangle. * * @returns * The top right point of the rectangle. */ topRight: () => IZPoint2d; /** * Calculates the middle left point of the rectangle. * * @returns * The middle left point of the rectangle. */ middleLeft: () => IZPoint2d; /** * Calculates the middle center point of the rectangle. * * @returns * The middle center point of the rectangle. */ middleCenter: () => IZPoint2d; /** * Calculates the middle right point of the rectangle. * * @returns * The middle right point of the rectangle. */ middleRight: () => IZPoint2d; /** * Calculates the bottom left point of the rectangle. * * @returns * The bottom left point of the rectangle. */ bottomLeft: () => IZPoint2d; /** * Calculates the bottom center point of the rectangle. * * @returns * The bottom center point of the rectangle. */ bottomCenter: () => IZPoint2d; /** * Calculates the bottom right point of the rectangle. * * @returns * The bottom right point of the rectangle. */ bottomRight: () => IZPoint2d; }