|
|
@ -75,7 +75,8 @@ function handleStart(event) { |
|
|
|
isDragging.value = true |
|
|
|
|
|
|
|
longPressTimer = setTimeout(() => { |
|
|
|
if (Math.round(sliderValue.value) === props.currValue) { |
|
|
|
longPressTimer = null |
|
|
|
if (+sliderValue.value.toFixed() === props.currValue) { |
|
|
|
emit('longPress', props.order) |
|
|
|
} |
|
|
|
}, 1200) |
|
|
@ -87,7 +88,6 @@ function handleStart(event) { |
|
|
|
} |
|
|
|
|
|
|
|
function handleDrag(event) { |
|
|
|
|
|
|
|
if (longPressTimer) { |
|
|
|
clearTimeout(longPressTimer) |
|
|
|
longPressTimer = null |
|
|
@ -102,7 +102,7 @@ function handleDrag(event) { |
|
|
|
sliderValue.value = |
|
|
|
totalVal.value - Math.min(1, Math.max(0, percent)) * totalVal.value |
|
|
|
// console.log(percent, sliderValue.value) |
|
|
|
emit('update:sliderValue', sliderValue.value.toFixed(), props.order) |
|
|
|
emit('update:sliderValue', +sliderValue.value.toFixed(), props.order) |
|
|
|
} |
|
|
|
|
|
|
|
function handleEnd() { |
|
|
@ -110,9 +110,10 @@ function handleEnd() { |
|
|
|
if (longPressTimer) { |
|
|
|
clearTimeout(longPressTimer) |
|
|
|
longPressTimer = null |
|
|
|
} else { |
|
|
|
emit('update:sliderEndValue', sliderValue.value.toFixed(), props.order) |
|
|
|
} |
|
|
|
|
|
|
|
emit('update:sliderEndValue', +sliderValue.value.toFixed(), props.order) |
|
|
|
|
|
|
|
document.removeEventListener('mousemove', handleDrag) |
|
|
|
document.removeEventListener('touchmove', handleDrag) |
|
|
|
document.removeEventListener('mouseup', handleEnd) |
|
|
|