Documentation / @ripl/core / getGradientBounds
Function: getGradientBounds() ​
getGradientBounds(
box,width,height):GradientBounds
Defined in: packages/core/src/gradient/bounds.ts:30
Resolves the rectangle a gradient's coordinates map onto: the given bounding box, falling back to the full surface when no box is supplied or it has no area.
Every backend resolves gradients through this, so a gradient painted onto the same element renders identically whichever context draws it — including elements that paint as several paths, where each path's own box would otherwise restart the ramp.
Parameters ​
| Parameter | Type | Description |
|---|---|---|
box | Box | undefined | The element's local bounding box, when it has one. |
width | number | Width of the rendering surface, used as the fallback. |
height | number | Height of the rendering surface, used as the fallback. |
Returns ​
The rectangle to resolve gradient coordinates against.