number/grid#
Functions#
clampValue()#
clampValue(
value,start,end):Rational
Defined in: number/grid.ts:124
value held to [start, end]; an end of null (unknown) holds only below.
Parameters#
value#
start#
end#
Real | null
Returns#
nearest()#
nearest(
value,denominator):Rational
Defined in: number/grid.ts:26
The nearest multiple of 1 / denominator to value, a tie going up.
Parameters#
value#
denominator#
bigint
Returns#
snapValue()#
snapValue(
value,reach,numberType,granularity):Rational
Defined in: number/grid.ts:107
The value a pointer picks at value on an axis of numberType, reach
being half a device pixel on that axis:
fraction: for each divisor
dofgranularity.denominator, ascending, the nearestk/dtovalue(a tie going up); the first withinreachwins; none: the nearest multiple of1 / denominator.float: for
nfrom 0 togranularity.decimals,valuerounded tondecimal places (a tie going up), as an exact decimal; the first withinreachwins; none:decimalsplaces.int: for
10^mfrom the largest power of ten not above2·reach(at least 1) down to 1, the nearest multiple of10^m(a tie going up); the first withinreachwins; none: the nearest integer.
Parameters#
value#
reach#
numberType#
NumberType
granularity#
Returns#
Throws#
if reach is not positive.