pull/21833/head
Jorik Schellekens 2020-04-23 14:39:11 +01:00
parent 06f4eca05d
commit 4b4599c1d8
1 changed files with 4 additions and 4 deletions

View File

@ -36,7 +36,7 @@ type IProps = {
export default class Slider extends React.Component<IProps> { export default class Slider extends React.Component<IProps> {
// offset is a terrible inverse approximation. // offset is a terrible inverse approximation.
// if the values represents some function f(x) = y where x is the // if the values represents some function f(x) = y where x is the
// index of the array and y = values[x] then offset(f, y) = x // index of the array and y = values[x] then offset(f, y) = x
// s.t f(x) = y. // s.t f(x) = y.
// it assumes a monotonic function and interpolates linearly between // it assumes a monotonic function and interpolates linearly between
@ -50,16 +50,16 @@ export default class Slider extends React.Component<IProps> {
}, 0); }, 0);
// Off the left // Off the left
if (closest == 0) { if (closest === 0) {
return 0; return 0;
} }
// Off the right // Off the right
if (closest == values.length) { if (closest === values.length) {
return 100; return 100;
} }
// Now // Now
const closestLessValue = values[closest - 1]; const closestLessValue = values[closest - 1];
const closestGreaterValue = values[closest]; const closestGreaterValue = values[closest];