Optionalproperties: GradumRectProperties = {}
The rectangle's position, size, rotation, and anchor.
The rectangle's rotation in degrees. Reads and writes the same rotation as GradumRect.angleRad, converted.
StaticfromFunction
fromSegment
The segment's start.
The segment's end.
Optionalthickness: number = 1
The rectangle's height, across the segment.
Optionalproperties: GradumRectProperties = {}
Extra properties. The computed rotation wins over any angle given here.
The rectangle covering the segment.
StaticfromFunction
fromDOMRect
The rect to copy position and size from.
Optionalproperties: GradumRectProperties = {}
Extra properties, such as a rotation to apply.
The converted rectangle.
Function
closestPoint
The rectangle to measure to.
The nearest point on this rectangle.
Find the point on this rectangle nearest to another rectangle. Accepts a plain
DOMRect or a rotated GradumRect.
Function
overlaps
The rectangle to test against.
Whether the two overlap.
Test whether this rectangle overlaps another. Accepts a plain DOMRect or a rotated
GradumRect.
Function
overlaps
The point to test.
Whether the point is contained.
GradumRect
Description
A rectangle that can be rotated, unlike the axis-aligned DOMRect it extends. Its geometry helpers (GradumRect.closestPoint, GradumRect.distanceTo, GradumRect.overlaps) all account for the rotation, and accept a point, a segment, or another rect.