Fixed #967 - Decimal value for Slider step does not work

pull/1196/head^2
Tuğçe Küçükoğlu 2021-05-14 11:16:09 +03:00
parent f579ac54b7
commit fd15103171
1 changed files with 6 additions and 3 deletions

View File

@ -83,10 +83,13 @@ export default {
else if (diff > 0) else if (diff > 0)
newValue = oldValue + Math.floor(newValue / this.step - oldValue / this.step) * this.step; newValue = oldValue + Math.floor(newValue / this.step - oldValue / this.step) * this.step;
} }
else {
newValue = Math.floor(newValue);
}
this.updateModel(event, newValue); this.updateModel(event, newValue);
}, },
updateModel(event, value) { updateModel(event, value) {
let newValue = value; let newValue = parseFloat(value.toFixed(10));
let modelValue; let modelValue;
if (this.range) { if (this.range) {
@ -100,7 +103,7 @@ export default {
else if (newValue >= maxValue) else if (newValue >= maxValue)
newValue = maxValue; newValue = maxValue;
modelValue[0] = Math.floor(newValue); modelValue[0] = newValue;
modelValue[1] = modelValue[1] || this.max; modelValue[1] = modelValue[1] || this.max;
} }
else { else {
@ -111,7 +114,7 @@ export default {
newValue = minValue; newValue = minValue;
modelValue[0] = modelValue[0] || this.min; modelValue[0] = modelValue[0] || this.min;
modelValue[1] = Math.floor(newValue); modelValue[1] = newValue;
} }
} }
else { else {