Skip to content

Commit

Permalink
Remove check on margin/padding/limit divisibility (#1163)
Browse files Browse the repository at this point in the history
  • Loading branch information
leongersen committed Oct 9, 2021
1 parent b597986 commit 4a69afe
Showing 1 changed file with 1 addition and 14 deletions.
15 changes: 1 addition & 14 deletions src/nouislider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -607,22 +607,9 @@ class Spectrum {
}

public getDistance(value: number): number[] {
let index;
const distances = [];

for (index = 0; index < this.xNumSteps.length - 1; index++) {
// last "range" can't contain step size as it is purely an endpoint.
const step = this.xNumSteps[index];

if (step && (value / step) % 1 !== 0) {
throw new Error(
"noUiSlider: 'limit', 'margin' and 'padding' of " +
this.xPct[index] +
"% range must be divisible by step."
);
}

// Calculate percentual distance in current range of limit, margin or padding
for (let index = 0; index < this.xNumSteps.length - 1; index++) {
distances[index] = fromPercentage(this.xVal, value, index);
}

Expand Down

0 comments on commit 4a69afe

Please sign in to comment.