Home > rc-js-util > Range1d > scaleRelativeTo
Scales the range relative to a point (may not be outside of the range).
Signature:
scaleRelativeTo<TResult extends TTypedArray = TArray>(_scalingFactor: number, _relativeTo: number, _result?: Range1d<TResult>): Range1d<TResult>;
| Parameter | Type | Description | 
|---|---|---|
| _scalingFactor | number | |
| _relativeTo | number | |
| _result | Range1d<TResult> | (Optional) | 
Returns:
Range1d<TResult>
If the point is at a boundary, then the range will be scaled such that that boundary is not changed. Where the point is away from a boundary, the updated range will have boundaries proportional to the distance from the center of the range.
E.g. scaling factor of 0.5, P represents the position of the point in the range:
 min                       max
 |P-------------------------|
 |-------------|
 |------------P-------------|
       |-------------|