applyToRect
Transforms a rectangle by a matrix and returns its bounding box: the smallest axis-aligned rectangle that contains it. After a rotation or a skew, the box is larger than the rectangle.
Available since v3.1.5
Import
Section titled “Import”Signature
Section titled “Signature”Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
m | Matrix | The matrix |
r | Rect | The rectangle |
Returns
Section titled “Returns”Rect — The bounding box of the transformed rectangle
Examples
Section titled “Examples”Bounds of a scaled layer
Section titled “Bounds of a scaled layer”The bounding box of the transformed rectangle.
Bounds of a rotated layer
Section titled “Bounds of a rotated layer”After a rotation, the box is larger than the rectangle.
Related Types
Section titled “Related Types”Matrix
Section titled “Matrix”A 2D affine transformation, in the layout of CSS and SVG matrix(a, b, c, d, e, f):
An axis-aligned rectangle: its top-left corner and its size. Width and height are expected to be non-negative.
