Adjustments for touch

This commit is contained in:
2024-12-20 17:11:58 +00:00
parent cb00c88197
commit 7431cd2233

View File

@@ -20,10 +20,6 @@
} }
function stopProgress() { function stopProgress() {
resetProgress();
}
function resetProgress() {
clearInterval(interval); clearInterval(interval);
loading.value = false; loading.value = false;
@@ -36,7 +32,7 @@
if (current.value >= props.duration) { if (current.value >= props.duration) {
emit('longPress'); emit('longPress');
resetProgress(); stopProgress();
} }
} }
@@ -51,13 +47,14 @@
<template> <template>
<button <button
:class="{ 'loading-button': loading }" class="long-press-button"
:class="{ loading: loading }"
@pointerdown="startProgress" @pointerdown="startProgress"
@pointerup="stopProgress"> @pointerup="stopProgress"
@pointercancel="stopProgress">
<span v-show="!loading"> <span v-show="!loading">
<slot name="default"></slot> <slot name="default"></slot>
</span> </span>
<v-progress-circular <v-progress-circular
v-if="loading" v-if="loading"
:size="props.progressSize" :size="props.progressSize"
@@ -66,11 +63,14 @@
</template> </template>
<style scoped> <style scoped>
.loading-button { .long-press-button {
touch-action: none;
}
.loading {
display: inline-flex; display: inline-flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
touch-action: none;
} }
</style> </style>