Slider: reset size on click / drag

pull/6601/head
Leopoldthecoder 2017-08-20 22:07:03 +08:00 committed by 杨奕
parent 4ebb998346
commit 735ef1ac51
2 changed files with 2 additions and 0 deletions

View File

@ -138,6 +138,7 @@
onDragging(event) { onDragging(event) {
if (this.dragging) { if (this.dragging) {
this.displayTooltip(); this.displayTooltip();
this.$parent.resetSize();
let diff = 0; let diff = 0;
if (this.vertical) { if (this.vertical) {
this.currentY = event.clientY; this.currentY = event.clientY;

View File

@ -221,6 +221,7 @@
onSliderClick(event) { onSliderClick(event) {
if (this.disabled || this.dragging) return; if (this.disabled || this.dragging) return;
this.resetSize();
if (this.vertical) { if (this.vertical) {
const sliderOffsetBottom = this.$refs.slider.getBoundingClientRect().bottom; const sliderOffsetBottom = this.$refs.slider.getBoundingClientRect().bottom;
this.setPosition((sliderOffsetBottom - event.clientY) / this.sliderSize * 100); this.setPosition((sliderOffsetBottom - event.clientY) / this.sliderSize * 100);