UNPKG

rc-js-util

Version:

A collection of TS and C++ utilities to help writing performant and correct applications, achieved through strict typing and (removable) invariant checking.

97 lines (48 loc) 1.59 kB
<!-- Do not edit this file. It is automatically generated by API Documenter. --> [Home](./index.md) &gt; [rc-js-util](./rc-js-util.md) &gt; [Range1d](./rc-js-util.range1d.md) &gt; [scaleRelativeTo](./rc-js-util.range1d.scalerelativeto.md) ## Range1d.scaleRelativeTo() method Scales the range relative to a point (may not be outside of the range). **Signature:** ```typescript scaleRelativeTo<TResult extends TTypedArray = TArray>(_scalingFactor: number, _relativeTo: number, _result?: Range1d<TResult>): Range1d<TResult>; ``` ## Parameters <table><thead><tr><th> Parameter </th><th> Type </th><th> Description </th></tr></thead> <tbody><tr><td> \_scalingFactor </td><td> number </td><td> </td></tr> <tr><td> \_relativeTo </td><td> number </td><td> </td></tr> <tr><td> \_result </td><td> [Range1d](./rc-js-util.range1d.md)<!-- -->&lt;TResult&gt; </td><td> _(Optional)_ </td></tr> </tbody></table> **Returns:** [Range1d](./rc-js-util.range1d.md)<!-- -->&lt;TResult&gt; ## Remarks 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-------------|       |-------------| ```