Module

calculateCenteredRange

Calculate a range of number to be displayed, with the active number to be centered in the range if possible.
Parameters:
Name Type Description
active number The active number to be centered
minPossibleIndex number Minimum possible number
maxPossibleIndex number Maximum possible number
maxRange number Maximum range of number to be displayed each time
Author:
  • Sandy Lau https://github.com/sandylau333

View Source math/calculateCenteredRange.js, line 3

Return a tuple including minimum and maximum number of the range [Min, Max]
Array.<number>