Commit 932d6bdb authored by kingwl's avatar kingwl Committed by 杨奕

Slider: fix drag bug

parent c80db9ca
...@@ -136,7 +136,12 @@ ...@@ -136,7 +136,12 @@
}, },
setPosition(newPos) { setPosition(newPos) {
if (newPos >= 0 && (newPos <= 100)) { if (newPos < 0) {
newPos = 0;
} else if (newPos > 100) {
newPos = 100;
}
const lengthPerStep = 100 / ((this.max - this.min) / this.step); const lengthPerStep = 100 / ((this.max - this.min) / this.step);
const steps = Math.round(newPos / lengthPerStep); const steps = Math.round(newPos / lengthPerStep);
let value = steps * lengthPerStep * (this.max - this.min) * 0.01 + this.min; let value = steps * lengthPerStep * (this.max - this.min) * 0.01 + this.min;
...@@ -151,7 +156,6 @@ ...@@ -151,7 +156,6 @@
this.oldValue = this.value; this.oldValue = this.value;
} }
} }
}
}, },
onSliderClick(event) { onSliderClick(event) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment