sliders: round steps to avoid errors
This commit is contained in:
parent
4d7ef455ce
commit
e4b45b1a6b
1 changed files with 2 additions and 1 deletions
|
|
@ -239,7 +239,8 @@ class Slider extends Canvas {
|
|||
var steps = this.getProp('steps')
|
||||
if (steps === 'auto') {
|
||||
this.steps = this.rangeVals
|
||||
} else if (typeof steps === 'number' && steps > 0) {
|
||||
} else if (typeof steps === 'number' && Math.round(steps) > 0) {
|
||||
steps = Math.round(steps)
|
||||
this.steps = Array(steps).fill(0).map((x, i) => i / (steps - 1) * (this.rangeValsMax - this.rangeValsMin) + this.rangeValsMin)
|
||||
} else if (Array.isArray(steps) && step.every(x=>typeof x === 'number')) {
|
||||
this.steps = steps
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue