Commit eb8c6cd9b31088829e5ed0b1a51d39ae70950785
1 parent
965b6d8e
Correct steps calculation
Showing
1 changed file
with
2 additions
and
4 deletions
Show diff stats
src/components/slider/slider.vue
... | ... | @@ -254,11 +254,9 @@ |
254 | 254 | if (type === 'min') newPos = this.checkLimits([newPos, this.maxPosition])[0]; |
255 | 255 | else newPos = this.checkLimits([this.minPosition, newPos])[1]; |
256 | 256 | |
257 | - const lengthPerStep = this.valueRange / 100 * this.step; | |
258 | - const steps = Math.round(newPos / lengthPerStep); | |
259 | - | |
257 | + const modulus = newPos % this.step; | |
260 | 258 | const value = this.currentValue; |
261 | - value[index] = Math.round(steps * lengthPerStep); | |
259 | + value[index] = newPos - modulus; | |
262 | 260 | this.currentValue = [...value]; |
263 | 261 | |
264 | 262 | if (!this.dragging) { | ... | ... |