ViewRect Class
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.
Methods
| Name | Description | |
|---|---|---|
| constructor(left: number = 0, top: number = 0, right: number = 0, bottom: number = 0): ViewRect | Construct a new ViewRect. | |
| clone(result?: ViewRect): ViewRect | Duplicate this ViewRect. | |
| computeOverlap(other: ViewRect, out?: ViewRect): undefined | ViewRect | Return a ViewRect that is the overlap (intersection) of this ViewRect and another ViewRect. | |
| containsPoint(point: Readonly<WritableXAndY>): boolean | Return true if the supplied point is contained in this ViewRect. | |
| equals(other: ViewRect): boolean | Return true is this ViewRect is exactly equal to another ViewRect. | |
| extend(other: ViewRect): void | ||
| init(left: number, top: number, right: number, bottom: number): void | Initialize this ViewRect from its left/top/right/bottom parameters. | |
| initFromPoints(topLeft: Readonly<WritableXAndY>, bottomRight: Readonly<WritableXAndY>): void | Initialize this ViewRect from two points. | |
| initFromRange(input: Readonly<WritableLowAndHighXY>): void | Initialize this ViewRect from a range. | |
| inset(deltaX: number, deltaY: number): void | Inset this ViewRect by values in the x and y directions. | |
| insetByPercent(percent: number): void | Inset this ViewRect by a percentage of its current width. | |
| insetUniform(offset: number): void | Inset this ViewRect by the same value in all directions. | |
| isContained(other: ViewRect): boolean | Determine if this ViewRect is entirely contained within the bounds of another ViewRect. | |
| overlaps(other: ViewRect): boolean | Determine whether this ViewRect overlaps another. | |
| scaleAboutCenter(xScale: number, yScale: number): void | Scale this ViewRect about its center by the supplied scale factors. | |
| setFrom(other: ViewRect): void | Initialize this ViewRect from another ViewRect. |
Properties
Defined in
Last Updated: 28 October, 2025
Found something wrong, missing, or unclear on this page? Raise an issue in our repo.