touchTimeout for mobile
This commit is contained in:
@@ -28,6 +28,7 @@ const angryCount = ref(0);
|
|||||||
const menuVisible = ref(false);
|
const menuVisible = ref(false);
|
||||||
const holdTimeout = ref(null);
|
const holdTimeout = ref(null);
|
||||||
const hideTimeout = ref(null);
|
const hideTimeout = ref(null);
|
||||||
|
const touchTimeout = ref(null);
|
||||||
|
|
||||||
initializeReactions();
|
initializeReactions();
|
||||||
|
|
||||||
@@ -75,6 +76,9 @@ async function reactToContent(reaction) {
|
|||||||
hasReacted.value = false;
|
hasReacted.value = false;
|
||||||
console.log("Reaction to content removed.");
|
console.log("Reaction to content removed.");
|
||||||
}
|
}
|
||||||
|
setTimeout(() => {
|
||||||
|
menuVisible.value = false;
|
||||||
|
}, 500);
|
||||||
}
|
}
|
||||||
|
|
||||||
function adjustReactionCount(newReaction) {
|
function adjustReactionCount(newReaction) {
|
||||||
@@ -190,8 +194,13 @@ function hideReactions() {
|
|||||||
}, 250);
|
}, 250);
|
||||||
}
|
}
|
||||||
|
|
||||||
function onMouseDown() {
|
function onTouchStart() {
|
||||||
holdTimeout.value = setTimeout(showReactions, 250);
|
touchTimeout.value = setTimeout(() => {
|
||||||
|
menuVisible.value = true;
|
||||||
|
}, 250);
|
||||||
|
}
|
||||||
|
function onTouchEnd() {
|
||||||
|
clearTimeout(touchTimeout.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
function onMouseUp() {
|
function onMouseUp() {
|
||||||
@@ -235,7 +244,8 @@ function isMobileDevice() {
|
|||||||
v-bind="attrs"
|
v-bind="attrs"
|
||||||
:on="on"
|
:on="on"
|
||||||
variant="plain"
|
variant="plain"
|
||||||
@mousedown="onMouseDown"
|
@touchstart="onTouchStart"
|
||||||
|
@touchend="onTouchEnd"
|
||||||
@mouseup="onMouseUp"
|
@mouseup="onMouseUp"
|
||||||
@mouseover="onMouseOver"
|
@mouseover="onMouseOver"
|
||||||
@mouseleave="onMouseLeave"
|
@mouseleave="onMouseLeave"
|
||||||
|
|||||||
Reference in New Issue
Block a user