util.math.cycleRestrict

Static function.

Assigns a numeric value to the set range. The range of values is considered to be closed in a ring. If a value is outside one of the ends of the range, the extra is counted off around the circl from the other end.

Returns value can be limited.

{ Number } util.math.cycleRestrict(value, min, max)

Parameters:

Parameter

Default value

Description

value*

Type: Number

Value can be limited.

min*

Type: Number

Minimum limit.

max*

Type: Number

Maximum limit.

* Mandatory parameter/option.

Example:

// Returns 110
ymaps.util.math.cycleRestrict(-250, -180, 180);
// Returns 60
ymaps.util.math.cycleRestrict(-300, -180, 180);
// Returns -170
ymaps.util.math.cycleRestrict(190, -180, 180);