UNPKG

@itwin/core-frontend

Version:
100 lines 4.92 kB
/** @packageDocumentation * @module Views */ import { LowAndHighXY, XAndY } from "@itwin/core-geometry"; /** A rectangle in unsigned integer view coordinates with (0,0) corresponding to the top-left corner of the view. * Increasing **x** moves from left to right, and increasing **y** moves from top to bottom. * [[left]], [[top]], [[right]], and [[bottom]] are required to be non-negative integers; any negative inputs are treated as * zero and any non-integer inputs are rounded down to the nearest integer. * @public * @extensions */ export declare class ViewRect { private _left; private _top; private _right; private _bottom; private _set; /** Construct a new ViewRect. */ constructor(left?: number, top?: number, right?: number, bottom?: number); /** The leftmost side of this ViewRect. */ get left(): number; set left(val: number); /** The topmost side of this ViewRect. */ get top(): number; set top(val: number); /** The rightmost side of this ViewRect. */ get right(): number; set right(val: number); /** The bottommost side of this ViewRect. */ get bottom(): number; set bottom(val: number); /** True if this ViewRect has an area <= 0. */ get isNull(): boolean; /** True if `!isNull` */ get isValid(): boolean; /** The width (right-left) of this ViewRect. */ get width(): number; set width(width: number); /** The height (bottom-top) of this ViewRect. */ get height(): number; set height(height: number); /** The aspect ratio (width/height) of this ViewRect. */ get aspect(): number; /** The area (width*height) of this ViewRect. */ get area(): number; /** Initialize this ViewRect from its left/top/right/bottom parameters. */ init(left: number, top: number, right: number, bottom: number): void; /** Initialize this ViewRect from two points. * @param topLeft The top-left corner. * @param bottomRight The bottom-right corner. */ initFromPoints(topLeft: XAndY, bottomRight: XAndY): void; /** Initialize this ViewRect from a range. * @param input The Range to use. `input.low` defines the top-left and `input.high` defines the bottom-right. */ initFromRange(input: LowAndHighXY): void; /** Return true is this ViewRect is exactly equal to another ViewRect. * @param other The other ViewRect to compare */ equals(other: ViewRect): boolean; /** Initialize this ViewRect from another ViewRect. */ setFrom(other: ViewRect): void; /** Duplicate this ViewRect. * @param result Optional ViewRect for result. If undefined, a new ViewRect is created. */ clone(result?: ViewRect): ViewRect; extend(other: ViewRect): void; /** Inset this ViewRect by values in the x and y directions. Positive values make the ViewRect smaller, and negative values will make it larger. * @param deltaX The distance to inset the ViewRect in the x direction. * @param deltaY The distance to inset the ViewRect in the y direction. */ inset(deltaX: number, deltaY: number): void; /** Inset this ViewRect by the same value in all directions. * @param offset The distance to inset this ViewRect. Positive values will make this ViewRect smaller and negative values will make it larger. * @note The inset operation can cause a previously valid ViewRect to become invalid. */ insetUniform(offset: number): void; /** Scale this ViewRect about its center by the supplied scale factors. */ scaleAboutCenter(xScale: number, yScale: number): void; /** Inset this ViewRect by a percentage of its current width. * @param percent The percentage of this ViewRect's width to inset in all directions. * @note The ViewRect will become smaller (or larger, if percent is negative) by `percent * width * 2` in each direction, since each side is moved by that distance. * @see [[inset]] */ insetByPercent(percent: number): void; /** Determine if this ViewRect is entirely contained within the bounds of another ViewRect. */ isContained(other: ViewRect): boolean; /** Return true if the supplied point is contained in this ViewRect. * @param point The point to test. * @note if the point is exactly on the left or top edges, this method returns true. If the point is exactly on the right or bottom edge, it returns false. */ containsPoint(point: XAndY): boolean; /** Determine whether this ViewRect overlaps another. */ overlaps(other: ViewRect): boolean; /** Return a ViewRect that is the overlap (intersection) of this ViewRect and another ViewRect. * If the two ViewRects are equal, their value is the result. Otherwise, the result will always be smaller than either of them. */ computeOverlap(other: ViewRect, out?: ViewRect): ViewRect | undefined; } //# sourceMappingURL=ViewRect.d.ts.map